From cc6a881e2cf85f47bd6e88f7a5349de11e3c0ec6 Mon Sep 17 00:00:00 2001 From: fuzzy Date: Fri, 12 May 2017 08:38:26 +0200 Subject: [PATCH] save recent files to application settings --- application/mainwindow.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/application/mainwindow.py b/application/mainwindow.py index 43fbe4f..c1c28f3 100644 --- a/application/mainwindow.py +++ b/application/mainwindow.py @@ -29,7 +29,7 @@ ui = uic.loadUiType(os.path.join(ROOT, "assets", "ui", "mainwindow.ui"))[0] -MAX_RECENT_FILES = 10 +MAX_RECENT_FILES = 5 class MainWindow(QtWidgets.QMainWindow, ui): def __init__(self, parent=None): @@ -95,6 +95,7 @@ def loadSettings(self): # self._tableViewWidth = int(settings.value("tableViewWidth", '')) self.threadsSpin.setValue(settings.value("threadsCount", THREADS, type=int)) self.timeoutSpin.setValue(settings.value("timeoutSpin", TIMEOUT, type=int)) + self._recentFiles = settings.value("recentFiles", [], type=str) def saveSettings(self): settings = QSettings(self._settingsFile, QSettings.IniFormat) @@ -103,6 +104,7 @@ def saveSettings(self): # settings.setValue("tableViewWidth", self.sitesTableView.frameGeometry().width()) settings.setValue("threadsCount", self.threadsSpin.value()) settings.setValue("timeout", self.timeoutSpin.value()) + settings.setValue("recentFiles", self._recentFiles) def onResize(self, event): self.resizeTableColumns()