Example #1
0
    def __init__(self, model, view):
        '''
        model: should be an instance of class Accession
        view: should be an instance of AccessionEditorView
        '''
        GenericEditorPresenter.__init__(self, model, view)
        self.session = object_session(model)
        self._dirty = False

        # initialize widgets
        self.refresh_view()  # put model values in view

        # connect signals
        self.assign_simple_handler('loc_name_entry', 'name',
                                   UnicodeOrNoneValidator())
        self.assign_simple_handler('loc_code_entry', 'code',
                                   UnicodeOrNoneValidator())
        self.assign_simple_handler('loc_desc_textview', 'description',
                                   UnicodeOrNoneValidator())
        self.refresh_sensitivity()
        if self.model not in self.session.new:
            self.view.widgets.loc_ok_and_add_button.set_sensitive(True)

        # the merger danger zone
        self.merger_candidate = None

        def on_location_select(location):
            logger.debug('merger candidate: %s' % location)
            self.merger_candidate = location

        from bauble.plugins.garden import init_location_comboentry
        init_location_comboentry(self, self.view.widgets.loc_merge_comboentry,
                                 on_location_select)
        self.view.connect('loc_merge_button', 'clicked',
                          self.on_loc_merge_button_clicked)
Example #2
0
    def __init__(self, model, view):
        '''
        model: should be an instance of class Accession
        view: should be an instance of AccessionEditorView
        '''
        GenericEditorPresenter.__init__(self, model, view)
        self.session = object_session(model)
        self._dirty = False

        # initialize widgets
        self.refresh_view()  # put model values in view

        # connect signals
        self.assign_simple_handler('loc_name_entry', 'name',
                                   UnicodeOrNoneValidator())
        self.assign_simple_handler('loc_code_entry', 'code',
                                   UnicodeOrNoneValidator())
        self.assign_simple_handler('loc_desc_textview', 'description',
                                   UnicodeOrNoneValidator())
        self.refresh_sensitivity()
        if self.model not in self.session.new:
            self.view.widgets.loc_ok_and_add_button.set_sensitive(True)

        # the merger danger zone
        self.merger_candidate = None

        def on_location_select(location):
            logger.debug('merger candidate: %s' % location)
            self.merger_candidate = location

        from bauble.plugins.garden import init_location_comboentry
        init_location_comboentry(self, self.view.widgets.loc_merge_comboentry,
                                 on_location_select)
        self.view.connect('loc_merge_button', 'clicked',
                          self.on_loc_merge_button_clicked)
Example #3
0
    def __init__(self, view=None):
        self.filename = self.database = self.host = self.user = self.pictureroot = self.connection_name = ""
        self.use_defaults = True
        self.passwd = False
        ## following two look like overkill, since they will be initialized
        ## in the parent class constructor. but we need these attributes in
        ## place before we can invoke get_params
        self.model = self
        self.view = view

        ## initialize comboboxes, so we can fill them in
        view.combobox_init("name_combo")
        view.combobox_init("type_combo", dbtypes, type_combo_cell_data_func)
        self.connection_names = []
        self.connections = prefs.prefs[bauble.conn_list_pref] or {}
        for ith_connection_name in self.connections:
            view.combobox_append_text("name_combo", ith_connection_name)
            self.connection_names.append(ith_connection_name)
        if self.connection_names:
            self.connection_name = prefs.prefs[bauble.conn_default_pref]
            if self.connection_name not in self.connections:
                self.connection_name = self.connection_names[0]
            self.dbtype = None
            self.set_params()
        else:
            self.dbtype = ""
            self.connection_name = None
        GenericEditorPresenter.__init__(self, model=self, view=view, refresh_view=True)
        logo_path = os.path.join(paths.lib_dir(), "images", "bauble_logo.png")
        view.image_set_from_file("logo_image", logo_path)
        view.set_title("%s %s" % ("Bauble", bauble.version))
        try:
            view.set_icon(gtk.gdk.pixbuf_new_from_file(bauble.default_icon))
        except:
            pass
Example #4
0
 def refresh_view(self):
     GenericEditorPresenter.refresh_view(self)
     conn_dict = self.connections
     if conn_dict is None or len(conn_dict.keys()) == 0:
         self.view.widget_set_visible('noconnectionlabel', True)
         self.view.widget_set_visible('expander', False)
     else:
         self.view.widget_set_visible('expander', True)
         self.view.widget_set_visible('noconnectionlabel', False)
         if self.dbtype == 'SQLite':
             self.view.widget_set_visible('sqlite_parambox', True)
             self.view.widget_set_visible('dbms_parambox', False)
             self.refresh_entries_sensitive()
         else:
             self.view.widget_set_visible('dbms_parambox', True)
             self.view.widget_set_visible('sqlite_parambox', False)
 def refresh_view(self):
     GenericEditorPresenter.refresh_view(self)
     conn_dict = self.connections
     if conn_dict is None or len(conn_dict.keys()) == 0:
         self.view.widget_set_visible('noconnectionlabel', True)
         self.view.widget_set_visible('expander', False)
     else:
         self.view.widget_set_visible('expander', True)
         self.view.widget_set_visible('noconnectionlabel', False)
         if self.dbtype == 'SQLite':
             self.view.widget_set_visible('sqlite_parambox', True)
             self.view.widget_set_visible('dbms_parambox', False)
             self.refresh_entries_sensitive()
         else:
             self.view.widget_set_visible('dbms_parambox', True)
             self.view.widget_set_visible('sqlite_parambox', False)
Example #6
0
    def __init__(self, view=None):
        self.filename = self.database = self.host = self.user = \
            self.pictureroot = self.connection_name = \
            self.prev_connection_name = ''
        self.use_defaults = True
        self.passwd = False
        ## following two look like overkill, since they will be initialized
        ## in the parent class constructor. but we need these attributes in
        ## place before we can invoke get_params
        self.model = self
        self.view = view

        ## initialize comboboxes, so we can fill them in
        view.combobox_init('name_combo')
        view.combobox_init('type_combo', dbtypes, type_combo_cell_data_func)
        self.connection_names = []
        self.connections = prefs.prefs[bauble.conn_list_pref] or {}
        for ith_connection_name in sorted(self.connections):
            view.combobox_append_text('name_combo', ith_connection_name)
            self.connection_names.append(ith_connection_name)
        if self.connection_names:
            self.connection_name = prefs.prefs[bauble.conn_default_pref]
            if self.connection_name not in self.connections:
                self.prev_connection_name = \
                    self.connection_name = self.connection_names[0]
            self.dbtype = None
            self.set_params()
        else:
            self.dbtype = ''
            self.connection_name = None
        GenericEditorPresenter.__init__(
            self, model=self, view=view, refresh_view=True)
        logo_path = os.path.join(paths.lib_dir(), "images", "bauble_logo.png")
        view.image_set_from_file('logo_image', logo_path)
        view.set_title('%s %s' % ('Bauble', bauble.version))
        try:
            view.set_icon(gtk.gdk.pixbuf_new_from_file(bauble.default_icon))
        except:
            pass

        from threading import Thread
        self.start_thread(Thread(target=check_and_notify_new_version,
                                 args=[self.view]))
Example #7
0
 def on_tag_desc_textbuffer_changed(self, widget, value=None):
     return GenericEditorPresenter.on_textbuffer_changed(self,
                                                         widget,
                                                         value,
                                                         attr='description')
Example #8
0
 def on_tag_desc_textbuffer_changed(self, widget, value=None):
     return GenericEditorPresenter.on_textbuffer_changed(
         self, widget, value, attr='description')