Esempio n. 1
0
    def display(self):
        # get the main window from glade
        topDialog = Glade()

        # set gramps style title for the window
        window = topDialog.toplevel
        self.set_window(window, topDialog.get_object("title"),
                        _("Database Owner Editor"))
        self.setup_configs('interface.ownereditor', 500, 400)

        # move help button to the left side
        action_area = topDialog.get_object("action_area")
        help_button = topDialog.get_object("help_button")
        action_area.set_child_secondary(help_button, True)

        # connect signals
        topDialog.connect_signals({
            "on_ok_button_clicked": self.on_ok_button_clicked,
            "on_cancel_button_clicked": self.close,
            "on_help_button_clicked": self.on_help_button_clicked,
            "on_eventbox_button_press_event": self.on_button_press_event,
            "on_menu_activate": self.on_menu_activate
        })

        # fetch the popup menu
        self.menu = topDialog.get_object("popup_menu")
        self.track_ref_for_deletion("menu")

        #topDialog.connect_signals({"on_menu_activate": self.on_menu_activate})

        # get current db owner and attach it to the entries of the window
        self.owner = self.db.get_researcher()

        self.entries = []
        entry = [
            ("name", self.owner.set_name, self.owner.get_name),
            ("address", self.owner.set_address, self.owner.get_address),
            ("locality", self.owner.set_locality, self.owner.get_locality),
            ("city", self.owner.set_city, self.owner.get_city),
            ("state", self.owner.set_state, self.owner.get_state),
            ("country", self.owner.set_country, self.owner.get_country),
            ("zip", self.owner.set_postal_code, self.owner.get_postal_code),
            ("phone", self.owner.set_phone, self.owner.get_phone),
            ("email", self.owner.set_email, self.owner.get_email),
        ]

        for (name, set_fn, get_fn) in entry:
            self.entries.append(
                MonitoredEntry(topDialog.get_object(name), set_fn, get_fn,
                               self.db.readonly))
        # ok, let's see what we've done
        self.show()
Esempio n. 2
0
    def _setup_fields(self):
        r'''
        Gramps XML storage means ability to also import/manage alone records
        /!\ some attributes are translated keys
        see data_item keys and eventref types of attribute
        '''

        #/database/people/person/name/surname/surname/text()
        self.wname = MonitoredEntry(self.top.get_object("wname"),
                                    self.obj.set_wname, self.obj.get_wname,
                                    self.db.readonly)

        #/database/people/person/name/first/text()
        self.wfname = MonitoredEntry(self.top.get_object("wfname"),
                                     self.obj.set_wfname, self.obj.get_wfname,
                                     self.db.readonly)

        #/database/people/person/eventref/attribute/@type
        #/database/people/person/eventref/attribute/@value
        self.wage = MonitoredEntry(self.top.get_object("wage"),
                                   self.obj.set_wage, self.obj.get_wage,
                                   self.db.readonly)

        #/database/people/person/eventref/@hlink
        #/database/events/event/place/@hlink
        #/database/places/placeobj/ptitle/text()
        self.worig = MonitoredEntry(self.top.get_object("worig"),
                                    self.obj.set_worig, self.obj.get_worig,
                                    self.db.readonly)

        #/database/people/person/eventref/@hlink
        #/database/events/event/description/text()
        self.woccu = MonitoredEntry(self.top.get_object("woccu"),
                                    self.obj.set_woccu, self.obj.get_woccu,
                                    self.db.readonly)

        #/database/people/person/eventref/@hlink
        #/database/events/event/dateval/@val
        #/database/events/event/description/text()
        self.wlive = MonitoredEntry(self.top.get_object("wlive"),
                                    self.obj.set_wlive, self.obj.get_wlive,
                                    self.db.readonly)

        #/database/people/person/personref/@hlink
        #/database/people/person/@handle
        #/database/people/person/personref/@rel
        self.wrelation = MonitoredEntry(self.top.get_object("wrelation"),
                                        self.obj.set_wrelation,
                                        self.obj.get_wrelation,
                                        self.db.readonly)
