Example #1
0
 def set_default_view(self):
     main_entry = self.widgets.main_comboentry.child
     if main_entry is not None:
         main_entry.set_text('')
     SplashCommandHandler.view = DefaultView()
     self.set_view(SplashCommandHandler.view)
     pluginmgr.register_command(SplashCommandHandler)
Example #2
0
 def set_default_view(self):
     main_entry = self.widgets.main_comboentry.child
     if main_entry is not None:
         main_entry.set_text('')
     SplashCommandHandler.view = DefaultView()
     self.set_view(SplashCommandHandler.view)
     pluginmgr.register_command(SplashCommandHandler)
Example #3
0
            self.widgets.prefs_prefs_ls.append(
                (key, value, prefs[key].__class__.__name__))

        self.widgets.prefs_plugins_ls.clear()
        from bauble.pluginmgr import PluginRegistry
        session = db.Session()
        plugins = session.query(PluginRegistry.name, PluginRegistry.version)
        for item in plugins:
            self.widgets.prefs_plugins_ls.append(item)
        session.close()
        pass


class PrefsCommandHandler(pluginmgr.CommandHandler):

    command = ('prefs', 'config')
    view = None

    def __call__(self, cmd, arg):
        pass

    def get_view(self):
        if self.view is None:
            self.__class__.view = PrefsView()
        return self.view


pluginmgr.register_command(PrefsCommandHandler)

prefs = _prefs()
Example #4
0
            self.widgets.prefs_prefs_ls.append(
                (key, value, prefs[key].__class__.__name__))

        self.widgets.prefs_plugins_ls.clear()
        from bauble.pluginmgr import PluginRegistry
        session = db.Session()
        plugins = session.query(PluginRegistry.name, PluginRegistry.version)
        for item in plugins:
            self.widgets.prefs_plugins_ls.append(item)
        session.close()
        pass


class PrefsCommandHandler(pluginmgr.CommandHandler):

    command = ('prefs', 'config')
    view = None

    def __call__(self, cmd, arg):
        pass

    def get_view(self):
        if self.view is None:
            self.__class__.view = PrefsView()
        return self.view


pluginmgr.register_command(PrefsCommandHandler)

prefs = _prefs()
Example #5
0
    def __init__(self):
        super(HistoryCommandHandler, self).__init__()
        self.view = None

    command = 'history'

    def get_view(self):
        if not self.view:
            self.view = HistoryView()
        return self.view

    def __call__(self, cmd, arg):
        self.view.populate_history(arg)


pluginmgr.register_command(HistoryCommandHandler)


def select_in_search_results(obj):
    """
    :param obj: the object the select
    @returns: a gtk.TreeIter to the selected row

    Search the tree model for obj if it exists then select it if not
    then add it and select it.

    The the obj is not in the model then we add it.
    """
    check(obj is not None, 'select_in_search_results: arg is None')
    view = bauble.gui.get_view()
    if not isinstance(view, SearchView):
Example #6
0
    def __init__(self):
        super(HistoryCommandHandler, self).__init__()
        self.view = None

    command = 'history'

    def get_view(self):
        if not self.view:
            self.view = HistoryView()
        return self.view

    def __call__(self, cmd, arg):
        self.view.populate_history(arg)


pluginmgr.register_command(HistoryCommandHandler)


def select_in_search_results(obj):
    """
    :param obj: the object the select
    @returns: a gtk.TreeIter to the selected row

    Search the tree model for obj if it exists then select it if not
    then add it and select it.

    The the obj is not in the model then we add it.
    """
    check(obj is not None, 'select_in_search_results: arg is None')
    view = bauble.gui.get_view()
    if not isinstance(view, SearchView):
Example #7
0
                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 '
                        'the current connection?\n\n<i>Warning: If there is '
                        'already a database at this connection any existing '
                        'data will be destroyed!</i>')
                if utils.yes_no_dialog(msg, yes_delay=2):
        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):
                msg = _('Would you like to create a new Bauble database at ' \
                        'the current connection?\n\n<i>Warning: If there is '\
                        'already a database at this connection any existing '\
                        'data will be destroyed!</i>')