def do_action(self, action, arg=None):
        """Passes on an action to BoKeepConfigGuiState and gui is then
        updated after to reflect the effects of that action by examining
        where that state machine is at after the action.
        """
        
        try:
            self.state.do_action(action, arg)
        except FrontendPluginImportError, err:
            backend_plugin_entry = self.backend_plugin_entry_combo.child
            backend_plugin_name = backend_plugin_entry.get_text()
            if backend_plugin_name in err.plugin_names:
                self.backend_plugin_entry_combo.child.set_text(
                        self.state.data[BOOK].get_backend_plugin_name() )
                err.plugin_names.remove(backend_plugin_name)

            frontend_plugins = {}
            for name, enabled in self.state.frontend_plugin_liststore:
                frontend_plugins[name] = (name, enabled)

            for err_plugin_name in err.plugin_names:
                del frontend_plugins[err_plugin_name]

            self.state.frontend_plugin_liststore.clear()
            for valid_plugin_name, enabled in frontend_plugins.values():
                self.state.frontend_plugin_liststore.append((valid_plugin_name, enabled))

            error_dialog = MessageDialog(self.bokeep_config_dialog, DIALOG_MODAL, 
                           MESSAGE_ERROR, BUTTONS_OK, str(err))
            error_dialog.run()
            error_dialog.destroy()
            # raises last exception that had been caught, in above
            # except clause, err
            raise
Beispiel #2
0
 def __init__(self, parent_window=None, message=""):
     MessageDialog.__init__(
         self, parent_window,
         gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
         gtk.MESSAGE_INFO, gtk.BUTTONS_OK,
         unicode(StringType(message)).encode('utf-8'))
     self.set_default_response(gtk.BUTTONS_OK)
     self.connect('response', lambda dialog, response: dialog.destroy())
     self.run()
Beispiel #3
0
 def __init__(self, parent_window = None, message = ""):
     MessageDialog.__init__(self,
             parent_window,
             gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
             gtk.MESSAGE_INFO,
             gtk.BUTTONS_OK,
             unicode(StringType(message)).encode('utf-8'))
     self.set_default_response(gtk.BUTTONS_OK)
     self.connect('response', lambda dialog, response: dialog.destroy())
     self.show()
    def __init__(self, name, icon):

        MessageDialog.__init__(
            self,
            None,
            DIALOG_MODAL,
            MESSAGE_QUESTION,
            BUTTONS_YES_NO,
            _("Package %s is in IgnorePkg. Install it anyway?" % name),
        )
        self.set_icon(pixbuf_new_from_file(icon))
 def on_error_details_button_clicked(self, *args):
     """Event handler for the user requesting to see the full backend
     plugin error display
     """
     md = MessageDialog(parent = self.mainwindow,
                        type = MESSAGE_ERROR,
                        buttons = BUTTONS_OK,
                        message_format =
                            self.backend_error_msg_label.get_text())
     md.run()
     md.destroy()
    def __init__(self, name, icon):

        MessageDialog.__init__(
            self,
            None,
            DIALOG_MODAL,
            MESSAGE_INFO,
            BUTTONS_YES_NO,
            _("Package %s is in HoldPkg. Are You sure you want to remove %s") % (name, name),
        )
        self.set_icon(pixbuf_new_from_file(icon))
    def __init__(self, icon):

        MessageDialog.__init__(
            self,
            None,
            DIALOG_MODAL,
            MESSAGE_WARNING,
            BUTTONS_CLOSE,
            _(
                "You must be root to fully use gtkpacman.\nSince you aren't root, gtkpacman will not allow any packages management operation (Install/Remove)"
            ),
        )
        self.set_icon(pixbuf_new_from_file(icon))
    def __Delete(self):
        if self.__objective:

            # Delete in cascade
            if (self.config.Get('deleteCascade') and
                    len(self.controller.Requeriments(self.__objective)) > 1):
                dialog = DeleteCascade(self.__objective)

                dialog.window.set_transient_for(self.window)
                response = dialog.window.run()
                dialog.window.destroy()

#				if response > 0:
#					self.__CreateTree()

# Delete only the objective
            else:
                dialog = MessageDialog(
                    self.window, 0, MESSAGE_QUESTION, BUTTONS_YES_NO,
                    _("Do you want to delete the objective ") +
                    self.__objective + "?")
                response = dialog.run()
                dialog.destroy()
                if response == RESPONSE_YES:
                    self.controller.DeleteObjective(self.__objective)


#					self.__CreateTree()

        return True
    def on_remove_button_clicked(self, *args):
        trustor = self.trust_module.get_trustor(self.current_name)

        if len(trustor.transactions) > 0:
            cantDeleteDia = MessageDialog(
                flags = DIALOG_MODAL,
                message_format = 'Cannot delete, trustor has associated transacactions.',
                buttons = BUTTONS_OK)
            cantDeleteDia.run()
            cantDeleteDia.hide()
        else:            
            self.trust_module.drop_trustor_by_name(self.current_name)
            transaction.get().commit()
            
            # Update the view.
            self.widgets['remove_button'].set_sensitive(False)
            self.widgets['details_button'].set_sensitive(False)
            self.refresh_trustor_list()