Esempio n. 3
0
    def __init__(self, dbstate, uistate, track, citation, callback):

        self.dbstate = dbstate
        self.uistate = uistate
        self.track = track
        self.db = dbstate.db

        self.citation = citation
        self.event = find_form_event(self.db, self.citation)
        self.callback = callback

        ManagedWindow.__init__(self, uistate, track, citation)

        self.widgets = {}
        top = self.__create_gui()
        self.set_window(top, None, self.get_menu_title())

        self.date_field = MonitoredDate(self.widgets['date_text'],
                                        self.widgets['date_button'],
                                        self.event.get_date_object(),
                                        self.uistate, self.track,
                                        self.db.readonly)

        self.place_field = PlaceEntry(
            self.dbstate, self.uistate, self.track, self.widgets['place_text'],
            self.widgets['place_event_box'], self.event.set_place_handle,
            self.event.get_place_handle, self.widgets['place_add'],
            self.widgets['place_share'])

        self.ref_field = MonitoredEntry(self.widgets['ref_entry'],
                                        self.citation.set_page,
                                        self.citation.get_page,
                                        self.db.readonly)

        self.__populate_gui(self.event)

        self.show()

        self._config = config.get_manager('form')
        width = self._config.get('interface.form-width')
        height = self._config.get('interface.form-height')
        self.window.resize(width, height)
        horiz_position = self._config.get('interface.form-horiz-position')
        vert_position = self._config.get('interface.form-vert-position')
        if horiz_position != -1:
            self.window.move(horiz_position, vert_position)
Esempio n. 4
0
    def _display(self):
        """ organize Glade 'Reorder IDs' window """

        # get the main window from glade
        self.top = Glade(toplevel="reorder-ids")
        window = self.top.toplevel

        # set gramps style title for the window
        self.set_window(window, self.top.get_object("title"), \
                        _("Reorder Gramps IDs"))

        # connect signals
        self.top.connect_signals({
            "on_object_button_clicked":
            self.__on_object_button_clicked,
            "on_object_button_toggled":
            self.__on_object_button_toggled,
            "on_format_button_clicked":
            self.__on_format_button_clicked,
            "on_start_button_clicked":
            self.__on_start_button_clicked,
            "on_step_button_clicked":
            self.__on_step_button_clicked,
            "on_keep_button_clicked":
            self.__on_keep_button_clicked,
            "on_change_button_clicked":
            self.__on_change_button_clicked,
            "on_change_button_toggled":
            self.__on_change_button_toggled,
            "on_format_entry_keyrelease":
            self.__on_format_entry_keyrelease,
            "on_format_entry_focusout":
            self.__on_format_entry_focusout,
            "on_start_entry_focusout":
            self.__on_start_entry_focusout,
            "on_help_button_clicked":
            self.__on_help_button_clicked,
            "on_cancel_button_clicked":
            self.__on_cancel_button_clicked,
            "on_ok_button_clicked":
            self.__on_ok_button_clicked
        })

        # Calculate all entries and update Glade window
        for prim_obj, tmp in self.xobjects:
            # populate Object, Actual & Quantity fields with values
            obj_active = self.top.get_object('%s_active' % prim_obj)
            self.active_entries[prim_obj] = MonitoredCheckbox(
                obj_active, obj_active, self.obj_values[prim_obj].set_active,
                self.obj_values[prim_obj].get_active)
            obj_actual = self.top.get_object('%s_actual' % prim_obj)
            obj_actual.set_text('%s' % self.obj_values[prim_obj].last_id())
            obj_quant = self.top.get_object('%s_quant' % prim_obj)
            obj_quant.set_text('%s' % str(self.obj_values[prim_obj].quant_id))

            # connect/populate Format, Start, Step, Keep & Change fields with GTK/values
            obj_format = self.top.get_object('%s_format' % prim_obj)
            self.format_entries[prim_obj] = MonitoredEntry(
                obj_format, self.obj_values[prim_obj].set_fmt,
                self.obj_values[prim_obj].get_fmt)
            obj_change = self.top.get_object('%s_change' % prim_obj)
            self.change_entries[prim_obj] = MonitoredCheckbox(
                obj_change, obj_change, self.obj_values[prim_obj].set_change,
                self.obj_values[prim_obj].get_change)
            obj_start = self.top.get_object('%s_start' % prim_obj)
            self.start_entries[prim_obj] = MonitoredEntry(
                obj_start, self.obj_values[prim_obj].set_id,
                self.obj_values[prim_obj].get_id)
            obj_step = self.top.get_object('%s_step' % prim_obj)
            self.step_entries[prim_obj] = MonitoredEntry(
                obj_step,
                self.obj_values[prim_obj].set_step,
                self.obj_values[prim_obj].get_step,
                changed=self.obj_values[prim_obj].change_step)
            obj_keep = self.top.get_object('%s_keep' % prim_obj)
            self.keep_entries[prim_obj] = MonitoredCheckbox(
                obj_keep,
                obj_keep,
                self.obj_values[prim_obj].set_keep,
                self.obj_values[prim_obj].get_keep,
                readonly=True)

        # fetch the popup menu
        self.menu = self.top.get_object("popup_menu")

        # ok, let's see what we've done
        self.show()
