Example #1
0
 def _confirmation(self, message='', title='Save Changes?'):
     dialog = ConfirmationDialog(parent=self.window.control,
                                 message=message,
                                 cancel=True,
                                 default=CANCEL,
                                 title=title)
     return dialog.open()
Example #2
0
    def confirm_cancel(self,
                       message,
                       title=None,
                       cancel=True,
                       default=CANCEL,
                       no_label="",
                       yes_label=""):
        """ Convenience method to show a confirmation dialog.

        Returns None if Cancel was chosen in addition to the usual True/False.
        """

        from pyface.confirmation_dialog import ConfirmationDialog

        if title is None:
            title = "Confirmation"

        dialog = ConfirmationDialog(parent=self.window.control,
                                    message=message,
                                    cancel=cancel,
                                    default=default,
                                    title=title,
                                    no_label=no_label,
                                    yes_label=yes_label)

        result = dialog.open()
        if result == YES:
            result = True
        elif result == NO:
            result = False
        else:
            result = None
        return result
Example #3
0
 def close( self, info, is_ok ):
     if self.model.dirty:
         dlg=ConfirmationDialog( message='Save changes to Hops file', cancel=True,
                                 default=CANCEL, title='Save Changes?')
         ret=dlg.open()
         if ret==CANCEL:
             return False
         elif ret==YES:
             self.model.save()
     return True
Example #4
0
    def confirmation_dialog(self, msg, title=''):
#        return False
        dlg = ConfirmationDialog(
                                 message=msg,
                                 title=title,
                                 style='modal')
        dlg.control = dlg._create_control(None)
        dlg._show_modal()
#        print result
        return False
Example #5
0
    def confirm(self, message, title=None, cancel=False, default=NO, no_label="", yes_label=""):
        """ Convenience method to show a confirmation dialog. """

        from pyface.confirmation_dialog import ConfirmationDialog

        if title is None:
            title = "Confirmation"

        dialog = ConfirmationDialog(parent=self.window.control, message=message, cancel=cancel, default=default, title=title, no_label=no_label, yes_label=yes_label)

        return dialog.open()
Example #6
0
 def close(self, info, is_ok):
     if self.model.dirty:
         dlg = ConfirmationDialog(message='Save changes to Hops file',
                                  cancel=True,
                                  default=CANCEL,
                                  title='Save Changes?')
         ret = dlg.open()
         if ret == CANCEL:
             return False
         elif ret == YES:
             self.model.save()
     return True
Example #7
0
    def confirm(self,
                message,
                title=None,
                cancel=False,
                default=NO,
                no_label="",
                yes_label=""):
        """ Convenience method to show a confirmation dialog. """

        from pyface.confirmation_dialog import ConfirmationDialog

        if title is None:
            title = "Confirmation"

        dialog = ConfirmationDialog(parent=self.window.control,
                                    message=message,
                                    cancel=cancel,
                                    default=default,
                                    title=title,
                                    no_label=no_label,
                                    yes_label=yes_label)

        return dialog.open() == YES
Example #8
0
 def _confirmation(self, message=''):
     dialog = ConfirmationDialog(parent=self.window.control,
                                 message=message, cancel=True,
                                 default=CANCEL, title='Save Changes?')
     return dialog.open()