示例#1
0
def save_state():
    """
    Save the gui state and preferences.
    """
    from bauble.prefs import prefs
    # in case we quit before the gui is created
    if gui is not None:
        gui.save_state()
    prefs.save()
def save_state():
    """
    Save the gui state and preferences.
    """
    from bauble.prefs import prefs
    # in case we quit before the gui is created
    if gui is not None:
        gui.save_state()
    prefs.save()
 def save_current_to_prefs(self):
     """
     save connection parameters from the widgets in the prefs
     """
     if self.current_name is None:
         return
     if bauble.conn_list_pref not in prefs:
         prefs[bauble.conn_list_pref] = {}
     settings = copy.copy(self.params_box.get_prefs())
     settings["type"] = self.type_combo.get_active_text()
     conn_list = prefs[bauble.conn_list_pref]
     if conn_list is None:
         conn_list = {}
     conn_list[self.current_name] = settings
     prefs[bauble.conn_list_pref] = conn_list
     prefs.save()
示例#4
0
 def __init__(self):
     super(SynonymSearch, self).__init__()
     if self.return_synonyms_pref not in prefs:
         prefs[self.return_synonyms_pref] = True
         prefs.save()
示例#5
0
 def __init__(self):
     super(SynonymSearch, self).__init__()
     if self.return_synonyms_pref not in prefs:
         prefs[self.return_synonyms_pref] = True
         prefs.save()
示例#6
0
                # break
            except Exception, e:
                msg = _("Could not open connection.\n\n%s") % \
                    utils.xml_safe(repr(e))
                utils.message_details_dialog(msg, traceback.format_exc(),
                                             gtk.MESSAGE_ERROR)
                uri = None
    else:
        db.open(uri, True, True)

    # load the plugins
    pluginmgr.load()

    # save any changes made in the conn manager before anything else has
    # chance to crash
    prefs.save()

    # set the default command handler
    from bauble.view import DefaultCommandHandler
    pluginmgr.register_command(DefaultCommandHandler)

    # now that we have a connection create the gui, start before the plugins
    # are initialized in case they have to do anything like add a menu
    import bauble.ui as ui
    gui = ui.GUI()

    def _post_loop():
        gtk.gdk.threads_enter()
        try:
            if isinstance(open_exc, err.DatabaseError):
                msg = _('Would you like to create a new Bauble database at '
                utils.message_details_dialog(msg, traceback.format_exc(),
                                             gtk.MESSAGE_ERROR)
                uri = None
    else:
        db.open(uri, True, True)


    # make session available as a convenience to other modules
    #Session = db.Session

    # load the plugins
    pluginmgr.load()

    # save any changes made in the conn manager before anything else has
    # chance to crash
    prefs.save()

    # set the default command handler
    import bauble.view as view
    pluginmgr.register_command(view.DefaultCommandHandler)

    # now that we have a connection create the gui, start before the plugins
    # are initialized in case they have to do anything like add a menu
    #import bauble._gui as _gui
    import bauble.ui as ui
    gui = ui.GUI()

    def _post_loop():
        gtk.gdk.threads_enter()
        try:
            if isinstance(open_exc, err.DatabaseError):