Esempio n. 5
0
    def _setup_fields(self):
        r'''
        Gramps XML storage means ability to also import/manage alone records
        /!\ some attributes are translated keys
        see data_item keys and eventref types of attribute
        '''

        #/database/repositories/repository/rname/text()
        self.rinfo = MonitoredEntry(self.top.get_object("rinfo"),
                                    self.obj.set_rinfo, self.obj.get_rinfo,
                                    self.db.readonly)

        # date of transcription/search
        self.rdate = MonitoredEntry(self.top.get_object("rdate"),
                                    self.obj.set_rdate, self.obj.get_rdate,
                                    self.db.readonly)

        #/database/repositories/repository/@handle
        self.rid = MonitoredEntry(self.top.get_object("rid"), self.obj.set_rid,
                                  self.obj.get_rid, self.db.readonly)

        #/database/sources/source/stitle/text()
        self.aname = MonitoredEntry(self.top.get_object("aname"),
                                    self.obj.set_aname, self.obj.get_aname,
                                    self.db.readonly)

        #/database/sources/source/@handle
        self.aid = MonitoredEntry(self.top.get_object("aid"), self.obj.set_aid,
                                  self.obj.get_aid, self.db.readonly)

        #/database/citations/citation/@handle
        self.aref = MonitoredEntry(self.top.get_object("aref"),
                                   self.obj.set_aref, self.obj.get_aref,
                                   self.db.readonly)

        #/database/citations/citation/page
        # hardcoded /database/citations/citation/confidence
        self.avol = MonitoredEntry(self.top.get_object("avol"),
                                   self.obj.set_avol, self.obj.get_avol,
                                   self.db.readonly)

        #/database/people/person/gender
        self.gen = MonitoredEntry(self.top.get_object("gen"), self.obj.set_gen,
                                  self.obj.get_gen, self.db.readonly)

        #/database/people/person/childof/@hlink
        #/database/people/person/name/surname/surname/text()
        self.pname = MonitoredEntry(self.top.get_object("pname"),
                                    self.obj.set_pname, self.obj.get_pname,
                                    self.db.readonly)

        #/database/people/person/name/first/text()
        self.pfname = MonitoredEntry(self.top.get_object("pfname"),
                                     self.obj.set_pfname, self.obj.get_pfname,
                                     self.db.readonly)

        #/database/people/person/eventref/@hlink
        #/database/events/event/dateval/@val
        self.pbdate = MonitoredEntry(self.top.get_object("pbdate"),
                                     self.obj.set_pbdate, self.obj.get_pbdate,
                                     self.db.readonly)

        #/database/people/person/eventref/@hlink
        #/database/events/event/place/@hlink
        #/database/places/placeobj/ptitle/text()
        self.pblace = MonitoredEntry(self.top.get_object("pblace"),
                                     self.obj.set_pblace, self.obj.get_pblace,
                                     self.db.readonly)

        #/database/people/person/eventref/@hlink
        #/database/events/event/dateval/@val
        self.pdate = MonitoredEntry(self.top.get_object("pdate"),
                                    self.obj.set_pdate, self.obj.get_pdate,
                                    self.db.readonly)

        #/database/people/person/eventref/@hlink
        #/database/events/event/place/@hlink
        #/database/places/placeobj/ptitle/text()
        self.pplace = MonitoredEntry(self.top.get_object("pplace"),
                                     self.obj.set_pplace, self.obj.get_pplace,
                                     self.db.readonly)

        #/database/people/person/eventref/noteref/@hlink
        #/database/notes/note/text/text()
        self.pnote = MonitoredEntry(self.top.get_object("pnote"),
                                    self.obj.set_pnote, self.obj.get_pnote,
                                    self.db.readonly)

        #/database/objects/object/file/@src
        self.fname = MonitoredEntry(self.top.get_object("fname"),
                                    self.obj.set_fname, self.obj.get_fname,
                                    self.db.readonly)

        #/database/people/person/parentin/@hlink
        #/database/people/person/name/first/text()
        self.ffname = MonitoredEntry(self.top.get_object("ffname"),
                                     self.obj.set_ffname, self.obj.get_ffname,
                                     self.db.readonly)

        #/database/people/person/eventref/attribute/@type
        #/database/people/person/eventref/attribute/@value
        self.fage = MonitoredEntry(self.top.get_object("fage"),
                                   self.obj.set_fage, self.obj.get_fage,
                                   self.db.readonly)

        #/database/people/person/eventref/@hlink
        #/database/events/event/place/@hlink
        #/database/places/placeobj/ptitle/text()
        self.forig = MonitoredEntry(self.top.get_object("forig"),
                                    self.obj.set_forig, self.obj.get_forig,
                                    self.db.readonly)

        #/database/people/person/eventref/@hlink
        #/database/events/event/description/text()
        self.foccu = MonitoredEntry(self.top.get_object("foccu"),
                                    self.obj.set_foccu, self.obj.get_foccu,
                                    self.db.readonly)

        #/database/people/person/eventref/@hlink
        #/database/events/event/dateval/@val
        #/database/events/event/description/text()
        self.flive = MonitoredEntry(self.top.get_object("flive"),
                                    self.obj.set_flive, self.obj.get_flive,
                                    self.db.readonly)

        #/database/people/person/parentin/@hlink
        #/database/people/person/name/first/text()
        self.mname = MonitoredEntry(self.top.get_object("mname"),
                                    self.obj.set_mname, self.obj.get_mname,
                                    self.db.readonly)

        self.mfname = MonitoredEntry(self.top.get_object("mfname"),
                                     self.obj.set_mfname, self.obj.get_mfname,
                                     self.db.readonly)

        self.mage = MonitoredEntry(self.top.get_object("mage"),
                                   self.obj.set_mage, self.obj.get_mage,
                                   self.db.readonly)

        self.morigin = MonitoredEntry(self.top.get_object("morigin"),
                                      self.obj.set_morigin,
                                      self.obj.get_morigin, self.db.readonly)

        self.moccu = MonitoredEntry(self.top.get_object("moccu"),
                                    self.obj.set_moccu, self.obj.get_moccu,
                                    self.db.readonly)

        self.mlive = MonitoredEntry(self.top.get_object("mlive"),
                                    self.obj.set_mlive, self.obj.get_mlive,
                                    self.db.readonly)

        self.msname = MonitoredEntry(self.top.get_object("msname"),
                                     self.obj.set_msname, self.obj.get_msname,
                                     self.db.readonly)

        self.mdpdate = MonitoredEntry(self.top.get_object("mdpdate"),
                                      self.obj.set_mdpdate,
                                      self.obj.get_mdpdate, self.db.readonly)

        self.mmdate = MonitoredEntry(self.top.get_object("mmdate"),
                                     self.obj.set_mmdate, self.obj.get_mmdate,
                                     self.db.readonly)

        self.mdplace = MonitoredEntry(self.top.get_object("mdplace"),
                                      self.obj.set_mdplace,
                                      self.obj.get_mdplace, self.db.readonly)

        self.mmplace = MonitoredEntry(self.top.get_object("mmplace"),
                                      self.obj.set_mmplace,
                                      self.obj.get_mmplace, self.db.readonly)

        self.mnote = MonitoredEntry(self.top.get_object("mnote"),
                                    self.obj.set_mnote, self.obj.get_mnote,
                                    self.db.readonly)

        #/database/people/person/parentin/@hlink
        #/database/families/family/mother
        #/database/families/family/father
        self.spname = MonitoredEntry(self.top.get_object("spname"),
                                     self.obj.set_spname, self.obj.get_spname,
                                     self.db.readonly)

        #/database/families/family/eventref/@hlink
        #/database/events/event/dateval/@val
        self.spmdate = MonitoredEntry(self.top.get_object("bannsdate"),
                                      self.obj.set_spmdate,
                                      self.obj.get_spmdate, self.db.readonly)

        #/database/families/family/eventref/@hlink
        #/database/events/event/place/@hlink
        #/database/places/placeobj/ptitle/text()
        self.spmplace = MonitoredEntry(self.top.get_object("bannsplace"),
                                       self.obj.set_spmplace,
                                       self.obj.get_spmplace, self.db.readonly)
