From c2850a9c77976b1c4a4c6e64328c314cb0679a01 Mon Sep 17 00:00:00 2001 From: BasioMeusPuga Date: Fri, 2 Mar 2018 19:03:20 +0530 Subject: [PATCH] Fullscreened widget closure saves settings --- TODO | 3 +-- __main__.py | 2 +- settings.py | 3 ++- widgets.py | 11 +++++++++++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index 56281d8..063005a 100644 --- a/TODO +++ b/TODO @@ -64,8 +64,7 @@ TODO ✓ Define every widget in code Bugs: If there are files open and the database is deleted, TypeErrors result - Closing a fullscreened contentView does not save settings - + Secondary: Annotations Graphical themes diff --git a/__main__.py b/__main__.py index 0aeaa3c..8eeb497 100755 --- a/__main__.py +++ b/__main__.py @@ -731,7 +731,7 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow): return current_color signal_sender = self.sender().objectName() - + if signal_sender == 'libraryBackground': current_color = self.settings['listview_background'] new_color = open_color_dialog(current_color) diff --git a/settings.py b/settings.py index a1be12f..eb0a61c 100644 --- a/settings.py +++ b/settings.py @@ -106,7 +106,8 @@ class Settings: self.settings.setValue('windowSize', self.parent.size()) self.settings.setValue('windowPosition', self.parent.pos()) self.settings.setValue('currentView', self.parent.stackedWidget.currentIndex()) - self.settings.setValue('listViewBackground', self.parent.settings['listview_background']) + self.settings.setValue( + 'listViewBackground', self.parent.settings['listview_background']) table_headers = [] for i in range(3): diff --git a/widgets.py b/widgets.py index 19cb8dd..fdc913f 100644 --- a/widgets.py +++ b/widgets.py @@ -207,6 +207,10 @@ class Tab(QtWidgets.QWidget): self.exit_fs.setContext(QtCore.Qt.ApplicationShortcut) self.exit_fs.activated.connect(self.exit_fullscreen) + # TODO + # See why Ctrl + Q stop working on a non fullscreened contentView + # widget in case the following is in code + # self.exit_all = QtWidgets.QShortcut( # QtGui.QKeySequence('Ctrl+Q'), self.contentView) # self.exit_all.activated.connect(self.sneaky_exit) @@ -466,6 +470,10 @@ class PliantQGraphicsView(QtWidgets.QGraphicsView): self.setCursor(QtCore.Qt.ArrowCursor) self.parent.mouse_hide_timer.start(3000) + def closeEvent(self, *args): + # In case the program is closed when a contentView is fullscreened + self.main_window.closeEvent() + class PliantQTextBrowser(QtWidgets.QTextBrowser): def __init__(self, main_window, parent=None): @@ -519,6 +527,9 @@ class PliantQTextBrowser(QtWidgets.QTextBrowser): else: self.parent.metadata['position']['last_visible_text'] = visible_text + def closeEvent(self, *args): + self.main_window.closeEvent() + # def mouseMoveEvent(self, event): # TODO # This does not work as expected