示例#1
0
    def _on_pick_one(self, widget):
        from gui.selectors import SelectorFactory
        object_class = OBJECT_MAP[self.uri_list.get_active()]
        Select = SelectorFactory(object_class)
        uri = self.url_link.get_text()
        default = None
        if uri.startswith("gramps://"):
            obj_class, prop, value = uri[9:].split("/", 2)
            if object_class == obj_class:
                if prop == "handle":
                    default = value
                elif (prop == "gramps_id"
                      and object_class in self.dbstate.db.get_table_names()):
                    person = self.dbstate.db.get_table_metadata(
                        object_class)["gramps_id_func"](value)
                    if person:
                        default = person.handle
        d = Select(self.dbstate, self.uistate, self.track, default=default)

        result = d.run()
        if result:
            prop = "handle"
            value = result.handle
            self.selected.set_text(self.display_link(object_class, prop,
                                                     value))
            self.url_link.set_text("gramps://%s/%s/%s" %
                                   (object_class, prop, value))
示例#2
0
    def share_button_clicked(self, obj):
        SelectNote = SelectorFactory('Note')

        sel = SelectNote(self.dbstate, self.uistate, self.track)
        note = sel.run()
        if note:
            self.add_callback(note.handle)
示例#3
0
    def select_parents_clicked(self, obj):
        SelectFamily = SelectorFactory('Family')

        dialog = SelectFamily(self.dbstate, self.uistate, self.track)
        family = dialog.run()
        if family:
            self.obj.set_family_handle(family.handle)
        self.update_parent_label()
示例#4
0
 def button_press(self, obj):
     obj_class = self.namespace
     selector = SelectorFactory(obj_class)
     inst = selector(self.dbstate, self.uistate, self.track)
     val = inst.run()
     if val is None:
         self.set_text('')
     else:
         self.set_text(val.get_gramps_id())
示例#5
0
    def _select_person(self, obj):
        SelectPerson = SelectorFactory('Person')

        sel = SelectPerson(self.dbstate, self.uistate, self.track)
        person = sel.run()

        if person:
            self.obj.ref = person.get_handle()
            self.person_label.set_text(name_displayer.display(person))
示例#6
0
    def share_button_clicked(self, obj):
        SelectEvent = SelectorFactory('Event')

        sel = SelectEvent(self.dbstate, self.uistate, self.track)
        event = sel.run()
        if event:
            try:
                ref = gen.lib.EventRef()
                ref.set_role(self.default_role())
                self.get_ref_editor()(self.dbstate, self.uistate, self.track,
                                      event, ref, self.object_added)
            except Errors.WindowActiveError:
                from QuestionDialog import WarningDialog
                WarningDialog(_("Cannot share this reference"),
                              self.__blocked_text())
示例#7
0
    def share_button_clicked(self, obj):
        """
        Function called when the Share button is clicked. 
        
        This function should be overridden by the derived class.
        
        """
        SelectObject = SelectorFactory('MediaObject')

        sel = SelectObject(self.dbstate, self.uistate, self.track)
        src = sel.run()
        if src:
            sref = gen.lib.MediaRef()
            try:
                from gui.editors import EditMediaRef
                EditMediaRef(self.dbstate, self.uistate, self.track, src, sref,
                             self.add_callback)
            except Errors.WindowActiveError:
                from QuestionDialog import WarningDialog
                WarningDialog(_("Cannot share this reference"),
                              self.__blocked_text())
示例#8
0
    def share_button_clicked(self, obj):
        SelectRepository = SelectorFactory('Repository')

        sel = SelectRepository(
            self.dbstate,
            self.uistate,
            self.track)
        
        repo = sel.run()
        if repo:
            try:
                from gui.editors import EditRepoRef
                ref = gen.lib.RepoRef()
                EditRepoRef(self.dbstate,
                              self.uistate,
                              self.track, 
                              repo,
                              ref,
                              self.add_callback)
                
            except Errors.WindowActiveError:
                pass
    def share_button_clicked(self, obj):
        SelectCitation = SelectorFactory('Citation')

        sel = SelectCitation(self.dbstate, self.uistate, self.track)
        object = sel.run()
        LOG.debug("selected object: %s" % object)
        # the object returned should either be a Source or a Citation
        if object:
            if isinstance(object, Source):
                try:
                    from gui.editors import EditCitation
                    EditCitation(self.dbstate,
                                 self.uistate,
                                 self.track,
                                 gen.lib.Citation(),
                                 object,
                                 callback=self.add_callback,
                                 callertitle=self.callertitle)
                except Errors.WindowActiveError:
                    from QuestionDialog import WarningDialog
                    WarningDialog(_("Cannot share this reference"),
                                  self.__blocked_text())
            elif isinstance(object, Citation):
                try:
                    from gui.editors import EditCitation
                    EditCitation(self.dbstate,
                                 self.uistate,
                                 self.track,
                                 object,
                                 callback=self.add_callback,
                                 callertitle=self.callertitle)
                except Errors.WindowActiveError:
                    from QuestionDialog import WarningDialog
                    WarningDialog(_("Cannot share this reference"),
                                  self.__blocked_text())
            else:
                raise ValueError("selection must be either source or citation")
示例#10
0
from editprimary import EditPrimary
from editchildref import EditChildRef
from editperson import EditPerson
from displaytabs import (EmbeddedList, EventEmbedList, CitationEmbedList,
                         FamilyAttrEmbedList, NoteTab, GalleryTab,
                         FamilyLdsEmbedList, ChildModel)
from gui.widgets import (PrivacyButton, MonitoredEntry, MonitoredDataType,
                         MonitoredTagList)
from gen.plug import CATEGORY_QR_FAMILY
from QuestionDialog import (ErrorDialog, RunDatabaseRepair, WarningDialog,
                            MessageHideDialog)
from gen.utils import get_birth_or_fallback, get_death_or_fallback
from gui.selectors import SelectorFactory
from Utils import preset_name

SelectPerson = SelectorFactory('Person')

_RETURN = gdk.keyval_from_name("Return")
_KP_ENTER = gdk.keyval_from_name("KP_Enter")
_LEFT_BUTTON = 1
_RIGHT_BUTTON = 3


class ChildEmbedList(EmbeddedList):
    """
    The child embed list is specific to the Edit Family dialog, so it
    is contained here instead of in displaytabs.
    """

    _HANDLE_COL = 13
    _DND_TYPE = DdTargets.CHILDREF
示例#11
0
 def call_selector(self):
     cls = SelectorFactory('Note')
     return cls(self.dbstate, self.uistate, self.track)
示例#12
0
 def call_selector(self):
     cls = SelectorFactory('MediaObject')
     return cls(self.dbstate, self.uistate, self.track)