Esempio n. 6
0
    def _setup_fields(self):
        r'''
        Gramps XML storage means ability to also import/manage alone records
        /!\ some attributes are translated keys
        see data_item keys and eventref types of attribute
        '''

        #/database/repositories/repository/rname/text()
        self.rinfo   = MonitoredEntry(
            self.top.get_object("rinfo"),
            self.obj.set_rinfo,
            self.obj.get_rinfo,
            self.db.readonly)

        # date of transcription/search
        self.rdate  = MonitoredEntry(
            self.top.get_object("rdate"),
            self.obj.set_rdate,
            self.obj.get_rdate,
            self.db.readonly)

        #/database/repositories/repository/@handle
        self.rid  = MonitoredEntry(
            self.top.get_object("rid"),
            self.obj.set_rid,
            self.obj.get_rid,
            self.db.readonly)

        #/database/sources/source/stitle/text()
        self.aname  = MonitoredEntry(
            self.top.get_object("aname"),
            self.obj.set_aname,
            self.obj.get_aname,
            self.db.readonly)

        #/database/sources/source/@handle
        self.aid  = MonitoredEntry(
            self.top.get_object("aid"),
            self.obj.set_aid,
            self.obj.get_aid,
            self.db.readonly)

        #/database/citations/citation/@handle
        self.aref  = MonitoredEntry(
            self.top.get_object("aref"),
            self.obj.set_aref,
            self.obj.get_aref,
            self.db.readonly)

        #/database/citations/citation/page
        # hardcoded /database/citations/citation/confidence
        self.avol  = MonitoredEntry(
            self.top.get_object("avol"),
            self.obj.set_avol,
            self.obj.get_avol,
            self.db.readonly)

        #/database/people/person/gender
        self.gen  = MonitoredEntry(
            self.top.get_object("gen"),
            self.obj.set_gen,
            self.obj.get_gen,
            self.db.readonly)

        #/database/people/person/name/surname/surname/text()
        self.pname  = MonitoredEntry(
            self.top.get_object("pname"),
            self.obj.set_pname,
            self.obj.get_pname,
            self.db.readonly)

        #/database/people/person/eventref/@hlink
        #/database/events/event/dateval/@val
        self.pbdate  = MonitoredEntry(
            self.top.get_object("pbdate"),
            self.obj.set_pbdate,
            self.obj.get_pbdate,
            self.db.readonly)

        #/database/people/person/eventref/@hlink
        #/database/places/placeobj/@handle
        self.pbplace  = MonitoredEntry(
            self.top.get_object("pbplace"),
            self.obj.set_pbplace,
            self.obj.get_pbplace,
            self.db.readonly)

        #/database/people/person/name/first/text()
        self.pfname  = MonitoredEntry(
            self.top.get_object("pfname"),
            self.obj.set_pfname,
            self.obj.get_pfname,
            self.db.readonly)

        #/database/people/person/eventref/noteref/@hlink
        #/database/notes/note/text/text()
        self.pnote  = MonitoredEntry(
            self.top.get_object("pnote"),
            self.obj.set_pnote,
            self.obj.get_pnote,
            self.db.readonly)

        # Residence event
        #/database/people/person/eventref/@hlink
        #/database/events/event/description/text()
        self.address  = MonitoredEntry(
            self.top.get_object("address"),
            self.obj.set_address,
            self.obj.get_address,
            self.db.readonly)

        #/database/people/person/eventref/@hlink
        #/database/events/event/description/text()
        self.occupation  = MonitoredEntry(
            self.top.get_object("occupation"),
            self.obj.set_occupation,
            self.obj.get_occupation,
            self.db.readonly)

        #/database/people/person/eventref/attribute/@type
        #/database/people/person/eventref/attribute/@value
        self.age  = MonitoredEntry(
            self.top.get_object("age"),
            self.obj.set_age,
            self.obj.get_age,
            self.db.readonly)
