Debugger/BreakPointViewer.py

changeset 6034
4f88f70d2cd4
parent 5736
000ea446ff4b
child 6048
82ad8ec9548c
equal deleted inserted replaced
6033:967b3e3e5b4d 6034:4f88f70d2cd4
8 """ 8 """
9 9
10 from __future__ import unicode_literals 10 from __future__ import unicode_literals
11 11
12 from PyQt5.QtCore import pyqtSignal, Qt, QItemSelectionModel, \ 12 from PyQt5.QtCore import pyqtSignal, Qt, QItemSelectionModel, \
13 QSortFilterProxyModel 13 QSortFilterProxyModel, QFileInfo
14 from PyQt5.QtWidgets import QTreeView, QAbstractItemView, QHeaderView, QMenu, \ 14 from PyQt5.QtWidgets import QTreeView, QAbstractItemView, QHeaderView, QMenu, \
15 QDialog 15 QDialog
16 16
17 from E5Gui.E5Application import e5App 17 from E5Gui.E5Application import e5App
18 18
19 from Globals import qVersionTuple 19 from Globals import qVersionTuple, recentNameBreakpointFiles, \
20 recentNameBreakpointConditions
21
22 import Preferences
20 23
21 24
22 class BreakPointViewer(QTreeView): 25 class BreakPointViewer(QTreeView):
23 """ 26 """
24 Class implementing the Breakpoint viewer widget. 27 Class implementing the Breakpoint viewer widget.
56 self.__createPopupMenus() 59 self.__createPopupMenus()
57 60
58 self.condHistory = [] 61 self.condHistory = []
59 self.fnHistory = [] 62 self.fnHistory = []
60 self.fnHistory.append('') 63 self.fnHistory.append('')
64
65 self.__loadRecent()
61 66
62 def setModel(self, model): 67 def setModel(self, model):
63 """ 68 """
64 Public slot to set the breakpoint model. 69 Public slot to set the breakpoint model.
65 70
246 if cond: 251 if cond:
247 if cond in self.condHistory: 252 if cond in self.condHistory:
248 self.condHistory.remove(cond) 253 self.condHistory.remove(cond)
249 self.condHistory.insert(0, cond) 254 self.condHistory.insert(0, cond)
250 255
256 self.__saveRecent()
257
251 self.__model.addBreakPoint(fn, line, (cond, temp, enabled, count)) 258 self.__model.addBreakPoint(fn, line, (cond, temp, enabled, count))
252 self.__resizeColumns() 259 self.__resizeColumns()
253 self.__resort() 260 self.__resort()
254 261
255 def __doubleClicked(self, index): 262 def __doubleClicked(self, index):
291 cond, temp, enabled, count = dlg.getData() 298 cond, temp, enabled, count = dlg.getData()
292 if cond: 299 if cond:
293 if cond in self.condHistory: 300 if cond in self.condHistory:
294 self.condHistory.remove(cond) 301 self.condHistory.remove(cond)
295 self.condHistory.insert(0, cond) 302 self.condHistory.insert(0, cond)
303
304 self.__saveRecent()
296 305
297 self.__model.setBreakPointByIndex( 306 self.__model.setBreakPointByIndex(
298 sindex, fn, line, (cond, temp, enabled, count)) 307 sindex, fn, line, (cond, temp, enabled, count))
299 self.__resizeColumns() 308 self.__resizeColumns()
300 self.__resort() 309 self.__resort()
461 """ 470 """
462 Private method to open the configuration dialog. 471 Private method to open the configuration dialog.
463 """ 472 """
464 e5App().getObject("UserInterface").showPreferences( 473 e5App().getObject("UserInterface").showPreferences(
465 "debuggerGeneralPage") 474 "debuggerGeneralPage")
475
476 def __loadRecent(self):
477 """
478 Private method to load the recently used file names.
479 """
480 Preferences.Prefs.rsettings.sync()
481
482 # load recently used file names
483 self.fnHistory = []
484 self.fnHistory.append('')
485 rs = Preferences.Prefs.rsettings.value(recentNameBreakpointFiles)
486 if rs is not None:
487 recent = [f
488 for f in Preferences.toList(rs)
489 if QFileInfo(f).exists()]
490 self.fnHistory.extend(
491 recent[:Preferences.getDebugger("RecentNumber")])
492
493 # load recently entered condition expressions
494 self.condHistory = []
495 rs = Preferences.Prefs.rsettings.value(recentNameBreakpointConditions)
496 if rs is not None:
497 self.condHistory = \
498 Preferences.toList(rs)[
499 :Preferences.getDebugger("RecentNumber")]
500
501 def __saveRecent(self):
502 """
503 Private method to save the list of recently used file names.
504 """
505 recent = [f for f in self.fnHistory if f]
506 Preferences.Prefs.rsettings.setValue(recentNameBreakpointFiles, recent)
507 Preferences.Prefs.rsettings.setValue(recentNameBreakpointConditions,
508 self.condHistory)
509 Preferences.Prefs.rsettings.sync()

eric ide

mercurial