示例#1
0
    def checkDirty(self):
        """
        Public method to check the dirty status and open a message window.
        
        @return flag indicating whether this operation was successful (boolean)
        """
        if self.isDirty():
            res = E5MessageBox.okToClearData(
                self.parent(), self.tr("Close Multiproject"),
                self.tr("The current multiproject has unsaved changes."),
                self.saveMultiProject)
            if res:
                self.setDirty(False)
            return res

        return True
示例#2
0
 def checkDirty(self):
     """
     Public method to check the dirty status and open a message window.
     
     @return flag indicating whether this operation was successful (boolean)
     """
     if self.isDirty():
         res = E5MessageBox.okToClearData(
             self.parent(),
             self.tr("Close Multiproject"),
             self.tr("The current multiproject has unsaved changes."),
             self.saveMultiProject)
         if res:
             self.setDirty(False)
         return res
     
     return True
示例#3
0
 def __okToClose(self):
     """
     Private method to check, if it is safe to close the dialog.
     
     @return flag indicating safe to close
     @rtype bool
     """
     QApplication.restoreOverrideCursor()
     if self.__isModified():
         res = E5MessageBox.okToClearData(
             self,
             self.tr("Safe Browsing Management"),
             self.tr("""The dialog contains unsaved changes."""),
             self.__save)
         if not res:
             return False
     return True
 def on_bTest_clicked(self):
     """
     Private method to test the selected options.
     """
     if self.rAbout.isChecked():
         E5MessageBox.about(
             None,
             self.eCaption.text(),
             self.eMessage.toPlainText()
         )
     elif self.rAboutQt.isChecked():
         E5MessageBox.aboutQt(
             None, self.eCaption.text()
         )
     elif self.rInformation.isChecked() or \
         self.rQuestion.isChecked() or \
         self.rWarning.isChecked() or \
             self.rCritical.isChecked():
         buttons = E5MessageBox.NoButton
         if self.abortCheck.isChecked():
             buttons |= E5MessageBox.Abort
         if self.applyCheck.isChecked():
             buttons |= E5MessageBox.Apply
         if self.cancelCheck.isChecked():
             buttons |= E5MessageBox.Cancel
         if self.closeCheck.isChecked():
             buttons |= E5MessageBox.Close
         if self.discardCheck.isChecked():
             buttons |= E5MessageBox.Discard
         if self.helpCheck.isChecked():
             buttons |= E5MessageBox.Help
         if self.ignoreCheck.isChecked():
             buttons |= E5MessageBox.Ignore
         if self.noCheck.isChecked():
             buttons |= E5MessageBox.No
         if self.notoallCheck.isChecked():
             buttons |= E5MessageBox.NoToAll
         if self.okCheck.isChecked():
             buttons |= E5MessageBox.Ok
         if self.openCheck.isChecked():
             buttons |= E5MessageBox.Open
         if self.resetCheck.isChecked():
             buttons |= E5MessageBox.Reset
         if self.restoreCheck.isChecked():
             buttons |= E5MessageBox.RestoreDefaults
         if self.retryCheck.isChecked():
             buttons |= E5MessageBox.Retry
         if self.saveCheck.isChecked():
             buttons |= E5MessageBox.Save
         if self.saveallCheck.isChecked():
             buttons |= E5MessageBox.SaveAll
         if self.yesCheck.isChecked():
             buttons |= E5MessageBox.Yes
         if self.yestoallCheck.isChecked():
             buttons |= E5MessageBox.YesToAll
         if buttons == E5MessageBox.NoButton:
             buttons = E5MessageBox.Ok
         
         defaultButton = self.buttonsCodeListBinary[
             self.defaultCombo.currentIndex()]
         
         if self.rInformation.isChecked():
             E5MessageBox.information(
                 self,
                 self.eCaption.text(),
                 self.eMessage.toPlainText(),
                 E5MessageBox.StandardButtons(buttons),
                 defaultButton
             )
         elif self.rQuestion.isChecked():
             E5MessageBox.question(
                 self,
                 self.eCaption.text(),
                 self.eMessage.toPlainText(),
                 E5MessageBox.StandardButtons(buttons),
                 defaultButton
             )
         elif self.rWarning.isChecked():
             E5MessageBox.warning(
                 self,
                 self.eCaption.text(),
                 self.eMessage.toPlainText(),
                 E5MessageBox.StandardButtons(buttons),
                 defaultButton
             )
         elif self.rCritical.isChecked():
             E5MessageBox.critical(
                 self,
                 self.eCaption.text(),
                 self.eMessage.toPlainText(),
                 E5MessageBox.StandardButtons(buttons),
                 defaultButton
             )
     elif self.rYesNo.isChecked() or \
             self.rRetryAbort.isChecked():
         if self.iconInformation.isChecked():
             icon = E5MessageBox.Information
         elif self.iconQuestion.isChecked():
             icon = E5MessageBox.Question
         elif self.iconWarning.isChecked():
             icon = E5MessageBox.Warning
         elif self.iconCritical.isChecked():
             icon = E5MessageBox.Critical
         
         if self.rYesNo.isChecked():
             E5MessageBox.yesNo(
                 self,
                 self.eCaption.text(),
                 self.eMessage.toPlainText(),
                 icon=icon,
                 yesDefault=self.yesDefaultCheck.isChecked()
             )
         elif self.rRetryAbort.isChecked():
             E5MessageBox.retryAbort(
                 self,
                 self.eCaption.text(),
                 self.eMessage.toPlainText(),
                 icon=icon
             )
     elif self.rOkToClearData.isChecked():
         E5MessageBox.okToClearData(
             self,
             self.eCaption.text(),
             self.eMessage.toPlainText(),
             lambda: True
         )
    def on_bTest_clicked(self):
        """
        Private method to test the selected options.
        """
        if self.rAbout.isChecked():
            E5MessageBox.about(None, self.eCaption.text(),
                               self.eMessage.toPlainText())
        elif self.rAboutQt.isChecked():
            E5MessageBox.aboutQt(None, self.eCaption.text())
        elif self.rInformation.isChecked() or \
            self.rQuestion.isChecked() or \
            self.rWarning.isChecked() or \
                self.rCritical.isChecked():
            buttons = E5MessageBox.NoButton
            if self.abortCheck.isChecked():
                buttons |= E5MessageBox.Abort
            if self.applyCheck.isChecked():
                buttons |= E5MessageBox.Apply
            if self.cancelCheck.isChecked():
                buttons |= E5MessageBox.Cancel
            if self.closeCheck.isChecked():
                buttons |= E5MessageBox.Close
            if self.discardCheck.isChecked():
                buttons |= E5MessageBox.Discard
            if self.helpCheck.isChecked():
                buttons |= E5MessageBox.Help
            if self.ignoreCheck.isChecked():
                buttons |= E5MessageBox.Ignore
            if self.noCheck.isChecked():
                buttons |= E5MessageBox.No
            if self.notoallCheck.isChecked():
                buttons |= E5MessageBox.NoToAll
            if self.okCheck.isChecked():
                buttons |= E5MessageBox.Ok
            if self.openCheck.isChecked():
                buttons |= E5MessageBox.Open
            if self.resetCheck.isChecked():
                buttons |= E5MessageBox.Reset
            if self.restoreCheck.isChecked():
                buttons |= E5MessageBox.RestoreDefaults
            if self.retryCheck.isChecked():
                buttons |= E5MessageBox.Retry
            if self.saveCheck.isChecked():
                buttons |= E5MessageBox.Save
            if self.saveallCheck.isChecked():
                buttons |= E5MessageBox.SaveAll
            if self.yesCheck.isChecked():
                buttons |= E5MessageBox.Yes
            if self.yestoallCheck.isChecked():
                buttons |= E5MessageBox.YesToAll
            if buttons == E5MessageBox.NoButton:
                buttons = E5MessageBox.Ok

            defaultButton = self.buttonsCodeListBinary[
                self.defaultCombo.currentIndex()]

            if self.rInformation.isChecked():
                E5MessageBox.information(self, self.eCaption.text(),
                                         self.eMessage.toPlainText(),
                                         E5MessageBox.StandardButtons(buttons),
                                         defaultButton)
            elif self.rQuestion.isChecked():
                E5MessageBox.question(self, self.eCaption.text(),
                                      self.eMessage.toPlainText(),
                                      E5MessageBox.StandardButtons(buttons),
                                      defaultButton)
            elif self.rWarning.isChecked():
                E5MessageBox.warning(self, self.eCaption.text(),
                                     self.eMessage.toPlainText(),
                                     E5MessageBox.StandardButtons(buttons),
                                     defaultButton)
            elif self.rCritical.isChecked():
                E5MessageBox.critical(self, self.eCaption.text(),
                                      self.eMessage.toPlainText(),
                                      E5MessageBox.StandardButtons(buttons),
                                      defaultButton)
        elif self.rYesNo.isChecked() or \
                self.rRetryAbort.isChecked():
            if self.iconInformation.isChecked():
                icon = E5MessageBox.Information
            elif self.iconQuestion.isChecked():
                icon = E5MessageBox.Question
            elif self.iconWarning.isChecked():
                icon = E5MessageBox.Warning
            elif self.iconCritical.isChecked():
                icon = E5MessageBox.Critical

            if self.rYesNo.isChecked():
                E5MessageBox.yesNo(self,
                                   self.eCaption.text(),
                                   self.eMessage.toPlainText(),
                                   icon=icon,
                                   yesDefault=self.yesDefaultCheck.isChecked())
            elif self.rRetryAbort.isChecked():
                E5MessageBox.retryAbort(self,
                                        self.eCaption.text(),
                                        self.eMessage.toPlainText(),
                                        icon=icon)
        elif self.rOkToClearData.isChecked():
            E5MessageBox.okToClearData(self, self.eCaption.text(),
                                       self.eMessage.toPlainText(),
                                       lambda: True)