1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2024-12-21 10:59:03 +00:00

Update preferences on show(), not in constructor

* If the dialog window shouldn't have a titlebar during construction, update accordingly only when showing to fix Windows displaying a window without titlebar on first show
* Only save geometry if the window is floating. Otherwise geometry while docked is saved whih gives weird results on subsequent starts, since it may be floating by default anyway (at least on Linux where titlebar being disabled is allowed while floating)
* Vertical title bar doesn't seem to work on Windows, add note in preferences dialog
This commit is contained in:
glubsy 2020-07-15 22:47:32 +02:00
parent 75621cc816
commit 9168d72f38
2 changed files with 4 additions and 4 deletions

View File

@ -21,7 +21,6 @@ class DetailsDialog(QDockWidget):
self.model = app.model.details_panel
self.setAllowedAreas(Qt.AllDockWidgetAreas)
self._setupUi()
self.update_options()
# To avoid saving uninitialized geometry on appWillSavePrefs, we track whether our dialog
# has been shown. If it has, we know that our geometry should be saved.
self._shown_once = False
@ -39,6 +38,7 @@ class DetailsDialog(QDockWidget):
def show(self):
self._shown_once = True
super().show()
self.update_options()
def update_options(self):
# This disables the title bar (if we had not set one before already)
@ -62,7 +62,7 @@ class DetailsDialog(QDockWidget):
# --- Events
def appWillSavePrefs(self):
if self._shown_once:
if self._shown_once and self.isFloating():
self.app.prefs.saveGeometry("DetailsWindowRect", self)
# --- model --> view

View File

@ -118,14 +118,14 @@ class PreferencesDialogBase(QDialog):
horizontalWrap([self.fontSizeLabel, self.fontSizeSpinBox, None])
)
self._setupAddCheckbox("reference_bold_font",
tr("Bold font for reference."))
tr("Bold font for reference"))
self.widgetsVLayout.addWidget(self.reference_bold_font)
self._setupAddCheckbox("details_dialog_titlebar_enabled",
tr("Details dialog displays a title bar and is dockable"))
self.widgetsVLayout.addWidget(self.details_dialog_titlebar_enabled)
self._setupAddCheckbox("details_dialog_vertical_titlebar",
tr("Details dialog displays a vertical title bar."))
tr("Details dialog displays a vertical title bar (Linux only)"))
self.widgetsVLayout.addWidget(self.details_dialog_vertical_titlebar)
self.details_dialog_vertical_titlebar.setEnabled(
self.details_dialog_titlebar_enabled.isChecked())