Esempio n. 7
0
    def _setup_fields(self):
        r'''
        Gramps XML storage means ability to also import/manage alone records
        /!\ some attributes are translated keys
        see data_item keys and eventref types of attribute
        '''

        #/database/repositories/repository/rname/text()
        self.rinfo = MonitoredText(
            self.top.get_object("rinfo"),
            self.top.get_object("rinfo").set_text(self.rinfo),
            self.top.get_object("rinfo").get_text, True)

        # date of transcription/search
        self.rdate = MonitoredText(
            self.top.get_object("rdate"),
            self.top.get_object("rdate").set_text(str(date.Today())),
            #self.top.get_object("rdate").get_date_object(),
            #uistate,
            #track,
            True)

        #/database/repositories/repository/@handle
        self.rid = MonitoredEntry(self.top.get_object("rid"),
                                  self.top.get_object("rid").set_text,
                                  self.top.get_object("rid").get_text, True)

        #/database/sources/source/stitle/text()
        self.aname = MonitoredText(
            self.top.get_object("aname"),
            self.top.get_object("aname").set_text(self.aname),
            self.top.get_object("aname").get_text, True)

        #/database/sources/source/@handle
        self.aid = MonitoredEntry(self.top.get_object("aid"),
                                  self.top.get_object("aid").set_text,
                                  self.top.get_object("aid").get_text, True)

        #/database/citations/citation/@handle
        self.aref = MonitoredEntry(self.top.get_object("aref"),
                                   self.top.get_object("aref").set_text,
                                   self.top.get_object("aref").get_text, True)

        #/database/citations/citation/dateval/@val
        #self.adate = MonitoredDate(
        #self.top.get_object("adate"),
        #self.top.get_object("adate").set_text,
        #self.top.get_object("adate").get_date_object(),
        #uistate,
        #track,
        #True)

        #/database/citations/citation/page
        # hardcoded /database/citations/citation/confidence
        self.avol = MonitoredEntry(
            self.top.get_object("avol"),
            self.top.get_object("avol").set_text(self.avol),
            self.top.get_object("avol").get_text, True)

        #/database/people/person/gender
        #self.gen  = MonitoredType(
        #self.top.get_object("gen"),
        #self.top.get_object("gen").set_text,
        #self.top.get_object("gen").get_text,
        #True)

        #/database/people/person/childof/@hlink
        #/database/people/person/name/surname/surname/text()
        self.pname = MonitoredEntry(self.top.get_object("pname"),
                                    self.top.get_object("pname").set_text,
                                    self.top.get_object("pname").get_text,
                                    True)

        #/database/people/person/name/first/text()
        self.pfname = MonitoredText(self.top.get_object("pfname"),
                                    self.top.get_object("pfname").set_text,
                                    self.top.get_object("pfname").get_text,
                                    True)

        #/database/people/person/eventref/@hlink
        #/database/events/event/dateval/@val
        #self.pdate = MonitoredDate(
        #self.top.get_object("pdate"),
        #self.top.get_object("pdate_stat"),
        #self.top.get_object("pdate").get_date_object(),
        #uistate,
        #track,
        #True)

        #/database/people/person/eventref/@hlink
        #/database/events/event/place/@hlink
        #/database/places/placeobj/ptitle/text()
        #self.pplace  = PlaceEntry(
        #dbstate, uistate, track,
        #self.top.get_object("pplace"),
        #self.top.get_object("pplace").set_place_handle,
        #self.top.get_object("pplace").get_place_handle,
        #self.top.get_object('add_del_place'),
        #self.top.get_object('select_place'))

        #/database/people/person/eventref/noteref/@hlink
        #/database/notes/note/text/text()
        #self.pnote  = NoteEntry(
        #dbstate, uistate, track,
        #self.top.get_object("pnote"),
        #self.top.get_object("pnote").set_note_handle,
        #self.top.get_object("pnote").get_note_handle,
        #self.top.get_object('add_del_note'),
        #self.top.get_object('select_note'))

        #/database/objects/object/file/@src
        #self.fname  = MediaEntry(
        #dbstate, uistate, track,
        #self.top.get_object("fname"),
        #self.top.get_object("fname").set_media_path,
        #self.top.get_object("fname").get_media_path,
        #self.top.get_object('add_del_path'),
        #self.top.get_object('select_path'))

        #/database/people/person/parentin/@hlink
        #/database/people/person/name/first/text()
        self.ffname = MonitoredText(self.top.get_object("ffname"),
                                    self.top.get_object("ffname").set_text,
                                    self.top.get_object("ffname").get_text,
                                    True)

        #/database/people/person/eventref/attribute/@type
        #/database/people/person/eventref/attribute/@value
        self.fage = MonitoredEntry(self.top.get_object("fage"),
                                   self.top.get_object("fage").set_text,
                                   self.top.get_object("fage").get_text, True)

        #/database/people/person/eventref/@hlink
        #/database/events/event/place/@hlink
        #/database/places/placeobj/ptitle/text()
        #self.forig  = PlaceEntry(
        #dbstate, uistate, track,
        #self.top.get_object("forig"),
        #self.top.get_object("forig").set_place_handle,
        #self.top.get_object("forig").get_place_handle,
        #self.top.get_object('add_del_place'),
        #self.top.get_object('select_place'))

        #/database/people/person/eventref/@hlink
        #/database/events/event/description/text()
        self.foccu = MonitoredEntry(self.top.get_object("foccu"),
                                    self.top.get_object("foccu").set_text,
                                    self.top.get_object("foccu").get_text,
                                    True)

        #/database/people/person/eventref/@hlink
        #/database/events/event/dateval/@val
        #/database/events/event/description/text()
        self.flive = MonitoredEntry(self.top.get_object("flive"),
                                    self.top.get_object("flive").set_text,
                                    self.top.get_object("flive").get_text,
                                    True)

        #/database/people/person/parentin/@hlink
        #/database/people/person/name/first/text()
        self.mname = MonitoredText(self.top.get_object("mname"),
                                   self.top.get_object("mname").set_text,
                                   self.top.get_object("mname").get_text, True)

        self.mfname = MonitoredText(self.top.get_object("mfname"),
                                    self.top.get_object("mfname").set_text,
                                    self.top.get_object("mfname").get_text,
                                    True)

        self.mage = MonitoredText(self.top.get_object("mage"),
                                  self.top.get_object("mage").set_text,
                                  self.top.get_object("mage").get_text, True)

        #self.morigin  = PlaceEntry(
        #dbstate, uistate, track,
        #self.top.get_object("morigin"),
        #self.top.get_object("morigin").set_place_handle,
        #self.top.get_object("morigin").get_place_handle,
        #self.top.get_object('add_del_place'),
        #self.top.get_object('select_place'))

        self.moccu = MonitoredText(self.top.get_object("moccu"),
                                   self.top.get_object("moccu").set_text,
                                   self.top.get_object("moccu").get_text, True)

        self.mlive = MonitoredEntry(self.top.get_object("mlive"),
                                    self.top.get_object("mlive").set_text,
                                    self.top.get_object("mlive").get_text,
                                    True)

        self.msname = MonitoredText(self.top.get_object("msname"),
                                    self.top.get_object("msname").set_text,
                                    self.top.get_object("msname").get_text,
                                    True)
