コード例 #1
0
    def testConfirm(self):
        d = hig.ConfirmationAlert(
            primary="Do you really want to hurt me?",
            secondary="Do you really want to make me cry?")

        self.runAndDismiss(d)

        d = hig.ConfirmationAlert(
            primary="Convert sub-meson structure?",
            secondary=
            "The process is agonizingly painful and could result in permanent damage to the space-time continuum",
            proceed_button="Convert",
            alternate_button="Go Fishing")

        self.runAndDismiss(d)
コード例 #2
0
    def check_save_fractal(self):
        "Prompt user to save if necessary. Return whether to quit"        
        while not self.f.is_saved():
            d = hig.SaveConfirmationAlert(
                document_name=self.display_filename(),
                parent=self.window)

            response = d.run()                
            d.destroy()
            if response == gtk.RESPONSE_ACCEPT:
                self.save(None,None)
            elif response == gtk.RESPONSE_CANCEL:
                return False
            elif response == hig.SaveConfirmationAlert.NOSAVE:
                break

        while not renderqueue.instance.empty():
            d = hig.ConfirmationAlert(
                primary=_("Render queue still processing."),
                secondary=_("If you proceed, queued images will not be saved"),
                proceed_button=_("Close anyway"))
                
            response = d.run()                
            d.destroy()
            if response == gtk.RESPONSE_ACCEPT:
                break
            elif response == gtk.RESPONSE_CANCEL:
                return False
            else:
                break
        return True
コード例 #3
0
    def confirm(self,name):
        'if this file exists, check with user before overwriting it'
        if os.path.exists(name):
            msg = _("File %s already exists. Overwrite?") % name
            d = hig.ConfirmationAlert(
                primary=msg,
                parent=self.window,
                proceed_button=_("Overwrite"))

            response = d.run()                
            d.destroy()
            return response == gtk.RESPONSE_ACCEPT
        else:
            return True