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. |
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() |