EditPerson fixes, list model enhancements

svn: r1189
This commit is contained in:
Don Allingham 2002-11-15 03:49:39 +00:00
parent 70256ded9c
commit aac28fa291
11 changed files with 76 additions and 274 deletions

View File

@ -36,6 +36,8 @@ import gtk
import gnome.ui import gnome.ui
import gtk.glade import gtk.glade
from gtk.gdk import ACTION_COPY, BUTTON1_MASK, INTERP_BILINEAR, pixbuf_new_from_file
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# gramps modules # gramps modules
@ -153,7 +155,7 @@ class EditPerson:
self.event_src_field = self.get_widget("event_srcinfo") self.event_src_field = self.get_widget("event_srcinfo")
self.event_conf_field = self.get_widget("event_conf") self.event_conf_field = self.get_widget("event_conf")
self.attr_conf_field = self.get_widget("attr_conf") self.attr_conf_field = self.get_widget("attr_conf")
self.addr_conf_field = self.get_widget("attr_conf") self.addr_conf_field = self.get_widget("addr_conf")
self.name_conf_field = self.get_widget("name_conf") self.name_conf_field = self.get_widget("name_conf")
self.attr_src_field = self.get_widget("attr_srcinfo") self.attr_src_field = self.get_widget("attr_srcinfo")
self.name_src_field = self.get_widget("name_srcinfo") self.name_src_field = self.get_widget("name_srcinfo")
@ -260,20 +262,6 @@ class EditPerson:
self.event_list = self.get_widget("eventList") self.event_list = self.get_widget("eventList")
if GrampsCfg.display_attr:
self.get_widget("user_label").set_text(GrampsCfg.attr_name)
val = ""
for attr in self.person.getAttributeList():
if attr.getType() == const.save_pattr(GrampsCfg.attr_name):
val = attr.getValue()
break
self.get_widget("user_data").set_text(val)
self.get_widget("user_colon").show()
else:
self.get_widget("user_label").hide()
self.get_widget("user_colon").hide()
self.get_widget("user_data").hide()
self.lds_baptism = LdsOrd(self.person.getLdsBaptism()) self.lds_baptism = LdsOrd(self.person.getLdsBaptism())
self.lds_endowment = LdsOrd(self.person.getLdsEndowment()) self.lds_endowment = LdsOrd(self.person.getLdsEndowment())
self.lds_sealing = LdsOrd(self.person.getLdsSeal()) self.lds_sealing = LdsOrd(self.person.getLdsSeal())
@ -304,34 +292,33 @@ class EditPerson:
self.notes_buffer = self.notes_field.get_buffer() self.notes_buffer = self.notes_field.get_buffer()
self.notes_buffer.set_text(person.getNote()) self.notes_buffer.set_text(person.getNote())
self.event_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,gtk.gdk.ACTION_COPY) self.event_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,ACTION_COPY)
self.event_list.drag_source_set(gtk.gdk.BUTTON1_MASK, pycode_tgts, gtk.gdk.ACTION_COPY) self.event_list.drag_source_set(BUTTON1_MASK, pycode_tgts, ACTION_COPY)
self.event_list.connect('drag_data_get', self.ev_drag_data_get) self.event_list.connect('drag_data_get', self.ev_drag_data_get)
self.event_list.connect('drag_data_received', self.event_list.connect('drag_data_received',
self.ev_drag_data_received) self.ev_drag_data_received)
# self.web_list.drag_dest_set(gtk.DEST_DEFAULT_ALL, self.web_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,ACTION_COPY)
# pycode_tgts,ACTION_COPY) self.web_list.drag_source_set(BUTTON1_MASK, pycode_tgts, ACTION_COPY)
# self.web_list.drag_source_set(BUTTON1_MASK, pycode_tgts, gtk.gdk.ACTION_COPY) self.web_list.connect('drag_data_get', self.url_drag_data_get)
# self.web_list.connect('drag_data_get', self.url_drag_data_get) self.web_list.connect('drag_data_received',
# self.web_list.connect('drag_data_received', self.url_drag_data_received)
# self.url_drag_data_received)
# self.attr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts, self.attr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,
# gtk.gdk.ACTION_COPY) ACTION_COPY)
# self.attr_list.drag_source_set(gtk.gdk.BUTTON1_MASK, pycode_tgts, self.attr_list.drag_source_set(BUTTON1_MASK, pycode_tgts,
# gtk.gdk.ACTION_COPY) ACTION_COPY)
# self.attr_list.connect('drag_data_get', self.at_drag_data_get) self.attr_list.connect('drag_data_get', self.at_drag_data_get)
# self.attr_list.connect('drag_data_received', self.attr_list.connect('drag_data_received',
# self.at_drag_data_received) self.at_drag_data_received)
# self.addr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL, self.addr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,
# pycode_tgts,ACTION_COPY) pycode_tgts,ACTION_COPY)
# self.addr_list.drag_source_set(gtk.gdk.BUTTON1_MASK, pycode_tgts, self.addr_list.drag_source_set(BUTTON1_MASK, pycode_tgts,
# gtk.gdk.ACTION_COPY) ACTION_COPY)
# self.addr_list.connect('drag_data_get', self.ad_drag_data_get) self.addr_list.connect('drag_data_get', self.ad_drag_data_get)
# self.addr_list.connect('drag_data_received', self.addr_list.connect('drag_data_received',
# self.ad_drag_data_received) self.ad_drag_data_received)
self.redraw_event_list() self.redraw_event_list()
self.redraw_attr_list() self.redraw_attr_list()
@ -1088,12 +1075,12 @@ class EditPerson:
self.get_widget("personPix").hide() self.get_widget("personPix").hide()
else: else:
try: try:
i = gtk.gdk.pixbuf_new_from_file(photo) i = pixbuf_new_from_file(photo)
ratio = float(max(i.get_height(),i.get_width())) ratio = float(max(i.get_height(),i.get_width()))
scale = float(const.picWidth)/ratio scale = float(const.picWidth)/ratio
x = int(scale*(i.get_width())) x = int(scale*(i.get_width()))
y = int(scale*(i.get_height())) y = int(scale*(i.get_height()))
i = i.scale_simple(x,y,gtk.gdk.INTERP_BILINEAR) i = i.scale_simple(x,y,INTERP_BILINEAR)
self.get_widget("personPix").set_from_pixbuf(i) self.get_widget("personPix").set_from_pixbuf(i)
self.get_widget("personPix").show() self.get_widget("personPix").show()
except: except:

View File

@ -162,8 +162,8 @@ class FamilyView:
return return
try: try:
SelectChild.SelectChild(self.parent.db, self.family, SelectChild.SelectChild(self.parent.db, self.family,
self.person, self.person, self.load_family,
self.load_family) self.parent.update_person_list)
except: except:
DisplayTrace.DisplayTrace() DisplayTrace.DisplayTrace()

View File

@ -67,6 +67,9 @@ class ListModel:
def clear(self): def clear(self):
self.model.clear() self.model.clear()
def remove(self,iter):
self.model.remove(iter)
def get_object(self,iter): def get_object(self,iter):
return self.model.get_value(iter,self.data_index) return self.model.get_value(iter,self.data_index)
@ -78,6 +81,15 @@ class ListModel:
col = col + 1 col = col + 1
self.model.set_value(iter,col,info) self.model.set_value(iter,col,info)
def add_and_select(self,data,info=None):
iter = self.model.append()
col = 0
for object in data:
self.model.set_value(iter,col,object)
col = col + 1
self.model.set_value(iter,col,info)
self.selection.select_iter(iter)
def button_press(self,obj,event): def button_press(self,obj,event):
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
self.double_click(obj) self.double_click(obj)

View File

@ -48,13 +48,12 @@ class QuickAdd:
name = person.getPrimaryName() name = person.getPrimaryName()
name.setSurname(surname) name.setSurname(surname)
name.setFirstName(given) name.setFirstName(given)
self.db.addPerson(person)
if self.xml.get_widget("male").get_active(): if self.xml.get_widget("male").get_active():
person.setGender(RelLib.Person.male) person.setGender(RelLib.Person.male)
self.father = person
else: else:
person.setGender(RelLib.Person.female) person.setGender(RelLib.Person.female)
self.mother = person self.db.addPerson(person)
Utils.modified() Utils.modified()
Utils.destroy_passed_object(self.window) Utils.destroy_passed_object(self.window)
self.callback(person) self.callback(person)

View File