Esempio n. 8
0
    def _display(self):
        """ organize Glade 'Import Pro-Gen' window """

        # get the main window from glade
        self.glade = Glade('importprogen.glade')
        self.set_window(self.glade.toplevel, self.glade.get_object('title'),
                        _('Import Pro-Gen'))

        # calculate all entries and update Glade window
        # Text for Source / Citation objects
        for obj in ('source_btn', 'citation_btn'):
            widget = self.glade.get_object('imp_%s' % obj)
            set_import = eval('self.imp_values.%s.set_value' % obj)
            get_import = eval('self.imp_values.%s.get_value' % obj)
            self.import_methods[obj] = MonitoredCheckbox(\
                widget, widget, set_import, get_import, self.dbase.readonly)
        for obj in ('source_title', 'source_attr', 'citation_page',
                    'citation_attr'):
            widget = self.glade.get_object('imp_%s' % obj)
            set_import = eval('self.imp_values.%s.set_entry' % obj)
            get_import = eval('self.imp_values.%s.get_entry' % obj)
            self.import_methods[obj] = MonitoredEntry(\
                widget, set_import, get_import, self.dbase.readonly)
        widget = self.glade.get_object('imp_citation_conf')
        self.import_methods['conf'] = MonitoredMenu(
            widget, self.imp_values.citation_conf.set_value,
            self.imp_values.citation_conf.get_value,
            [(_('Very Low'), Citation.CONF_VERY_LOW),
             (_('Low'), Citation.CONF_LOW),
             (_('Normal'), Citation.CONF_NORMAL),
             (_('High'), Citation.CONF_HIGH),
             (_('Very High'), Citation.CONF_VERY_HIGH)], self.dbase.readonly)
        widget = self.glade.get_object('imp_source_priv')
        get_import = eval('self.imp_values.source_priv')
        self.import_methods['source_priv'] = PrivacyButton(\
            widget, get_import, self.dbase.readonly)
        widget = self.glade.get_object('imp_citation_priv')
        get_import = eval('self.imp_values.citation_priv')
        self.import_methods['citation_priv'] = PrivacyButton(\
            widget, get_import, self.dbase.readonly)

        # Text (w. Defaults) for Tags
        for obj in ('text', 'fname'):
            widget = self.glade.get_object('tag_default_%s' % obj)
            set_import = eval('self.default_values.%s.set_entry' % obj)
            get_import = eval('self.default_values.%s.get_entry' % obj)
            self.default_methods[obj] = MonitoredEntry(\
                widget, set_import, get_import, self.dbase.readonly)
        date = Today()
        datebase = DateBase()
        datebase.set_date_object(date)
        self.default_methods['date'] = MonitoredDate(\
            self.glade.get_object('tag_default_date'),
            self.glade.get_object('tag_default_date_btn'),
            datebase.get_date_object(),
            self.uistate, [], self.dbase.readonly)

        for obj in libprogen.TAGOBJECTS:
            # populate object fields with values
            widget = self.glade.get_object('tag_%s_obj' % obj)
            self.tagobj_methods[obj] = MonitoredCheckbox(
                widget, widget, self.tagobj_values[obj].tag_obj.set_value,
                self.tagobj_values[obj].tag_obj.get_value)
            widget = self.glade.get_object('tag_%s_text' % obj)
            self.tagtext_methods[obj] = MonitoredEntry(
                widget, self.tagobj_values[obj].tag_text.set_entry,
                self.tagobj_values[obj].tag_text.get_entry)
            widget = self.glade.get_object('tag_%s_fname' % obj)
            self.tagfname_methods[obj] = MonitoredCheckbox(
                widget, widget, self.tagobj_values[obj].tag_fname.set_value,
                self.tagobj_values[obj].tag_fname.get_value)
            widget = self.glade.get_object('tag_%s_date' % obj)
            self.tagdate_methods[obj] = MonitoredCheckbox(
                widget, widget, self.tagobj_values[obj].tag_date.set_value,
                self.tagobj_values[obj].tag_date.get_value)

        # button's for primary objects
        for obj in libprogen.PRIMOBJECTS:
            # populate pirm. Object buttons with values
            widget = self.glade.get_object('prim_%s_btn' % obj)
            set_import = eval("self.primobj_values['%s'].set_value" % obj)
            get_import = eval("self.primobj_values['%s'].get_value" % obj)
            self.primobj_methods[obj] = MonitoredCheckbox(\
                widget, widget, set_import, get_import, self.dbase.readonly)

        # button's for miscallaneous option's
        for obj in libprogen.OPTOBJECTS:
            # populate option buttons with values
            widget = self.glade.get_object('opt_%s_btn' % obj)
            set_import = eval("self.option_values['%s'].set_value" % obj)
            get_import = eval("self.option_values['%s'].get_value" % obj)
            self.option_methods[obj] = MonitoredCheckbox(\
                widget, widget, set_import, get_import, self.dbase.readonly)

        # connect signals
        self.glade.connect_signals({
            "on_source_button_toggled":
            self.__on_source_button_toggled,
            "on_citation_button_toggled":
            self.__on_citation_button_toggled,
            "on_import_entry_keyrelease":
            self.__on_import_entry_keyrelease,
            "on_tagtext_entry_keyrelease":
            self.__on_tagtext_entry_keyrelease,
            "on_object_button_clicked":
            self.__on_object_button_clicked,
            "on_object_button_toggled":
            self.__on_object_button_toggled,
            "on_text_button_clicked":
            self.__on_text_button_clicked,
            "on_fname_button_clicked":
            self.__on_fname_button_clicked,
            "on_fname_button_toggled":
            self.__on_fname_button_toggled,
            "on_date_button_clicked":
            self.__on_date_button_clicked,
            "on_date_button_toggled":
            self.__on_date_button_toggled,
            "on_primobj_button_toggled":
            self.__on_primobj_button_toggled,
            "on_surname_button_toggled":
            self.__on_surname_button_toggled,
            "on_x_button_clicked":
            self.__on_x_button_clicked,
            "on_help_button_clicked":
            self.__on_help_button_clicked,
            "on_cancel_button_clicked":
            self.__on_cancel_button_clicked,
            "on_ok_button_clicked":
            self.__on_ok_button_clicked
        })

        # state of two objects trigged form configuration
        widget = self.glade.get_object('imp_source_btn')
        self.__on_source_button_toggled(widget)
        widget = self.glade.get_object('imp_citation_btn')
        self.__on_citation_button_toggled(widget)
        widget = self.glade.get_object('import_ok')
        widget.grab_focus()

        # creates a modal window and display immediatly!
        self.show()
        self.glade.toplevel.run()