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:
Philipp Wolfer
2019-08-07 22:47:04 +02:00
parent 4737f72b74
commit f8eb75596e
2 changed files with 11 additions and 2 deletions

View File

@@ -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')

View File

@@ -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()