@ -60,11 +60,12 @@ import ListModel
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class SelectChild: class SelectChild:
def __init__(self,db,family,person,redraw): def __init__(self,db,family,person,redraw,add_person):
self.db = db self.db = db
self.person = person self.person = person
self.family = family self.family = family
self.redraw = redraw self.redraw = redraw
self.add_person = add_person
self.xml = gtk.glade.XML(const.gladeFile,"selectChild") self.xml = gtk.glade.XML(const.gladeFile,"selectChild")
self.xml.signal_autoconnect({ self.xml.signal_autoconnect({
@ -108,9 +109,10 @@ class SelectChild:
self.frel.set_text(_("Birth")) self.frel.set_text(_("Birth"))
self.refmodel = ListModel.ListModel(self.add_child,[(_('Name'),150,3),(_('ID'),50,1), titles = [(_('Name'),3,150),(_('ID'),1,50), (_('Birth Date'),4,100),
(_('Birth Date'),100,4), ('',-1,0),('',-1,0)]
('',0,0),('',0,0)])
self.refmodel = ListModel.ListModel(self.add_child,titles)
self.redraw_child_list(2) self.redraw_child_list(2)
self.top.show() self.top.show()
@ -233,6 +235,7 @@ class SelectChild:
depending on the gender of the person.""" depending on the gender of the person."""
id = person.getId() id = person.getId()
dinfo = self.db.getPersonDisplay(id) dinfo = self.db.getPersonDisplay(id)
print dinfo
rdata = [dinfo[0],dinfo[1],dinfo[3],dinfo[5],dinfo[6]] rdata = [dinfo[0],dinfo[1],dinfo[3],dinfo[5],dinfo[6]]
self.refmodel.add(rdata) self.refmodel.add_and_select(rdata)
self.add_person(person)

View File

@ -1243,37 +1243,12 @@
<child> <child>
<widget class="GtkTable" id="table18"> <widget class="GtkTable" id="table18">
<property name="visible">True</property> <property name="visible">True</property>
<property name="n_rows">2</property> <property name="n_rows">1</property>
<property name="n_columns">3</property> <property name="n_columns">3</property>
<property name="homogeneous">False</property> <property name="homogeneous">False</property>
<property name="row_spacing">0</property> <property name="row_spacing">0</property>
<property name="column_spacing">0</property> <property name="column_spacing">0</property>
<child>
<widget class="GtkLabel" id="user_data">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_padding">5</property>
<property name="y_padding">5</property>
<property name="y_options"></property>
</packing>
</child>
<child> <child>
<widget class="GtkLabel" id="label152"> <widget class="GtkLabel" id="label152">
<property name="visible">True</property> <property name="visible">True</property>
@ -1300,32 +1275,6 @@
</packing> </packing>
</child> </child>
<child>
<widget class="GtkLabel" id="user_label">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">1</property>
<property name="yalign">0.5</property>
<property name="xpad">5</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_padding">5</property>
<property name="y_padding">5</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child> <child>
<widget class="GtkLabel" id="label240"> <widget class="GtkLabel" id="label240">
<property name="visible">True</property> <property name="visible">True</property>
@ -1350,30 +1299,6 @@
</packing> </packing>
</child> </child>
<child>
<widget class="GtkLabel" id="user_colon">
<property name="visible">True</property>
<property name="label" translatable="yes">:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child> <child>
<widget class="GtkEntry" id="gid"> <widget class="GtkEntry" id="gid">
<property name="visible">True</property> <property name="visible">True</property>

View File

@ -22,14 +22,16 @@
import Filter import Filter
from RelLib import Person from RelLib import Person
import intl from intl import gettext as _
_ = intl.gettext
class HaveAltFamilies(Filter.Filter): class HaveAltFamilies(Filter.Filter):
"People who were adopted" "People who were adopted"
def match(self,person): def match(self,person):
return len(person.getParentList()) > 1 for vals in person.getParentList():
if vals[1] == "Adopted" or vals[2] == "Adopted":
return 1
return 0
Filter.register_filter(HaveAltFamilies, Filter.register_filter(HaveAltFamilies,

View File

@ -1140,7 +1140,6 @@
<property name="rules_hint">True</property> <property name="rules_hint">True</property>
<property name="reorderable">False</property> <property name="reorderable">False</property>
<property name="enable_search">True</property> <property name="enable_search">True</property>
<signal name="event" handler="on_person_list_button_press" last_modification_time="Thu, 12 Sep 2002 01:52:15 GMT"/>
</widget> </widget>
</child> </child>
</widget> </widget>
@ -6074,6 +6073,7 @@
<property name="window_position">GTK_WIN_POS_NONE</property> <property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property> <property name="modal">False</property>
<property name="default_width">300</property> <property name="default_width">300</property>
<property name="default_height">200</property>
<property name="resizable">True</property> <property name="resizable">True</property>
<property name="destroy_with_parent">False</property> <property name="destroy_with_parent">False</property>
<property name="has_separator">True</property> <property name="has_separator">True</property>

View File

@ -97,14 +97,8 @@ class Gramps:
self.program = gnome.program_init("gramps",const.version) self.program = gnome.program_init("gramps",const.version)
self.DataFilter = Filter.Filter("") self.DataFilter = Filter.Filter("")
self.active_child = None
self.active_family = None
self.active_father = None
self.active_mother = None
self.active_parents = None
self.parents_index = 0 self.parents_index = 0
self.active_person = None self.active_person = None
self.active_spouse = None
self.bookmarks = None self.bookmarks = None
self.c_details = 6 self.c_details = 6
self.id2col = {} self.id2col = {}
@ -290,9 +284,6 @@ class Gramps:
"on_alpha_switch_page" : self.change_alpha_page, "on_alpha_switch_page" : self.change_alpha_page,
"delete_event" : self.delete_event, "delete_event" : self.delete_event,
"destroy_passed_object" : Utils.destroy_passed_object, "destroy_passed_object" : Utils.destroy_passed_object,
"on_family_up_clicked" : self.family_up_clicked,
"on_family_down_clicked" : self.family_down_clicked,
"on_spouse_list_changed" : self.spouse_list_changed,
"on_about_activate" : self.on_about_activate, "on_about_activate" : self.on_about_activate,
"on_add_bookmark_activate" : self.on_add_bookmark_activate, "on_add_bookmark_activate" : self.on_add_bookmark_activate,
"on_add_place_clicked" : self.place_view.on_add_place_clicked, "on_add_place_clicked" : self.place_view.on_add_place_clicked,
@ -324,7 +315,6 @@ class Gramps:
"on_open_activate" : self.on_open_activate, "on_open_activate" : self.on_open_activate,
"on_pedigree1_activate" : self.on_pedigree1_activate, "on_pedigree1_activate" : self.on_pedigree1_activate,
"on_person_list1_activate" : self.on_person_list1_activate, "on_person_list1_activate" : self.on_person_list1_activate,
"on_person_list_button_press" : self.alpha_event,
"on_main_key_release_event" : self.on_main_key_release_event, "on_main_key_release_event" : self.on_main_key_release_event,
"on_add_media_clicked" : self.media_view.create_add_dialog, "on_add_media_clicked" : self.media_view.create_add_dialog,
"on_media_activate" : self.on_media_activate, "on_media_activate" : self.on_media_activate,
@ -337,7 +327,6 @@ class Gramps:
"on_places_activate" : self.on_places_activate, "on_places_activate" : self.on_places_activate,
"on_preferences_activate" : self.on_preferences_activate, "on_preferences_activate" : self.on_preferences_activate,
"on_reload_plugins_activate" : Plugins.reload_plugins, "on_reload_plugins_activate" : Plugins.reload_plugins,
"on_remove_child_clicked" : self.on_remove_child_clicked,
"on_reports_clicked" : self.on_reports_clicked, "on_reports_clicked" : self.on_reports_clicked,
"on_revert_activate" : self.on_revert_activate, "on_revert_activate" : self.on_revert_activate,
"on_save_activate" : self.on_save_activate, "on_save_activate" : self.on_save_activate,
@ -345,7 +334,6 @@ class Gramps:
"on_show_plugin_status" : self.on_show_plugin_status, "on_show_plugin_status" : self.on_show_plugin_status,
"on_source_list_button_press" : self.source_view.button_press, "on_source_list_button_press" : self.source_view.button_press,
"on_sources_activate" : self.on_sources_activate, "on_sources_activate" : self.on_sources_activate,
"on_swap_clicked" : self.on_swap_clicked,
"on_tools_clicked" : self.on_tools_clicked, "on_tools_clicked" : self.on_tools_clicked,
"on_gramps_home_page_activate" : self.on_gramps_home_page_activate, "on_gramps_home_page_activate" : self.on_gramps_home_page_activate,
"on_gramps_report_bug_activate" : self.on_gramps_report_bug_activate, "on_gramps_report_bug_activate" : self.on_gramps_report_bug_activate,
@ -576,31 +564,6 @@ class Gramps:
url = "gnome-help:"+url url = "gnome-help:"+url
gnome.help.goto(url) gnome.help.goto(url)
def on_remove_child_clicked(self,obj):
if not self.active_family or not self.active_child or not self.active_person:
return
self.active_family.removeChild(self.active_child)
self.active_child.removeAltFamily(self.active_child)
if len(self.active_family.getChildList()) == 0:
if self.active_family.getFather() == None:
self.delete_family_from(self.active_family.getMother())
elif self.active_family.getMother() == None:
self.delete_family_from(self.active_family.getFather())
Utils.modified()
self.family_view.load_family()
def delete_family_from(self,person):
person.removeFamily(self.active_family)
self.db.deleteFamily(self.active_family)
flist = self.active_person.getFamilyList()
if len(flist) > 0:
self.active_family = flist[0][0]
else:
self.active_family = None
def add_new_cancel(self,obj): def add_new_cancel(self,obj):
Utils.destroy_passed_object(self.addornew) Utils.destroy_passed_object(self.addornew)
@ -641,11 +604,6 @@ class Gramps:
self.topWindow.set_title("GRAMPS") self.topWindow.set_title("GRAMPS")
self.active_person = None self.active_person = None
self.active_father = None
self.active_family = None
self.active_mother = None
self.active_child = None
self.active_spouse = None
self.id2col = {} self.id2col = {}
Utils.clearModified() Utils.clearModified()
@ -939,9 +897,8 @@ class Gramps:
self.redisplay_person_list(p1) self.redisplay_person_list(p1)
self.update_display(0) self.update_display(0)
def alpha_event(self,obj,event): def alpha_event(self,obj):
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: self.load_person(self.active_person)
self.load_person(self.active_person)
def goto_active_person(self): def goto_active_person(self):
if not self.active_person: if not self.active_person:
@ -964,23 +921,10 @@ class Gramps:
self.statusbar.set_status("") self.statusbar.set_status("")
else: else:
pname = GrampsCfg.nameof(self.active_person) pname = GrampsCfg.nameof(self.active_person)
if GrampsCfg.status_bar == 1: name = "[%s] %s" % (self.active_person.getId(),pname)
name = "[%s] %s" % (self.active_person.getId(),pname)
elif GrampsCfg.status_bar == 2:
name = pname
for attr in self.active_person.getAttributeList():
if attr.getType() == GrampsCfg.attr_name:
name = "[%s] %s" % (attr.getValue(),pname)
break
else:
name = pname
self.statusbar.set_status(name) self.statusbar.set_status(name)
return 0 return 0
def on_child_list_select_row(self,obj,row,b,c):
id = obj.get_row_data(row)
self.active_child = id
def on_child_list_row_move(self,clist,fm,to): def on_child_list_row_move(self,clist,fm,to):
"""Validate whether or not this child can be moved within the clist. """Validate whether or not this child can be moved within the clist.
This routine is called in the middle of the clist's callbacks, so This routine is called in the middle of the clist's callbacks, so
@ -1083,11 +1027,6 @@ class Gramps:
file = self.db.getSavePath() file = self.db.getSavePath()
self.db.new() self.db.new()
self.active_person = None self.active_person = None
self.active_father = None
self.active_family = None
self.active_mother = None
self.active_child = None
self.active_spouse = None
self.id2col = {} self.id2col = {}
self.read_file(file) self.read_file(file)
Utils.clearModified() Utils.clearModified()
@ -1181,14 +1120,6 @@ class Gramps:
self.merge_button.set_sensitive(0) self.merge_button.set_sensitive(0)
self.media_view.load_media() self.media_view.load_media()
def on_swap_clicked(self,obj):
if not self.active_person:
return
if self.active_spouse:
self.change_active_person(self.active_spouse)
self.family_view.load_family()
def on_apply_filter_clicked(self,obj): def on_apply_filter_clicked(self,obj):
invert_filter = self.filter_inv.get_active() invert_filter = self.filter_inv.get_active()
qualifer = self.filter_text.get_text() qualifer = self.filter_text.get_text()
@ -1244,7 +1175,7 @@ class Gramps:
self.redisplay_person_list(person) self.redisplay_person_list(person)
self.update_display(0) self.update_display(0)
def redisplay_person_list(self,person): def add_to_person_list(self,person,change):
key = person.getId() key = person.getId()
val = self.db.getPersonDisplay(person.getId()) val = self.db.getPersonDisplay(person.getId())
pg = val[0] pg = val[0]
@ -1261,8 +1192,15 @@ class Gramps:
model.model.set(iter, 0, val[0], 1, val[1], 2, val[2], model.model.set(iter, 0, val[0], 1, val[1], 2, val[2],
3, val[3], 4, val[4], 5, val[5], 3, val[3], 4, val[4], 5, val[5],
6, val[6], 7, val[7]) 6, val[6], 7, val[7])
self.change_active_person(person) if change:
self.goto_active_person() self.change_active_person(person)
self.goto_active_person()
def redisplay_person_list(self,person):
self.add_to_person_list(person,1)
def update_person_list(self,person):
self.add_to_person_list(person,0)
def load_person(self,person): def load_person(self,person):
if person: if person:
@ -1271,30 +1209,6 @@ class Gramps:
except: except:
DisplayTrace.DisplayTrace() DisplayTrace.DisplayTrace()
def build_spouse_dropdown(self):
list = []
mymap = {}
mynmap = {}
sel = None
for f in self.active_person.getFamilyList():
if self.active_person == f.getFather():
sname = self.parent_name(f.getMother())
else:
sname = self.parent_name(f.getFather())
c = self.list_item(sname,f.getId())
list.append(c)
if f == self.active_family or sel == None:
sel = c
mynmap[f.getId()] = sname
mymap[f.getId()] = c
self.spouse_combo.disable_activate()
self.spouse_combo.list.clear_items(0,-1)
self.spouse_combo.list.append_items(list)
for v in mymap.keys():
self.spouse_combo.set_item_string(mymap[v],mynmap[v])
self.spouse_combo.list.select_child(sel)
def list_item(self,label,filter): def list_item(self,label,filter):
l = gtk.Label(label) l = gtk.Label(label)
l.set_alignment(0,0.5) l.set_alignment(0,0.5)
@ -1470,48 +1384,6 @@ class Gramps:
self.db.setDefaultPerson(self.active_person) self.db.setDefaultPerson(self.active_person)
Utils.modified() Utils.modified()
def family_up_clicked(self,obj):
if self.active_parents == None:
return
flist = self.active_person.getParentList()
if self.parents_index == 0:
self.parents_index = len(flist)-1
else:
self.parents_index = self.parents_index - 1
self.active_parents = flist[self.parents_index][0]
self.change_parents(self.active_parents)
def family_down_clicked(self,obj):
if self.active_parents == None:
return
flist = self.active_person.getParentList()
if self.parents_index == len(flist)-1:
self.parents_index = 0
else:
self.parents_index = self.parents_index + 1
self.active_parents = flist[self.parents_index][0]
self.change_parents(self.active_parents)
def spouse_list_changed(self,obj):
if self.active_family == None:
return
select = self.spouse_combo.list.get_selection()
if len(select) == 0:
self.active_family = None
else:
self.active_family = self.db.getFamily(select[0].get_data('d'))
if self.active_family == self.active_person.getFamilyList()[0]:
self.pref_spouse.set_sensitive(0)
msg = _("Preferred Relationship")
else:
msg = _("Relationship")
self.pref_spouse.set_sensitive(1)
self.gtop.get_widget('rel_frame').set_label(msg)
self.display_marriage(self.active_family)
def export_callback(self,obj,plugin_function): def export_callback(self,obj,plugin_function):
"""Call the export plugin, with the active person and database""" """Call the export plugin, with the active person and database"""
if self.active_person: if self.active_person:

View File

@ -204,7 +204,7 @@ class DisplayChart:
titles = [] titles = []
index = 0 index = 0
for v in self.event_titles: for v in self.event_titles:
titles.append((v,150,index)) titles.append((v,index,150))
index = index + 1 index = index + 1
self.list = ListModel.ListModel(self.eventlist,titles) self.list = ListModel.ListModel(self.eventlist,titles)

View File

@ -326,6 +326,8 @@
<property name="type">GTK_WINDOW_TOPLEVEL</property> <property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property> <property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property> <property name="modal">False</property>
<property name="default_width">350</property>
<property name="default_height">150</property>
<property name="resizable">True</property> <property name="resizable">True</property>
<property name="destroy_with_parent">False</property> <property name="destroy_with_parent">False</property>
<property name="has_separator">True</property> <property name="has_separator">True</property>
@ -383,7 +385,7 @@
<property name="ypad">0</property> <property name="ypad">0</property>
</widget> </widget>
<packing> <packing>
<property name="padding">0</property> <property name="padding">5</property>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
</packing> </packing>