--- a/Debugger/BreakPointViewer.py Fri Dec 22 16:36:02 2017 +0100 +++ b/Debugger/BreakPointViewer.py Fri Dec 22 17:56:49 2017 +0100 @@ -10,13 +10,16 @@ from __future__ import unicode_literals from PyQt5.QtCore import pyqtSignal, Qt, QItemSelectionModel, \ - QSortFilterProxyModel + QSortFilterProxyModel, QFileInfo from PyQt5.QtWidgets import QTreeView, QAbstractItemView, QHeaderView, QMenu, \ QDialog from E5Gui.E5Application import e5App -from Globals import qVersionTuple +from Globals import qVersionTuple, recentNameBreakpointFiles, \ + recentNameBreakpointConditions + +import Preferences class BreakPointViewer(QTreeView): @@ -59,6 +62,8 @@ self.fnHistory = [] self.fnHistory.append('') + self.__loadRecent() + def setModel(self, model): """ Public slot to set the breakpoint model. @@ -248,6 +253,8 @@ self.condHistory.remove(cond) self.condHistory.insert(0, cond) + self.__saveRecent() + self.__model.addBreakPoint(fn, line, (cond, temp, enabled, count)) self.__resizeColumns() self.__resort() @@ -293,6 +300,8 @@ if cond in self.condHistory: self.condHistory.remove(cond) self.condHistory.insert(0, cond) + + self.__saveRecent() self.__model.setBreakPointByIndex( sindex, fn, line, (cond, temp, enabled, count)) @@ -463,3 +472,38 @@ """ e5App().getObject("UserInterface").showPreferences( "debuggerGeneralPage") + + def __loadRecent(self): + """ + Private method to load the recently used file names. + """ + Preferences.Prefs.rsettings.sync() + + # load recently used file names + self.fnHistory = [] + self.fnHistory.append('') + rs = Preferences.Prefs.rsettings.value(recentNameBreakpointFiles) + if rs is not None: + recent = [f + for f in Preferences.toList(rs) + if QFileInfo(f).exists()] + self.fnHistory.extend( + recent[:Preferences.getDebugger("RecentNumber")]) + + # load recently entered condition expressions + self.condHistory = [] + rs = Preferences.Prefs.rsettings.value(recentNameBreakpointConditions) + if rs is not None: + self.condHistory = \ + Preferences.toList(rs)[ + :Preferences.getDebugger("RecentNumber")] + + def __saveRecent(self): + """ + Private method to save the list of recently used file names. + """ + recent = [f for f in self.fnHistory if f] + Preferences.Prefs.rsettings.setValue(recentNameBreakpointFiles, recent) + Preferences.Prefs.rsettings.setValue(recentNameBreakpointConditions, + self.condHistory) + Preferences.Prefs.rsettings.sync()