* src/DisplayTabs.py: add SourceRefModel, NameEmbedList,

AddrEmbedList
* src/EditPerson.py: Use new EmbedLists
* src/ViewManager.py: set max value on set_fraction
* src/edit_person.glade: remove old lists
* src/GrampsDb/_ReadGedcom.py: fix types


svn: r5850
This commit is contained in:
Don Allingham 2006-01-29 04:30:16 +00:00
parent 698ba24d11
commit dfcdcab183
7 changed files with 286 additions and 3266 deletions

View File

@ -1,5 +1,10 @@
2006-01-28 Don Allingham <don@gramps-project.org>
* src/DisplayTabs.py: add SourceRefModel
* src/DisplayTabs.py: add SourceRefModel, NameEmbedList,
AddrEmbedList
* src/EditPerson.py: Use new EmbedLists
* src/ViewManager.py: set max value on set_fraction
* src/edit_person.glade: remove old lists
* src/GrampsDb/_ReadGedcom.py: fix types
* src/EditFamily.py: fix variable names
* src/GrampsDb/_GrampsBSDDB.py: qualify strxfrm

View File

@ -328,7 +328,7 @@ class EmbeddedList(ButtonTab):
Returns True if the get_data returns a length greater than
0. Typically, get_data returns the list of associated data.
"""
return len(self.get_data()) > 0
return len(self.get_data()) == 0
def get_data(self):
"""
@ -549,6 +549,110 @@ class DataEmbedList(EmbeddedList):
if ref:
print ref
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
class AttrEmbedList(EmbeddedList):
_HANDLE_COL = -1
_column_names = [
(_('Type'),0),
(_('Value'),1),
]
def __init__(self,dbstate,uistate,track,data):
self.data = data
EmbeddedList.__init__(self, dbstate, uistate, track,
_('Attributes'), AttrModel)
def get_data(self):
return self.data
def column_order(self):
return ((1,0),(1,1))
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
class WebEmbedList(EmbeddedList):
_HANDLE_COL = -1
_column_names = [
(_('Type'),0),
(_('Path'),1),
(_('Description'),2),
]
def __init__(self,dbstate,uistate,track,data):
self.data = data
EmbeddedList.__init__(self, dbstate, uistate, track,
_('Internet'), WebModel)
def get_data(self):
return self.data
def column_order(self):
return ((1,0),(1,1),(1,2))
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
class NameEmbedList(EmbeddedList):
_HANDLE_COL = -1
_column_names = [
(_('Name'),0),
(_('Type'),1),
]
def __init__(self,dbstate,uistate,track,data):
self.data = data
EmbeddedList.__init__(self, dbstate, uistate, track,
_('Names'), NameModel)
def get_data(self):
return self.data
def column_order(self):
return ((1,0),(1,1))
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
class AddrEmbedList(EmbeddedList):
_HANDLE_COL = -1
_column_names = [
(_('Date'),0),
(_('Street'),1),
(_('State'),2),
(_('City'),3),
(_('Country'),4),
]
def __init__(self,dbstate,uistate,track,data):
self.data = data
EmbeddedList.__init__(self, dbstate, uistate, track,
_('Addresses'), AddressModel)
def get_data(self):
return self.data
def column_order(self):
return ((1,0),(1,1),(1,2),(1,3),(1,4))
#-------------------------------------------------------------------------
#
# NoteTab
@ -570,15 +674,45 @@ class NoteTab(GrampsTab):
return len(buf.get_text(buf.get_start_iter(),buf.get_end_iter())) == 0
def build_interface(self):
vbox = gtk.VBox()
self.text = gtk.TextView()
self.flowed = gtk.RadioButton(None,_('Flowed'))
self.format = gtk.RadioButton(self.flowed,_('Formatted'))
if self.note_obj and self.note_obj.get_format():
self.format.set_active(True)
self.text.set_wrap_mode(gtk.WRAP_NONE)
else:
self.flowed.set_active(True)
self.text.set_wrap_mode(gtk.WRAP_WORD)
self.flowed.connect('toggled',self.flow_changed)
scroll = gtk.ScrolledWindow()
scroll.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
scroll.add_with_viewport(self.text)
self.pack_start(scroll,True)
vbox.pack_start(scroll,True)
vbox.set_spacing(6)
hbox = gtk.HBox()
hbox.set_spacing(6)
hbox.pack_start(self.flowed,False)
hbox.pack_start(self.format,False)
vbox.pack_start(hbox,False)
self.pack_start(vbox,True)
if self.note_obj:
self.text.get_buffer().insert_at_cursor(self.note_obj.get())
self.rebuild()
def flow_changed(self,obj):
if obj.get_active():
self.text.set_wrap_mode(gtk.WRAP_WORD)
else:
self.text.set_wrap_mode(gtk.WRAP_NONE)
def rebuild(self):
self._set_label()
@ -843,11 +977,14 @@ class EventRefModel(gtk.ListStore):
])
def column_type(self,event):
t = event.get_type()
if t[0] == RelLib.Event.CUSTOM:
return t[1]
t,v = event.get_type()
if t == RelLib.Event.CUSTOM:
return v
else:
return Utils.family_events[t[0]]
if Utils.personal_events.has_key(t):
return Utils.personal_events[t]
else:
return Utils.family_events[t]
def column_date(self,event_ref):
event = self.db.get_event_from_handle(event_ref.ref)
@ -879,11 +1016,72 @@ class AttrModel(gtk.ListStore):
])
def type_name(self, attr):
t = attr.get_type()
if t[0] == RelLib.Attribute.CUSTOM:
return t[1]
t,v = attr.get_type()
if t == RelLib.Attribute.CUSTOM:
return v
elif Utils.personal_attributes.has_key(t):
return Utils.personal_attributes[t]
else:
return Utils.personal_attributes[t[0]]
return Utils.family_attributes[t]
#-------------------------------------------------------------------------
#
# NameModel
#
#-------------------------------------------------------------------------
class NameModel(gtk.ListStore):
def __init__(self,obj_list,db):
gtk.ListStore.__init__(self,str,str)
self.db = db
for obj in obj_list:
self.append(row=[
NameDisplay.display_name(obj),
type_name(obj),
])
def type_name(self, obj):
t,v = obj.get_type()
if t == RelLib.Name.CUSTOM:
return v
else:
return Utils.name_types[t]
#-------------------------------------------------------------------------
#
# AddressModel
#
#-------------------------------------------------------------------------
class AddressModel(gtk.ListStore):
def __init__(self,obj_list,db):
gtk.ListStore.__init__(self,str,str,str,str,str)
self.db = db
for obj in obj_list:
self.append(row=[
DateHandler.get_date(obj),
obj.street,
obj.city,
obj.state,
obj.country,
])
#-------------------------------------------------------------------------
#
# AddressModel
#
#-------------------------------------------------------------------------
class WebModel(gtk.ListStore):
def __init__(self,obj_list,db):
gtk.ListStore.__init__(self,str,str,str)
self.db = db
for obj in obj_list:
self.append(row=[
obj.type,
obj.path,
obj.desc,
])
#-------------------------------------------------------------------------
#
@ -914,7 +1112,7 @@ class SourceRefModel(gtk.ListStore):
for sref in sref_list:
src = self.db.get_source_from_handle(sref.ref)
self.append(row=[
sref.ref,
src.gramps_id,
src.title,
src.author,
sref.page
@ -978,22 +1176,3 @@ class SourceBackRefModel(gtk.ListStore):
yield True
yield False
#-------------------------------------------------------------------------
#
# FamilyAttrModel
#
#-------------------------------------------------------------------------
class FamilyAttrModel(AttrModel):
def __init__(self,attr_list,db):
AttrModel.__init__(self,attr_list,db)
def type_name(self, attr):
t = attr.get_type()
if t[0] == RelLib.Attribute.CUSTOM:
return t[1]
else:
return Utils.family_attributes[t[0]]

View File

@ -64,31 +64,6 @@ from DisplayTabs import *
from GrampsWidgets import *
from ObjectSelector import PersonSelector,PersonFilterSpec
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
class AttrEmbedList(EmbeddedList):
_HANDLE_COL = -1
_column_names = [
(_('Type'),0),
(_('Value'),1),
]
def __init__(self,dbstate,uistate,track,data):
self.data = data
EmbeddedList.__init__(self, dbstate, uistate, track,
_('Attributes'), FamilyAttrModel)
def get_data(self):
return self.data
def column_order(self):
return ((1,0),(1,1))
class ChildEmbedList(EmbeddedList):
_HANDLE_COL = 10

View File

@ -65,6 +65,7 @@ import NoteEdit
import Spell
import DisplayState
import GrampsDisplay
from DisplayTabs import *
from WindowUtils import GladeIf
from QuestionDialog import WarningDialog, ErrorDialog, SaveDialog, QuestionDialog2
@ -112,7 +113,7 @@ class EditPerson(DisplayState.ManagedWindow):
if self.already_exist:
return
self.state = state
self.dbstate = state
self.uistate = uistate
self.retval = const.UPDATE_PERSON
@ -120,10 +121,10 @@ class EditPerson(DisplayState.ManagedWindow):
# done to ensure that the person object is not stale, as it could
# have been changed by something external (merge, tool, etc).
if self.orig_handle:
person = self.state.db.get_person_from_handle(self.orig_handle)
person = self.dbstate.db.get_person_from_handle(self.orig_handle)
self.person = person
self.orig_surname = self.person.get_primary_name().get_group_name()
self.db = self.state.db
self.db = self.dbstate.db
self.callback = callback
self.path = self.db.get_save_path()
self.not_loaded = True
@ -147,8 +148,6 @@ class EditPerson(DisplayState.ManagedWindow):
self.gladeif = GladeIf(self.top)
self.window.set_title("%s - GRAMPS" % _('Edit Person'))
self.build_gallery(self.top.get_widget('iconbox'))
self.marker = self.top.get_widget('marker')
self.marker.set_sensitive(mod)
if person:
@ -166,69 +165,10 @@ class EditPerson(DisplayState.ManagedWindow):
self.gender.set_sensitive(mod)
self.private = self.top.get_widget('private')
self.private.set_sensitive(mod)
name_delete_btn = self.top.get_widget('aka_del')
name_add_btn = self.top.get_widget('aka_add')
name_edit_btn = self.top.get_widget('aka_edit')
web_delete_btn = self.top.get_widget('url_del')
web_edit_btn = self.top.get_widget('url_edit')
web_add_btn = self.top.get_widget('url_add')
event_delete_btn = self.top.get_widget('event_del')
event_add_btn = self.top.get_widget('event_add')
event_sel_btn = self.top.get_widget('event_sel')
event_edit_btn = self.top.get_widget('event_edit')
attr_add_btn = self.top.get_widget('attr_add')
attr_delete_btn = self.top.get_widget('attr_del')
attr_edit_btn = self.top.get_widget('attr_edit')
addr_add_btn = self.top.get_widget('addr_add')
addr_delete_btn = self.top.get_widget('addr_del')
addr_edit_btn = self.top.get_widget('addr_edit')
self.notes_field = self.top.get_widget("personNotes")
self.notes_field.set_editable(mod)
self.spell_notes = Spell.Spell(self.notes_field)
self.flowed = self.top.get_widget("flowed")
self.flowed.set_sensitive(mod)
self.preform = self.top.get_widget("preform")
self.preform.set_sensitive(mod)
self.event_name_field = self.top.get_widget("eventName")
self.event_place_field = self.top.get_widget("eventPlace")
self.event_cause_field = self.top.get_widget("eventCause")
self.event_date_field = self.top.get_widget("eventDate")
self.event_descr_field = self.top.get_widget("eventDescription")
self.event_src_field = self.top.get_widget("event_srcinfo")
self.event_conf_field = self.top.get_widget("event_conf")
self.attr_conf_field = self.top.get_widget("attr_conf")
self.addr_conf_field = self.top.get_widget("addr_conf")
self.name_conf_field = self.top.get_widget("name_conf")
self.attr_src_field = self.top.get_widget("attr_srcinfo")
self.name_src_field = self.top.get_widget("name_srcinfo")
self.addr_src_field = self.top.get_widget("addr_srcinfo")
self.attr_list = self.top.get_widget("attr_list")
self.attr_type = self.top.get_widget("attr_type")
self.attr_value = self.top.get_widget("attr_value")
self.web_list = self.top.get_widget("web_list")
self.web_url = self.top.get_widget("web_url")
self.web_go = self.top.get_widget("web_go")
self.web_description = self.top.get_widget("url_des")
self.addr_list = self.top.get_widget("address_list")
self.addr_start = self.top.get_widget("address_start")
self.addr_street = self.top.get_widget("street")
self.addr_city = self.top.get_widget("city")
self.addr_state = self.top.get_widget("state")
self.addr_country = self.top.get_widget("country")
self.addr_postal = self.top.get_widget("postal")
self.addr_phone = self.top.get_widget("phone")
self.event_list = self.top.get_widget("eventList")
self.edit_person = self.top.get_widget("edit_person")
self.name_list = self.top.get_widget("nameList")
self.alt_given_field = self.top.get_widget("alt_given")
self.alt_last_field = self.top.get_widget("alt_last")
self.alt_title_field = self.top.get_widget("alt_title")
self.alt_suffix_field = self.top.get_widget("alt_suffix")
self.alt_prefix_field = self.top.get_widget("alt_prefix")
self.name_type_field = self.top.get_widget("name_type")
self.ntype_field = self.top.get_widget("ntype")
self.ntype_field.set_sensitive(mod)
self.vbox = self.top.get_widget('vbox')
self.suffix = self.top.get_widget("suffix")
self.suffix.set_editable(mod)
self.prefix = self.top.get_widget("prefix")
@ -241,26 +181,9 @@ class EditPerson(DisplayState.ManagedWindow):
self.title.set_editable(mod)
self.surname = self.top.get_widget("surname")
self.surname.set_editable(mod)
self.addr_note = self.top.get_widget("addr_note")
self.addr_source = self.top.get_widget("addr_source")
self.attr_note = self.top.get_widget("attr_note")
self.attr_source = self.top.get_widget("attr_source")
self.name_note = self.top.get_widget("name_note")
self.name_source = self.top.get_widget("name_source")
self.gid = self.top.get_widget("gid")
self.gid.set_editable(mod)
self.slist = self.top.get_widget("slist")
self.general_label = self.top.get_widget("general_label")
self.names_label = self.top.get_widget("names_label")
self.events_label = self.top.get_widget("events_label")
self.attr_label = self.top.get_widget("attr_label")
self.addr_label = self.top.get_widget("addr_label")
self.notes_label = self.top.get_widget("notes_label")
self.sources_label = self.top.get_widget("sources_label")
self.inet_label = self.top.get_widget("inet_label")
self.gallery_label = self.top.get_widget("gallery_label")
self.lds_tab = self.top.get_widget("lds_tab")
self.person_photo = self.top.get_widget("personPix")
self.eventbox = self.top.get_widget("eventbox1")
self.prefix_label = self.top.get_widget('prefix_label')
@ -286,32 +209,6 @@ class EditPerson(DisplayState.ManagedWindow):
else:
self.srcreflist = []
if self.srcreflist:
Utils.bold_label(self.sources_label)
if self.person.get_media_list():
Utils.bold_label(self.gallery_label)
# event display
self.event_box = ListBox.EventListBox( state, uistate, self.track,
self.person, self.event_list, self.events_label,
[event_add_btn,event_edit_btn,event_delete_btn,event_sel_btn])
self.attr_box = ListBox.AttrListBox( state, uistate, self.track,
self.person, self.attr_list, self.attr_label,
[attr_add_btn, attr_edit_btn, attr_delete_btn])
self.addr_box = ListBox.AddressListBox( state, uistate, self.track,
self.person, self.addr_list, self.addr_label,
[addr_add_btn, addr_edit_btn, addr_delete_btn])
self.name_box = ListBox.NameListBox(state, uistate, self.track,
self.person, self.name_list, self.names_label,
[name_add_btn, name_edit_btn, name_delete_btn])
self.url_box = ListBox.UrlListBox( state, uistate, self.track,
self.person, self.web_list, self.inet_label,
[web_add_btn, web_edit_btn, web_delete_btn])
self.place_list = self.pdmap.keys()
self.place_list.sort()
@ -322,23 +219,23 @@ class EditPerson(DisplayState.ManagedWindow):
self.gid.set_text(gid)
self.gid.set_editable(True)
self.lds_baptism = RelLib.LdsOrd(self.person.get_lds_baptism())
self.lds_endowment = RelLib.LdsOrd(self.person.get_lds_endowment())
self.lds_sealing = RelLib.LdsOrd(self.person.get_lds_sealing())
# self.lds_baptism = RelLib.LdsOrd(self.person.get_lds_baptism())
# self.lds_endowment = RelLib.LdsOrd(self.person.get_lds_endowment())
# self.lds_sealing = RelLib.LdsOrd(self.person.get_lds_sealing())
if GrampsKeys.get_uselds() \
or (not self.lds_baptism.is_empty()) \
or (not self.lds_endowment.is_empty()) \
or (not self.lds_sealing.is_empty()):
self.top.get_widget("lds_tab").show()
self.top.get_widget("lds_page").show()
if (not self.lds_baptism.is_empty()) \
or (not self.lds_endowment.is_empty()) \
or (not self.lds_sealing.is_empty()):
Utils.bold_label(self.lds_tab)
else:
self.top.get_widget("lds_tab").hide()
self.top.get_widget("lds_page").hide()
# if GrampsKeys.get_uselds() \
# or (not self.lds_baptism.is_empty()) \
# or (not self.lds_endowment.is_empty()) \
# or (not self.lds_sealing.is_empty()):
# self.top.get_widget("lds_tab").show()
# self.top.get_widget("lds_page").show()
# if (not self.lds_baptism.is_empty()) \
# or (not self.lds_endowment.is_empty()) \
# or (not self.lds_sealing.is_empty()):
# Utils.bold_label(self.lds_tab)
# else:
# self.top.get_widget("lds_tab").hide()
# self.top.get_widget("lds_page").hide()
self.ntype_selector = \
AutoComp.StandardCustomSelector(Utils.name_types,
@ -348,95 +245,57 @@ class EditPerson(DisplayState.ManagedWindow):
self.write_primary_name()
self.load_person_image()
# set notes data
self.notes_buffer = self.notes_field.get_buffer()
if person.get_note():
self.notes_buffer.set_text(person.get_note())
if person.get_note_object().get_format() == 1:
self.preform.set_active(True)
else:
self.flowed.set_active(True)
Utils.bold_label(self.notes_label)
self.set_list_dnd(self.name_list, self.name_drag_data_get,
self.name_drag_begin, self.name_drag_data_received)
self.set_list_dnd(self.event_list, self.ev_drag_data_get,
self.ev_drag_begin, self.ev_drag_data_received)
self.set_list_dnd(self.web_list,self.url_drag_data_get,
self.url_drag_begin, self.url_drag_data_received)
self.set_list_dnd(self.attr_list, self.at_drag_data_get,
self.at_drag_begin, self.at_drag_data_received)
self.set_list_dnd(self.addr_list, self.ad_drag_data_get,
self.ad_drag_begin, self.ad_drag_data_received)
self.gladeif.connect("edit_person", "delete_event", self.on_delete_event)
self.gladeif.connect("button15", "clicked", self.on_cancel_edit)
self.gladeif.connect("ok", "clicked", self.on_apply_person_clicked)
self.gladeif.connect("button134", "clicked", self.on_help_clicked)
self.gladeif.connect("notebook", "switch_page", self.on_switch_page)
# self.gladeif.connect("genderMale", "toggled", self.on_gender_activate)
# self.gladeif.connect("genderFemale", "toggled", self.on_gender_activate)
# self.gladeif.connect("genderUnknown", "toggled", self.on_gender_activate)
# self.gladeif.connect("notebook", "switch_page", self.on_switch_page)
self.gladeif.connect("given_name", "focus_out_event", self.on_given_focus_out_event)
self.gladeif.connect("button177", "clicked", self.on_edit_name_clicked)
# self.gladeif.connect("button99", "clicked", self.on_edit_birth_clicked)
# self.gladeif.connect("button126", "clicked", self.on_edit_death_clicked)
# self.gladeif.connect("aka_add", "clicked", self.on_add_aka_clicked)
# self.gladeif.connect("aka_edit", "clicked", self.on_aka_update_clicked)
# self.gladeif.connect("aka_delete", "clicked", self.on_aka_delete_clicked)
# self.gladeif.connect("event_add", "clicked" , self.on_event_add_clicked)
# self.gladeif.connect("event_edit_btn", "clicked" ,self.on_event_update_clicked)
# self.gladeif.connect("event_del", "clicked", self.on_event_delete_clicked)
# self.gladeif.connect("attr_add", "clicked" , self.on_add_attr_clicked)
# self.gladeif.connect("attr_edit_btn", "clicked", self.on_update_attr_clicked)
# self.gladeif.connect("attr_del", "clicked", self.on_delete_attr_clicked)
# self.gladeif.connect("addr_add", "clicked", self.on_add_addr_clicked)
# self.gladeif.connect("addr_edit_btn", "clicked", self.on_update_addr_clicked)
# self.gladeif.connect("addr_del", "clicked", self.on_delete_addr_clicked)
# self.gladeif.connect("media_add", "clicked", self.gallery.on_add_media_clicked)
# self.gladeif.connect("media_sel", "clicked", self.gallery.on_select_media_clicked)
# self.gladeif.connect("image_edit_btn", "clicked", self.gallery.on_edit_media_clicked)
# self.gladeif.connect("media_del", "clicked", self.gallery.on_delete_media_clicked)
# self.gladeif.connect("add_url", "clicked", self.on_add_url_clicked)
# self.gladeif.connect("edit_url", "clicked", self.on_update_url_clicked,)
# self.gladeif.connect("web_go", "clicked", self.on_web_go_clicked)
# self.gladeif.connect("delete_url", "clicked", self.on_delete_url_clicked)
# self.gladeif.connect("button131", "clicked", self.on_ldsbap_source_clicked,)
# self.gladeif.connect("button128", "clicked", self.on_ldsbap_note_clicked)
# self.gladeif.connect("button132", "clicked", self.on_ldsendow_source_clicked)
# self.gladeif.connect("button129", "clicked", self.on_ldsendow_note_clicked)
# self.gladeif.connect("button133", "clicked", self.on_ldsseal_source_clicked)
# self.gladeif.connect("button130", "clicked", self.on_ldsseal_note_clicked)
self.sourcetab = Sources.SourceTab(self.state, self.uistate, self.track,
self.srcreflist, self, self.top, self.window, self.slist,
self.top.get_widget('add_src'), self.top.get_widget('edit_src'),
self.top.get_widget('del_src'), self.db.readonly)
self.private.set_active(self.person.get_privacy())
self.eventbox.connect('button-press-event',self.image_button_press)
self.event_box.redraw()
self.attr_box.redraw()
self.addr_box.redraw()
self.name_box.redraw()
self.url_box.redraw()
self.top.get_widget("notebook").set_current_page(0)
self.given.grab_focus()
self.notebook = gtk.Notebook()
self.vbox.pack_start(self.notebook,True)
self.notebook.show_all()
for i in ["ok", "add_aka", "aka_delete", "event_del",
"event_add", "attr_add", "attr_del", "addr_add",
"addr_del", "media_add", "media_sel", "media_del",
"add_url", "delete_url", "add_src", "del_src" ]:
widget = self.top.get_widget(i)
if widget:
widget.set_sensitive(not self.db.readonly)
self.event_list = EventEmbedList(self.dbstate,self.uistate,
self.track,self.person)
self.name_list = NameEmbedList(self.dbstate,self.uistate,
self.track,self.person.get_alternate_names())
self.srcref_list = SourceEmbedList(self.dbstate,self.uistate,
self.track,self.person.source_list)
self.attr_list = AttrEmbedList(self.dbstate,self.uistate,self.track,
self.person.get_attribute_list())
self.addr_list = AddrEmbedList(self.dbstate,self.uistate,self.track,
self.person.get_address_list())
self.note_tab = NoteTab(self.dbstate, self.uistate, self.track,
self.person.get_note_object())
self.gallery_tab = GalleryTab(self.dbstate, self.uistate, self.track,
self.person.get_media_list())
self.web_list = WebEmbedList(self.dbstate,self.uistate,self.track,
self.person.get_url_list())
self.notebook.insert_page(self.event_list)
self.notebook.set_tab_label(self.event_list,self.event_list.get_tab_widget())
self.notebook.insert_page(self.name_list)
self.notebook.set_tab_label(self.name_list,self.name_list.get_tab_widget())
self.notebook.insert_page(self.attr_list)
self.notebook.set_tab_label(self.attr_list,self.attr_list.get_tab_widget())
self.notebook.insert_page(self.addr_list)
self.notebook.set_tab_label(self.addr_list,self.addr_list.get_tab_widget())
self.notebook.insert_page(self.note_tab)
self.notebook.set_tab_label(self.note_tab,self.note_tab.get_tab_widget())
self.notebook.insert_page(self.srcref_list)
self.notebook.set_tab_label(self.srcref_list,self.srcref_list.get_tab_widget())
self.notebook.insert_page(self.gallery_tab)
self.notebook.set_tab_label(self.gallery_tab,self.gallery_tab.get_tab_widget())
self.notebook.insert_page(self.web_list)
self.notebook.set_tab_label(self.web_list,self.web_list.get_tab_widget())
self.given.grab_focus()
self.show()
def build_menu_names(self,person):
@ -471,19 +330,6 @@ class EditPerson(DisplayState.ManagedWindow):
data = cursor.next()
cursor.close()
def build_gallery(self,container):
self.iconmodel = gtk.ListStore(gtk.gdk.Pixbuf,str)
self.iconlist = gtk.IconView(self.iconmodel)
self.iconlist.set_pixbuf_column(0)
self.iconlist.set_text_column(1)
self.iconlist.show()
container.add(self.iconlist)
for ref in self.person.get_media_list():
obj = self.db.get_object_from_handle(ref.get_reference_handle())
pixbuf = self.get_image(obj)
self.iconmodel.append(row=[pixbuf,obj.get_description()])
def get_image(self,obj):
import ImgManip
@ -726,210 +572,6 @@ class EditPerson(DisplayState.ManagedWindow):
def set_lds_seal(self,obj):
self.lds_sealing.set_status(obj.get_active())
def name_drag_data_get(self,widget, context, sel_data, info, time):
name = self.ntree.get_selected_objects()
if not name:
return
bits_per = 8; # we're going to pass a string
pickled = pickle.dumps(name[0]);
data = str((DdTargets.NAME.drag_type,self.person.get_handle(),pickled));
sel_data.set(sel_data.target, bits_per, data)
def name_drag_begin(self, context, a):
return
icon = self.ntree.get_icon()
t = self.ntree.tree
(x,y) = icon.get_size()
mask = gtk.gdk.Pixmap(self.window.window,x,y,1)
mask.draw_rectangle(t.get_style().white_gc, True, 0,0,x,y)
t.drag_source_set_icon(t.get_colormap(),icon,mask)
def name_drag_data_received(self,widget,context,x,y,sel_data,info,time):
if self.db.readonly: # no DnD on readonly database
return
row = self.ntree.get_row_at(x,y)
if sel_data and sel_data.data:
exec 'data = %s' % sel_data.data
exec 'mytype = "%s"' % data[0]
exec 'person = "%s"' % data[1]
if mytype != DdTargets.NAME.drag_type:
return
elif person == self.person.get_handle():
self.move_element(self.nlist,self.ntree.get_selected_row(),row)
else:
foo = pickle.loads(data[2]);
for src in foo.get_source_references():
base_handle = src.get_base_handle()
newbase = self.db.get_source_from_handle(base_handle)
src.set_base_handle(newbase.get_handle())
self.nlist.insert(row,foo)
self.lists_changed = True
self.redraw_name_list()
def ev_drag_data_received(self,widget,context,x,y,sel_data,info,time):
if self.db.readonly: # no DnD on readonly database
return
row = self.etree.get_row_at(x,y)
if sel_data and sel_data.data:
exec 'data = %s' % sel_data.data
exec 'mytype = "%s"' % data[0]
exec 'person = "%s"' % data[1]
if mytype != DdTargets.EVENT.drag_type:
return
elif person == self.person.get_handle():
self.move_element(self.elist,self.etree.get_selected_row(),row)
else:
foo = pickle.loads(data[2]);
for src in foo.get_source_references():
base_handle = src.get_base_handle()
newbase = self.db.get_source_from_handle(base_handle)
src.set_base_handle(newbase.get_handle())
place = foo.get_place_handle()
if place:
foo.set_place_handle(place.get_handle())
self.elist.insert(row,foo.get_handle())
self.lists_changed = True
self.redraw_event_list()
def move_element(self,list,src,dest):
if src == -1:
return
obj = list[src]
list.remove(obj)
list.insert(dest,obj)
def ev_drag_data_get(self,widget, context, sel_data, info, time):
ev = self.etree.get_selected_objects()
if not ev:
return
bits_per = 8; # we're going to pass a string
pickled = pickle.dumps(ev[0]);
data = str((DdTargets.EVENT.drag_type,self.person.get_handle(),pickled));
sel_data.set(sel_data.target, bits_per, data)
def ev_drag_begin(self, context, a):
return
icon = self.etree.get_icon()
t = self.etree.tree
(x,y) = icon.get_size()
mask = gtk.gdk.Pixmap(self.window.window,x,y,1)
mask.draw_rectangle(t.get_style().white_gc, True, 0,0,x,y)
t.drag_source_set_icon(t.get_colormap(),icon,mask)
def url_drag_data_received(self,widget,context,x,y,sel_data,info,time):
if self.db.readonly: # no DnD on readonly database
return
row = self.wtree.get_row_at(x,y)
if sel_data and sel_data.data:
exec 'data = %s' % sel_data.data
exec 'mytype = "%s"' % data[0]
exec 'person = "%s"' % data[1]
if mytype != DdTargets.URL.drag_type:
return
elif person == self.person.get_handle():
self.move_element(self.ulist,self.wtree.get_selected_row(),row)
else:
foo = pickle.loads(data[2]);
self.ulist.append(foo)
self.lists_changed = True
self.redraw_url_list()
def url_drag_begin(self, context, a):
return
def url_drag_data_get(self,widget, context, sel_data, info, time):
ev = self.wtree.get_selected_objects()
if len(ev):
bits_per = 8; # we're going to pass a string
pickled = pickle.dumps(ev[0]);
data = str((DdTargets.URL.drag_type,self.person.get_handle(),pickled));
sel_data.set(sel_data.target, bits_per, data)
def at_drag_data_received(self,widget,context,x,y,sel_data,info,time):
if self.db.readonly: # no DnD on readonly database
return
row = self.atree.get_row_at(x,y)
if sel_data and sel_data.data:
exec 'data = %s' % sel_data.data
exec 'mytype = "%s"' % data[0]
exec 'person = "%s"' % data[1]
if mytype != DdTargets.ATTRIBUTE.drag_type:
return
elif person == self.person.get_handle():
self.move_element(self.alist,self.atree.get_selected_row(),row)
else:
foo = pickle.loads(data[2]);
for src in foo.get_source_references():
base_handle = src.get_base_handle()
newbase = self.db.get_source_from_handle(base_handle)
src.set_base_handle(newbase.get_handle())
self.alist.append(foo)
self.lists_changed = True
self.redraw_attr_list()
def at_drag_begin(self, context, a):
return
def at_drag_data_get(self,widget, context, sel_data, info, time):
ev = self.atree.get_selected_objects()
if len(ev):
bits_per = 8; # we're going to pass a string
pickled = pickle.dumps(ev[0]);
data = str((DdTargets.ATTRIBUTE.drag_type,
self.person.get_handle(),pickled));
sel_data.set(sel_data.target, bits_per, data)
def ad_drag_data_received(self,widget,context,x,y,sel_data,info,time):
if self.db.readonly: # no DnD on readonly database
return
row = self.ptree.get_row_at(x,y)
if sel_data and sel_data.data:
exec 'data = %s' % sel_data.data
exec 'mytype = "%s"' % data[0]
exec 'person = "%s"' % data[1]
if mytype != DdTargets.ADDRESS.drag_type:
return
elif person == self.person.get_handle():
self.move_element(self.plist,self.ptree.get_selected_row(),row)
else:
foo = pickle.loads(data[2]);
for src in foo.get_source_references():
base_handle = src.get_base_handle()
newbase = self.db.get_source_from_handle(base_handle)
src.set_base_handle(newbase.get_handle())
self.plist.insert(row,foo)
self.lists_changed = True
self.redraw_addr_list()
def ad_drag_data_get(self,widget, context, sel_data, info, time):
ev = self.ptree.get_selected_objects()
if len(ev):
bits_per = 8; # we're going to pass a string
pickled = pickle.dumps(ev[0]);
data = str((DdTargets.ADDRESS.drag_type,
self.person.get_handle(),pickled));
sel_data.set(sel_data.target, bits_per, data)
def ad_drag_begin(self, context, a):
return
def menu_changed(self,obj):
self.ldsfam = self.lds_fam_list[obj.get_active()]
@ -940,26 +582,6 @@ class EditPerson(DisplayState.ManagedWindow):
text = text.rstrip()
return text
def on_up_clicked(self,obj):
sel = obj.get_selection()
store,node = sel.get_selected()
if node:
row = store.get_path(node)
sel.select_path((row[0]-1))
def on_down_clicked(self,obj):
sel = obj.get_selection()
store,node = sel.get_selected()
if node:
row = store.get_path(node)
sel.select_path((row[0]+1))
def on_web_go_clicked(self,obj):
"""Attempts to display the selected URL in a web browser"""
text = self.web_url.get()
if text:
GrampsDisplay.url(text)
def on_cancel_edit(self,obj):
"""If the data has changed, give the user a chance to cancel
the close window"""
@ -1000,6 +622,7 @@ class EditPerson(DisplayState.ManagedWindow):
"""Check to see if any of the data has changed from the
orig record"""
return False
surname = unicode(self.surname.get_text())
ntype = self.ntype_selector.get_values()
@ -1136,26 +759,6 @@ class EditPerson(DisplayState.ManagedWindow):
except:
self.person_photo.hide()
def update_lists(self):
"""Updates the person's lists if anything has changed"""
self.person.set_alternate_names(self.name_box.data)
self.person.set_url_list(self.url_box.data)
self.person.set_attribute_list(self.attr_box.data)
self.person.set_address_list(self.addr_box.data)
self.person.set_birth_ref(None)
self.person.set_death_ref(None)
eref_list = self.event_box.data[:]
for (event_ref,event) in eref_list:
if event.get_type()[0] == RelLib.Event.BIRTH:
self.person.set_birth_ref(event_ref)
self.event_box.data.remove((event_ref,event))
if event.get_type()[0] == RelLib.Event.DEATH:
self.person.set_death_ref(event_ref)
self.event_box.data.remove((event_ref,event))
eref_list = [event_ref for (event_ref,event) in self.event_box.data]
self.person.set_event_ref_list(eref_list)
def on_apply_person_clicked(self,obj):
if self.gender.get_active() == RelLib.Person.UNKNOWN:
@ -1359,13 +962,13 @@ class EditPerson(DisplayState.ManagedWindow):
self.pname.set_first_name(unicode(self.given.get_text()))
self.pname.set_title(unicode(self.title.get_text()))
NameEdit.NameEditor(self.state, self.uistate, self.track, self.pname, self)
NameEdit.NameEditor(self.dbstate, self.uistate, self.track, self.pname, self)
def update_name(self,name):
self.write_primary_name()
def on_ldsbap_source_clicked(self,obj):
Sources.SourceSelector(self.state, self.uistate, self.track,
Sources.SourceSelector(self.dbstate, self.uistate, self.track,
self.lds_baptism.get_source_references(),
self,self.update_ldsbap_list)
@ -1378,7 +981,7 @@ class EditPerson(DisplayState.ManagedWindow):
readonly=self.db.readonly)
def on_ldsendow_source_clicked(self,obj):
Sources.SourceSelector(self.state, self.uitstate, self.track,
Sources.SourceSelector(self.dbstate, self.uitstate, self.track,
self.lds_endowment.get_source_references(),
self,self.set_ldsendow_list)
@ -1391,7 +994,7 @@ class EditPerson(DisplayState.ManagedWindow):
readonly=self.db.readonly)
def on_ldsseal_source_clicked(self,obj):
Sources.SourceSelector(self.state, self.uistate, self.track,
Sources.SourceSelector(self.dbstate, self.uistate, self.track,
self.lds_sealing.get_source_references(),
self,self.lds_seal_list)
@ -1418,31 +1021,6 @@ class EditPerson(DisplayState.ManagedWindow):
else:
self.load_photo(None)
def on_switch_page(self,obj,a,page):
if page == 0:
self.load_person_image()
self.event_box.redraw()
elif page == 6 and self.not_loaded:
self.not_loaded = False
elif page == 8 and self.lds_not_loaded:
self.lds_not_loaded = False
self.draw_lds()
note_buf = self.notes_buffer
text = unicode(note_buf.get_text(note_buf.get_start_iter(),
note_buf.get_end_iter(),False))
if text:
Utils.bold_label(self.notes_label)
else:
Utils.unbold_label(self.notes_label)
if not self.lds_not_loaded:
self.check_lds()
if (self.lds_baptism.is_empty() and self.lds_endowment.is_empty()
and self.lds_sealing.is_empty()):
Utils.unbold_label(self.lds_tab)
else:
Utils.bold_label(self.lds_tab)
def change_name(self,obj):
sel_objs = self.ntree.get_selected_objects()
if sel_objs:

View File

@ -2172,7 +2172,7 @@ class GedcomParser:
n = matches[3].strip()
if self.gedattr.has_key(n):
attr = RelLib.Attribute()
attr.set_type((RelLib.Event.CUSTOM,self.gedattr[n]))
attr.set_type((self.gedattr[n],''))
attr.set_value(matches[2])
state.person.add_attribute(attr)
self.parse_person_attr(attr,2)

View File

@ -858,7 +858,7 @@ class ViewManager:
ScratchPad.ScratchPadWindow(self.state, self)
def pulse_progressbar(self,value):
self.progress.set_fraction(value/100.0)
self.progress.set_fraction(min(value/100.0,1.0))
self.progress.set_text("%d%%" % value)
while gtk.events_pending():
gtk.main_iteration()

File diff suppressed because it is too large Load Diff