Fixing modality and adding a cancel button to the about dialog
authorEd Page <eopage@byu.net>
Wed, 5 Jan 2011 01:22:28 +0000 (19:22 -0600)
committerEd Page <eopage@byu.net>
Wed, 5 Jan 2011 01:22:28 +0000 (19:22 -0600)
src/dialcentral_qt.py
src/dialogs.py

index c45b10d..b7078f2 100755 (executable)
@@ -644,7 +644,7 @@ class MainWindow(object):
                        self._session.get_callback_numbers(), self._session.get_callback_number()
                )
                self._accountDialog.accountNumber = self._session.get_account_number()
-               response = self._accountDialog.run()
+               response = self._accountDialog.run(self.window)
                if response == QtGui.QDialog.Accepted:
                        if self._accountDialog.doClear:
                                self._session.logout_and_clear()
@@ -747,7 +747,7 @@ class MainWindow(object):
                        if self._aboutDialog is None:
                                import dialogs
                                self._aboutDialog = dialogs.AboutDialog(self._app)
-                       response = self._aboutDialog.run()
+                       response = self._aboutDialog.run(self.window)
 
        @QtCore.pyqtSlot()
        @QtCore.pyqtSlot(bool)
index 35c0312..ed5f0ac 100644 (file)
@@ -100,15 +100,19 @@ class AboutDialog(object):
                self._link.setAlignment(QtCore.Qt.AlignCenter)
                self._link.setOpenExternalLinks(True)
 
+               self._buttonLayout = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Cancel)
+
                self._layout = QtGui.QVBoxLayout()
                self._layout.addWidget(self._title)
                self._layout.addWidget(self._copyright)
                self._layout.addWidget(self._link)
+               self._layout.addWidget(self._buttonLayout)
 
                self._dialog = QtGui.QDialog()
                self._dialog.setWindowTitle("About")
                self._dialog.setLayout(self._layout)
                qui_utils.set_autorient(self._dialog, True)
+               self._buttonLayout.rejected.connect(self._dialog.reject)
 
                self._closeWindowAction = QtGui.QAction(None)
                self._closeWindowAction.setText("Close")
@@ -120,7 +124,7 @@ class AboutDialog(object):
                self._dialog.addAction(app.fullscreenAction)
 
        def run(self, parent=None):
-               self._dialog.setParent(parent)
+               self._dialog.setParent(parent, QtCore.Qt.Dialog)
 
                response = self._dialog.exec_()
                return response
@@ -139,7 +143,6 @@ class AccountDialog(object):
 
        # @bug Can't enter custom callback numbers
 
-
        _RECURRENCE_CHOICES = [
                (1, "1 minute"),
                (2, "2 minutes"),
@@ -302,7 +305,7 @@ class AccountDialog(object):
 
        def run(self, parent=None):
                self._doClear = False
-               self._dialog.setParent(parent)
+               self._dialog.setParent(parent, QtCore.Qt.Dialog)
 
                response = self._dialog.exec_()
                return response