mirror of
https://github.com/fergalmoran/picard.git
synced 2026-01-11 11:04:18 +00:00
PICARD-1571: Allow opening only a single options dialog
Fixes issues on macOS where it was possible to have more than one options dialog open.
This commit is contained in:
@@ -177,6 +177,7 @@ class MainWindow(QtWidgets.QMainWindow, PreserveGeometry):
|
||||
|
||||
self.logDialog = LogView(self)
|
||||
self.historyDialog = HistoryView(self)
|
||||
self.optionsDialog = None
|
||||
|
||||
bottomLayout = QtWidgets.QHBoxLayout()
|
||||
bottomLayout.setContentsMargins(0, 0, 0, 0)
|
||||
@@ -928,8 +929,15 @@ class MainWindow(QtWidgets.QMainWindow, PreserveGeometry):
|
||||
self.show_options("about")
|
||||
|
||||
def show_options(self, page=None):
|
||||
dialog = OptionsDialog(page, self)
|
||||
dialog.exec_()
|
||||
if not self.optionsDialog:
|
||||
self.optionsDialog = OptionsDialog(page, self)
|
||||
self.optionsDialog.finished.connect(self.on_options_closed)
|
||||
self.optionsDialog.show()
|
||||
self.optionsDialog.raise_()
|
||||
self.optionsDialog.activateWindow()
|
||||
|
||||
def on_options_closed(self):
|
||||
self.optionsDialog = None
|
||||
|
||||
def show_help(self):
|
||||
webbrowser2.goto('documentation')
|
||||
|
||||
@@ -86,6 +86,7 @@ class OptionsDialog(PicardDialog):
|
||||
|
||||
def __init__(self, default_page=None, parent=None):
|
||||
super().__init__(parent)
|
||||
self.setWindowModality(QtCore.Qt.ApplicationModal)
|
||||
|
||||
from picard.ui.ui_options import Ui_Dialog
|
||||
self.ui = Ui_Dialog()
|
||||
|
||||
Reference in New Issue
Block a user