def establish_bokeep_config(mainwindow, paths, config_exception):
    """Call after failing to successfuly load a bokeep config file to have one
    established.

    Provides a dialog asking if its okay to create the specificied file
    and then does so.

    mainwindow -- if there's a Gtk.Window to parent the dialog too,
                  please provide it. Otherwise pass None here.
    paths     -- list of config files to try creating, this is deprecated
                 this function will soon be changed to only except one
                 config path to try and create
    config_exception -- You're calling this because you had trouble
    loading the configuration file and got an exception, pass it on
    so we can share the bad news in our dialog.

    returns a config file path that will work or None
    """
    
    assert(isinstance(config_exception, BoKeepConfigurationFileException))

    # This is here to support the old default
    # current working directory config vs home directory configs
    # but maybe there should only be one default place to look (home dir)?
    # (all the code that calls this already behaves this way, paths
    # should just be switched to config_path already...)
    for path in paths:
        md = MessageDialog(
            mainwindow, DIALOG_MODAL, MESSAGE_QUESTION, BUTTONS_YES_NO,
            str(config_exception) + "\n" + 
            """BoKeep requires a configuration file to operate
Would you like %s to be created from scratch?""" % path)
        result = md.run()
        md.destroy()
        if result == RESPONSE_YES:
            # important to make a distinction to the user between
            # creating something from nothing and overwrite
            if exists(path):
                md = MessageDialog(
                    mainwindow, DIALOG_MODAL, MESSAGE_QUESTION, BUTTONS_YES_NO,
                    "%s exists, overwrite?" % path)
                result = md.run()
                md.destroy()
                if result != RESPONSE_YES:
                    return None
            try:
                create_config_file(path)
            except BoKeepConfigurationFileException, e:
                pass
                #print path, "could not be created %s" % e.message
            else:
                return path
 def on_add_button_clicked(self, *args):
     # Ask the user for a new trustor's name.
     md = MessageDialog(parent = self.top_window,
                        type = MESSAGE_QUESTION,
                        buttons = BUTTONS_OK_CANCEL,
                        message_format = "What's the new trustor's name?")
     vbox = md.get_child()
     name_entry = Entry()
     vbox.pack_end(name_entry)
     vbox.show_all()
     r = md.run()
     new_trustor_name = name_entry.get_text()
     md.destroy() # destroys embedded widgets too
     
     # Save the new trustor.
     if r == RESPONSE_OK and new_trustor_name != '':
         self.current_name = new_trustor_name
         self.trust_module.add_trustor_by_name(new_trustor_name)
         transaction.get().commit()
         self.refresh_trustor_list()
    def __Cancel(self):
        closeDialog = self.oldObjective == self.txtObjective.get_text()

        if not closeDialog:
            dialog = MessageDialog(self.window, 0, MESSAGE_QUESTION,
                                   BUTTONS_YES_NO,
                                   _("The objective have been modified"))
            dialog.format_secondary_text(
                _("The objective have been modified and the changes will be lost. Are you sure do you want to continue?"
                  ))
            response = dialog.run()
            dialog.destroy()
            if response == RESPONSE_YES:
                return True

        return closeDialog
 def error_dialog(self, msg):
     dia = MessageDialog(buttons=BUTTONS_OK,
                         message_format=msg)
     dia.set_modal(True)
     dia.run()
     dia.destroy()
def gtk_ok_dialog(msg, parent=None, dia_type=MESSAGE_ERROR):
    error_dialog = MessageDialog(parent, DIALOG_MODAL, 
                                 dia_type, BUTTONS_OK, msg)
    error_dialog.run()
    error_dialog.destroy()
    def __init__(self, parent, msg, icon):

        MessageDialog.__init__(self, parent,
                               DIALOG_MODAL | DIALOG_DESTROY_WITH_PARENT,
                               MESSAGE_ERROR, BUTTONS_CLOSE, msg)
        self.set_icon(pixbuf_new_from_file(icon))
    def __init__(self, name, icon):

        MessageDialog.__init__(self, None,
                               DIALOG_MODAL, MESSAGE_INFO, BUTTONS_OK_CANCEL,
                               _("Package %s is in HoldPkg. You should install it before any other package. gtkPacman will now install %s.") %(name,name))
        self.set_icon (pixbuf_new_from_file(icon))
def gtk_yes_no_dialog(msg, parent=None, dia_type=MESSAGE_ERROR):
    yes_no_dialog = MessageDialog(parent, DIALOG_MODAL, 
                                  dia_type, BUTTONS_YES_NO, msg)
    result = (RESPONSE_YES == yes_no_dialog.run())
    yes_no_dialog.destroy()
    return result
 def __init__(self, name, icon):
     name = str( name)
     MessageDialog.__init__(self, None,
                            DIALOG_MODAL, MESSAGE_QUESTION, BUTTONS_YES_NO,
                            _("Current package(s) are listed as IgnorePkg.\n%s\n Are you sure you want to continue?" %name[1:-1]))
     self.set_icon (pixbuf_new_from_file(icon))
    def __init__(self, name, icon):

        MessageDialog.__init__(self, None,
                               DIALOG_MODAL, MESSAGE_INFO, BUTTONS_YES_NO,
                               _("Current package(s) are listed as HoldPkg.\n%s\nAre You sure you want to continue?") %name)
        self.set_icon (pixbuf_new_from_file(icon))