* src/EditPerson.py: Call child editors with new arguments.
* src/EventEdit.py: Use new window management. * src/ListBox.py: Use new arguments. * src/PersonView.py: Add track argument to EditPerson. svn: r5547
This commit is contained in:
parent
c416e79e3a
commit
7f98e3bc35
@ -1,5 +1,9 @@
|
|||||||
2005-12-13 Alex Roitman <shura@gramps-project.org>
|
2005-12-13 Alex Roitman <shura@gramps-project.org>
|
||||||
* src/DisplayState.py: Correct and add comments.
|
* src/DisplayState.py: Correct and add comments.
|
||||||
|
* src/EditPerson.py: Call child editors with new arguments.
|
||||||
|
* src/EventEdit.py: Use new window management.
|
||||||
|
* src/ListBox.py: Use new arguments.
|
||||||
|
* src/PersonView.py: Add track argument to EditPerson.
|
||||||
|
|
||||||
2005-12-13 Don Allingham <don@gramps-project.org>
|
2005-12-13 Don Allingham <don@gramps-project.org>
|
||||||
* src/EditPerson.py: fix after merge
|
* src/EditPerson.py: fix after merge
|
||||||
|
@ -164,6 +164,7 @@ class GrampsWindowManager:
|
|||||||
def get_item_from_track(self,track):
|
def get_item_from_track(self,track):
|
||||||
# Recursively find an item given track sequence
|
# Recursively find an item given track sequence
|
||||||
item = self.window_tree
|
item = self.window_tree
|
||||||
|
print "track", track
|
||||||
for index in track:
|
for index in track:
|
||||||
item = item[index]
|
item = item[index]
|
||||||
return item
|
return item
|
||||||
@ -173,35 +174,33 @@ class GrampsWindowManager:
|
|||||||
# Return None if the ID is not found
|
# Return None if the ID is not found
|
||||||
return self.id2item.get(item_id,None)
|
return self.id2item.get(item_id,None)
|
||||||
|
|
||||||
def close_item(self,track):
|
def close_track(self,track):
|
||||||
# This is called when item needs to be closed
|
# This is called when item needs to be closed
|
||||||
# Closes all its children and then removes the item from the tree.
|
# Closes all its children and then removes the item from the tree.
|
||||||
|
print "1", track
|
||||||
item = self.get_item_from_track(track)
|
item = self.get_item_from_track(track)
|
||||||
last_item = self.close_item_recursively(item)
|
self.close_item(item)
|
||||||
# now we have the only surviving item from possibly a huge
|
# This only needs to be run once for the highest level point
|
||||||
# nested group of items
|
# to remove.
|
||||||
if last_item.window_id:
|
|
||||||
del self.id2item[last_item.window_id]
|
|
||||||
last_item.window.destroy()
|
|
||||||
self.remove_item(track)
|
self.remove_item(track)
|
||||||
|
|
||||||
def close_item_recursively(self,item):
|
def close_item(self,item):
|
||||||
# This function calls children's close_item() method
|
# This function calls children's close_item() method
|
||||||
# to let the children go away cleanly. Then it returns
|
# to let the children go away cleanly.
|
||||||
# the actual window item to later remove from dictionary
|
|
||||||
# and delete.
|
|
||||||
if type(item) == list:
|
if type(item) == list:
|
||||||
# If this item is a branch
|
# If this item is a branch
|
||||||
# close the children except for the first one
|
# close the children except for the first one
|
||||||
for sub_item in item[1:]:
|
for sub_item in item[1:]:
|
||||||
self.close_item(sub_item)
|
self.close_item(sub_item)
|
||||||
# return the first child
|
# return the first child
|
||||||
the_item = item[0]
|
last_item = item[0]
|
||||||
else:
|
else:
|
||||||
# This item is a leaf -- no children to close
|
# This item is a leaf -- no children to close
|
||||||
# return itself
|
# return itself
|
||||||
the_item = item
|
last_item = item
|
||||||
return the_item
|
if last_item.window_id:
|
||||||
|
del self.id2item[last_item.window_id]
|
||||||
|
last_item.window.destroy()
|
||||||
|
|
||||||
def remove_item(self,track):
|
def remove_item(self,track):
|
||||||
# We need the whole gymnastics below because our item
|
# We need the whole gymnastics below because our item
|
||||||
@ -225,6 +224,8 @@ class GrampsWindowManager:
|
|||||||
if item.window_id:
|
if item.window_id:
|
||||||
self.id2item[item.window_id] = item
|
self.id2item[item.window_id] = item
|
||||||
|
|
||||||
|
print "Adding: Track:", track
|
||||||
|
|
||||||
# Make sure we have a track
|
# Make sure we have a track
|
||||||
parent_item = self.get_item_from_track(track)
|
parent_item = self.get_item_from_track(track)
|
||||||
assert type(parent_item) == list or track == [], \
|
assert type(parent_item) == list or track == [], \
|
||||||
@ -322,7 +323,7 @@ class ManagedWindow:
|
|||||||
|
|
||||||
Takes care of closing children and removing itself from menu.
|
Takes care of closing children and removing itself from menu.
|
||||||
"""
|
"""
|
||||||
self.uistate.gwm.close_item(self.track)
|
self.uistate.gwm.close_track(self.track)
|
||||||
|
|
||||||
def present(self):
|
def present(self):
|
||||||
"""
|
"""
|
||||||
|
@ -96,7 +96,7 @@ class EditPerson(DisplayState.ManagedWindow):
|
|||||||
|
|
||||||
use_patronymic = locale.getlocale(locale.LC_TIME)[0] in _use_patronymic
|
use_patronymic = locale.getlocale(locale.LC_TIME)[0] in _use_patronymic
|
||||||
|
|
||||||
def __init__(self,state,uistate,person,callback=None):
|
def __init__(self,state,uistate,track,person,callback=None):
|
||||||
"""Creates an edit window. Associates a person with the window."""
|
"""Creates an edit window. Associates a person with the window."""
|
||||||
|
|
||||||
self.dp = DateHandler.parser
|
self.dp = DateHandler.parser
|
||||||
@ -113,6 +113,7 @@ class EditPerson(DisplayState.ManagedWindow):
|
|||||||
if self.already_exist:
|
if self.already_exist:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
print "EditPerson added: track:", self.track
|
||||||
self.state = state
|
self.state = state
|
||||||
self.uistate = uistate
|
self.uistate = uistate
|
||||||
self.retval = const.UPDATE_PERSON
|
self.retval = const.UPDATE_PERSON
|
||||||
@ -309,24 +310,24 @@ class EditPerson(DisplayState.ManagedWindow):
|
|||||||
Utils.bold_label(self.gallery_label)
|
Utils.bold_label(self.gallery_label)
|
||||||
|
|
||||||
# event display
|
# event display
|
||||||
self.event_box = ListBox.EventListBox(
|
self.event_box = ListBox.EventListBox( state, uistate, self.track,
|
||||||
self, self.person, self.event_list, self.events_label,
|
self.person, self.event_list, self.events_label,
|
||||||
[event_add_btn,event_edit_btn,event_delete_btn,event_sel_btn])
|
[event_add_btn,event_edit_btn,event_delete_btn,event_sel_btn])
|
||||||
|
|
||||||
self.attr_box = ListBox.AttrListBox(
|
self.attr_box = ListBox.AttrListBox( state, uistate, self.track,
|
||||||
self, self.person, self.attr_list, self.attr_label,
|
self.person, self.attr_list, self.attr_label,
|
||||||
[attr_add_btn, attr_edit_btn, attr_delete_btn])
|
[attr_add_btn, attr_edit_btn, attr_delete_btn])
|
||||||
|
|
||||||
self.addr_box = ListBox.AddressListBox(
|
self.addr_box = ListBox.AddressListBox( state, uistate, self.track,
|
||||||
self, self.person, self.addr_list, self.addr_label,
|
self.person, self.addr_list, self.addr_label,
|
||||||
[addr_add_btn, addr_edit_btn, addr_delete_btn])
|
[addr_add_btn, addr_edit_btn, addr_delete_btn])
|
||||||
|
|
||||||
self.name_box = ListBox.NameListBox(
|
self.name_box = ListBox.NameListBox( state, uistate, self.track,
|
||||||
self, self.person, self.name_list, self.names_label,
|
self.person, self.name_list, self.names_label,
|
||||||
[name_add_btn, name_edit_btn, name_delete_btn])
|
[name_add_btn, name_edit_btn, name_delete_btn])
|
||||||
|
|
||||||
self.url_box = ListBox.UrlListBox(
|
self.url_box = ListBox.UrlListBox( state, uistate, self.track,
|
||||||
self, self.person, self.web_list, self.inet_label,
|
self.person, self.web_list, self.inet_label,
|
||||||
[web_add_btn, web_edit_btn, web_delete_btn])
|
[web_add_btn, web_edit_btn, web_delete_btn])
|
||||||
|
|
||||||
self.place_list = self.pdmap.keys()
|
self.place_list = self.pdmap.keys()
|
||||||
|
@ -55,6 +55,7 @@ import ImageSelect
|
|||||||
import DateEdit
|
import DateEdit
|
||||||
import Spell
|
import Spell
|
||||||
import GrampsDisplay
|
import GrampsDisplay
|
||||||
|
import DisplayState
|
||||||
|
|
||||||
from QuestionDialog import WarningDialog, ErrorDialog
|
from QuestionDialog import WarningDialog, ErrorDialog
|
||||||
from WindowUtils import GladeIf
|
from WindowUtils import GladeIf
|
||||||
@ -435,23 +436,30 @@ class EventEditor:
|
|||||||
# EventRefEditor class
|
# EventRefEditor class
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class EventRefEditor:
|
class EventRefEditor(DisplayState.ManagedWindow):
|
||||||
def __init__(self, event, event_ref, referent, database, update, parent):
|
def __init__(self, state, uistate, track,
|
||||||
self.db = database
|
event, event_ref, referent, update):
|
||||||
self.parent = parent
|
self.db = state.db
|
||||||
|
self.state = state
|
||||||
|
self.uistate = uistate
|
||||||
self.referent = referent
|
self.referent = referent
|
||||||
if self.parent.__dict__.has_key('child_windows'):
|
#if self.parent.__dict__.has_key('child_windows'):
|
||||||
self.win_parent = self.parent
|
# self.win_parent = self.parent
|
||||||
else:
|
#else:
|
||||||
self.win_parent = self.parent.parent
|
# self.win_parent = self.parent.parent
|
||||||
if event_ref:
|
if event_ref:
|
||||||
if self.win_parent.child_windows.has_key(event_ref):
|
win_key = event_ref
|
||||||
self.win_parent.child_windows[event_ref].present(None)
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
self.win_key = event_ref
|
|
||||||
else:
|
else:
|
||||||
self.win_key = self
|
win_key = self
|
||||||
|
submenu_label =_('Event Reference')
|
||||||
|
menu_label = _('Event Reference Editor')
|
||||||
|
|
||||||
|
DisplayState.ManagedWindow.__init__(
|
||||||
|
self, uistate, track, win_key, submenu_label, menu_label)
|
||||||
|
|
||||||
|
if self.already_exist:
|
||||||
|
return
|
||||||
|
|
||||||
self.update = update
|
self.update = update
|
||||||
self.event_ref = event_ref
|
self.event_ref = event_ref
|
||||||
self.event = event
|
self.event = event
|
||||||
@ -592,21 +600,23 @@ class EventRefEditor:
|
|||||||
if self.event.get_media_list():
|
if self.event.get_media_list():
|
||||||
Utils.bold_label(self.gallery_label)
|
Utils.bold_label(self.gallery_label)
|
||||||
|
|
||||||
self.add_itself_to_menu()
|
#self.add_itself_to_menu()
|
||||||
try:
|
#try:
|
||||||
self.window.set_transient_for(self.parent.window)
|
# self.window.set_transient_for(self.parent.window)
|
||||||
except AttributeError:
|
#except AttributeError:
|
||||||
pass
|
# pass
|
||||||
self.window.show()
|
self.window.show()
|
||||||
|
print "added track:", self.track
|
||||||
|
|
||||||
def on_delete_event(self,obj,b):
|
def on_delete_event(self,obj,b):
|
||||||
self.close_child_windows()
|
#self.close_child_windows()
|
||||||
self.remove_itself_from_menu()
|
#self.remove_itself_from_menu()
|
||||||
|
self.close()
|
||||||
|
|
||||||
def close(self,obj):
|
# def close(self,obj):
|
||||||
self.close_child_windows()
|
# self.close_child_windows()
|
||||||
self.remove_itself_from_menu()
|
# self.remove_itself_from_menu()
|
||||||
self.window.destroy()
|
# self.window.destroy()
|
||||||
|
|
||||||
def close_child_windows(self):
|
def close_child_windows(self):
|
||||||
for child_window in self.child_windows.values():
|
for child_window in self.child_windows.values():
|
||||||
@ -633,8 +643,8 @@ class EventRefEditor:
|
|||||||
self.winsmenu.destroy()
|
self.winsmenu.destroy()
|
||||||
self.parent_menu_item.destroy()
|
self.parent_menu_item.destroy()
|
||||||
|
|
||||||
def present(self,obj):
|
# def present(self,obj):
|
||||||
self.window.present()
|
# self.window.present()
|
||||||
|
|
||||||
def on_help_clicked(self,obj):
|
def on_help_clicked(self,obj):
|
||||||
pass
|
pass
|
||||||
|
@ -65,17 +65,20 @@ class ListBox:
|
|||||||
|
|
||||||
The primary argument is either Person or Family object.
|
The primary argument is either Person or Family object.
|
||||||
"""
|
"""
|
||||||
def __init__(self, parent, primary, obj, label, button_list, titles):
|
def __init__(self, state, uistate, track,
|
||||||
|
primary, obj, label, button_list, titles):
|
||||||
self.primary = primary
|
self.primary = primary
|
||||||
if self.primary.__class__.__name__ == 'Person':
|
if self.primary.__class__.__name__ == 'Person':
|
||||||
self.name = NameDisplay.displayer.display(primary)
|
self.name = NameDisplay.displayer.display(primary)
|
||||||
elif self.primary.__class__.__name__ == 'Family':
|
elif self.primary.__class__.__name__ == 'Family':
|
||||||
self.name = Utils.family_name(primary,parent.db)
|
self.name = Utils.family_name(primary,state.db)
|
||||||
else:
|
else:
|
||||||
self.name = ""
|
self.name = ""
|
||||||
self.label = label
|
self.label = label
|
||||||
self.db = parent.db
|
self.db = state.db
|
||||||
self.parent = parent
|
self.state = state
|
||||||
|
self.uistate = uistate
|
||||||
|
self.track = track
|
||||||
self.list_model = ListModel(
|
self.list_model = ListModel(
|
||||||
obj, titles, self.select_row, self.update)
|
obj, titles, self.select_row, self.update)
|
||||||
self.blist = button_list
|
self.blist = button_list
|
||||||
@ -170,9 +173,11 @@ class ListBox:
|
|||||||
|
|
||||||
class ReorderListBox(ListBox):
|
class ReorderListBox(ListBox):
|
||||||
|
|
||||||
def __init__(self,parent,primary,obj,label,button_list,evalues, dnd_type):
|
def __init__(self,state,uistate,track,
|
||||||
|
primary,obj,label,button_list,evalues, dnd_type):
|
||||||
|
|
||||||
ListBox.__init__(self,parent,primary,obj,label,button_list,evalues)
|
ListBox.__init__(self,state,uistate,track,
|
||||||
|
primary,obj,label,button_list,evalues)
|
||||||
|
|
||||||
self.dnd_type = dnd_type
|
self.dnd_type = dnd_type
|
||||||
|
|
||||||
@ -218,7 +223,8 @@ class ReorderListBox(ListBox):
|
|||||||
|
|
||||||
class AttrListBox(ReorderListBox):
|
class AttrListBox(ReorderListBox):
|
||||||
|
|
||||||
def __init__(self, parent, primary, obj, label, button_list):
|
def __init__(self, state, uistate, track,
|
||||||
|
primary, obj, label, button_list):
|
||||||
|
|
||||||
if primary.__class__.__name__ == 'Person':
|
if primary.__class__.__name__ == 'Person':
|
||||||
self.attr_dict = Utils.personal_attributes
|
self.attr_dict = Utils.personal_attributes
|
||||||
@ -239,7 +245,8 @@ class AttrListBox(ReorderListBox):
|
|||||||
]
|
]
|
||||||
|
|
||||||
self.data = primary.get_attribute_list()[:]
|
self.data = primary.get_attribute_list()[:]
|
||||||
ListBox.__init__(self, parent, primary, obj, label,
|
ListBox.__init__(self, state, uistate, track,
|
||||||
|
primary, obj, label,
|
||||||
button_list, titles)
|
button_list, titles)
|
||||||
|
|
||||||
self.attr_name_map,self.attr_val_map = self.build_maps(
|
self.attr_name_map,self.attr_val_map = self.build_maps(
|
||||||
@ -258,17 +265,17 @@ class AttrListBox(ReorderListBox):
|
|||||||
|
|
||||||
def add(self,obj):
|
def add(self,obj):
|
||||||
"""Brings up the AttributeEditor for a new attribute"""
|
"""Brings up the AttributeEditor for a new attribute"""
|
||||||
AttrEdit.AttributeEditor(self.parent, None, self.name,
|
AttrEdit.AttributeEditor(state, uistate, None, self.name,
|
||||||
self.attr_dict,
|
self.attr_dict,
|
||||||
self.edit_callback,self.parent.window)
|
self.edit_callback)
|
||||||
|
|
||||||
def update(self,obj):
|
def update(self,obj):
|
||||||
store,node = self.list_model.get_selected()
|
store,node = self.list_model.get_selected()
|
||||||
if node:
|
if node:
|
||||||
attr = self.list_model.get_object(node)
|
attr = self.list_model.get_object(node)
|
||||||
AttrEdit.AttributeEditor(self.parent, attr, self.name,
|
AttrEdit.AttributeEditor(state,uistate, attr, self.name,
|
||||||
self.attr_dict,
|
self.attr_dict,
|
||||||
self.edit_callback,self.parent.window)
|
self.edit_callback)
|
||||||
|
|
||||||
def display_data(self,attr):
|
def display_data(self,attr):
|
||||||
has_note = attr.get_note()
|
has_note = attr.get_note()
|
||||||
@ -287,20 +294,23 @@ class EventListBox(ReorderListBox):
|
|||||||
|
|
||||||
titles = ['Event', 'Description','Date','Place','Source','Note']
|
titles = ['Event', 'Description','Date','Place','Source','Note']
|
||||||
|
|
||||||
def __init__(self,parent,primary,obj,label,button_list):
|
def __init__(self,state,uistate,track,primary,obj,label,button_list):
|
||||||
|
|
||||||
self.data = []
|
self.data = []
|
||||||
self.primary = primary
|
self.primary = primary
|
||||||
self.parent = parent
|
self.state = state
|
||||||
|
self.uistate = uistate
|
||||||
if self.primary.__class__.__name__ == 'Person':
|
if self.primary.__class__.__name__ == 'Person':
|
||||||
birth_ref = primary.get_birth_ref()
|
birth_ref = primary.get_birth_ref()
|
||||||
death_ref = primary.get_death_ref()
|
death_ref = primary.get_death_ref()
|
||||||
if birth_ref:
|
if birth_ref:
|
||||||
self.data.append((birth_ref,
|
self.data.append(
|
||||||
parent.db.get_event_from_handle(birth_ref.ref)))
|
(birth_ref,state.db.get_event_from_handle(birth_ref.ref)))
|
||||||
if death_ref:
|
if death_ref:
|
||||||
self.data.append((death_ref,
|
self.data.append(
|
||||||
parent.db.get_event_from_handle(death_ref.ref)))
|
(death_ref,
|
||||||
|
state.db.get_event_from_handle(death_ref.ref))
|
||||||
|
)
|
||||||
self.ev_dict = Utils.personal_events
|
self.ev_dict = Utils.personal_events
|
||||||
self.role_dict = Utils.event_roles
|
self.role_dict = Utils.event_roles
|
||||||
elif self.primary.__class__.__name__ == 'Family':
|
elif self.primary.__class__.__name__ == 'Family':
|
||||||
@ -309,7 +319,7 @@ class EventListBox(ReorderListBox):
|
|||||||
|
|
||||||
for event_ref in primary.get_event_ref_list():
|
for event_ref in primary.get_event_ref_list():
|
||||||
self.data.append((event_ref,
|
self.data.append((event_ref,
|
||||||
parent.db.get_event_from_handle(event_ref.ref)))
|
state.db.get_event_from_handle(event_ref.ref)))
|
||||||
|
|
||||||
ev_custom_str = self.ev_dict[RelLib.Event.CUSTOM]
|
ev_custom_str = self.ev_dict[RelLib.Event.CUSTOM]
|
||||||
eventnames = filter(lambda x: x != ev_custom_str,
|
eventnames = filter(lambda x: x != ev_custom_str,
|
||||||
@ -321,8 +331,8 @@ class EventListBox(ReorderListBox):
|
|||||||
self.role_dict.values())
|
self.role_dict.values())
|
||||||
|
|
||||||
self.place_dict = {}
|
self.place_dict = {}
|
||||||
for handle in self.parent.db.get_place_handles():
|
for handle in self.state.db.get_place_handles():
|
||||||
title = self.parent.db.get_place_from_handle(handle).get_title()
|
title = self.state.db.get_place_from_handle(handle).get_title()
|
||||||
self.place_dict[title] = handle
|
self.place_dict[title] = handle
|
||||||
placenames = self.place_dict.keys()
|
placenames = self.place_dict.keys()
|
||||||
placenames.sort(locale.strcoll)
|
placenames.sort(locale.strcoll)
|
||||||
@ -338,7 +348,8 @@ class EventListBox(ReorderListBox):
|
|||||||
(_('Note'), NOSORT, 50, TOGGLE, None, None),
|
(_('Note'), NOSORT, 50, TOGGLE, None, None),
|
||||||
]
|
]
|
||||||
|
|
||||||
ReorderListBox.__init__(self, parent, primary, obj, label,
|
ReorderListBox.__init__(self, state, uistate, track,
|
||||||
|
primary, obj, label,
|
||||||
button_list, evalues, DdTargets.EVENT)
|
button_list, evalues, DdTargets.EVENT)
|
||||||
|
|
||||||
self.ev_name_map,self.ev_val_map = self.build_maps(
|
self.ev_name_map,self.ev_val_map = self.build_maps(
|
||||||
@ -371,13 +382,13 @@ class EventListBox(ReorderListBox):
|
|||||||
return
|
return
|
||||||
handle = self.place_dict.get(value,None)
|
handle = self.place_dict.get(value,None)
|
||||||
if handle:
|
if handle:
|
||||||
place = self.parent.db.get_place_from_handle(handle)
|
place = self.state.db.get_place_from_handle(handle)
|
||||||
else:
|
else:
|
||||||
place = RelLib.Place()
|
place = RelLib.Place()
|
||||||
place.set_title(value)
|
place.set_title(value)
|
||||||
trans = self.parent.db.transaction_begin()
|
trans = self.state.db.transaction_begin()
|
||||||
self.parent.db.add_place(place,trans)
|
self.state.db.add_place(place,trans)
|
||||||
self.parent.db.transaction_commit(trans,_("Add Place"))
|
self.state.db.transaction_commit(trans,_("Add Place"))
|
||||||
handle = place.get_handle()
|
handle = place.get_handle()
|
||||||
|
|
||||||
self.data[index][1].set_place_handle(handle)
|
self.data[index][1].set_place_handle(handle)
|
||||||
@ -389,8 +400,8 @@ class EventListBox(ReorderListBox):
|
|||||||
|
|
||||||
def add(self,obj):
|
def add(self,obj):
|
||||||
"""Brings up the EventEditor for a new event"""
|
"""Brings up the EventEditor for a new event"""
|
||||||
EventEdit.EventRefEditor(None,None,self.primary,self.parent.db,
|
EventEdit.EventRefEditor(self.state,self.uistate,self.track,
|
||||||
self.edit_callback,self.parent)
|
None,None,self.primary,self.edit_callback)
|
||||||
|
|
||||||
def select(self,obj):
|
def select(self,obj):
|
||||||
"""
|
"""
|
||||||
@ -398,20 +409,21 @@ class EventListBox(ReorderListBox):
|
|||||||
"""
|
"""
|
||||||
# select existing event
|
# select existing event
|
||||||
import SelectEvent
|
import SelectEvent
|
||||||
sel_event = SelectEvent.SelectEvent(self.db,_('Select Event'),
|
sel_event = SelectEvent.SelectEvent(self.state.db,_('Select Event'))
|
||||||
self.parent.window)
|
|
||||||
event = sel_event.run()
|
event = sel_event.run()
|
||||||
if event:
|
if event:
|
||||||
EventEdit.EventRefEditor(event,None,self.primary,self.parent.db,
|
EventEdit.EventRefEditor(self.state,self.uistate,self.track,
|
||||||
self.edit_callback,self.parent)
|
event,None,self.primary,
|
||||||
|
self.edit_callback)
|
||||||
|
|
||||||
def update(self,obj):
|
def update(self,obj):
|
||||||
store,node = self.list_model.get_selected()
|
store,node = self.list_model.get_selected()
|
||||||
if not node:
|
if not node:
|
||||||
return
|
return
|
||||||
event_ref,event = self.list_model.get_object(node)
|
event_ref,event = self.list_model.get_object(node)
|
||||||
EventEdit.EventRefEditor(event,event_ref,self.primary,self.parent.db,
|
EventEdit.EventRefEditor(self.state,self.uistate,self.track,
|
||||||
self.edit_callback,self.parent)
|
event,event_ref,self.primary,
|
||||||
|
self.edit_callback)
|
||||||
|
|
||||||
def display_data(self,event_tuple):
|
def display_data(self,event_tuple):
|
||||||
(event_ref, event) = event_tuple
|
(event_ref, event) = event_tuple
|
||||||
@ -439,9 +451,9 @@ class EventListBox(ReorderListBox):
|
|||||||
|
|
||||||
class NameListBox(ReorderListBox):
|
class NameListBox(ReorderListBox):
|
||||||
|
|
||||||
def __init__(self,parent,person,obj,label,button_list):
|
def __init__(self,state,uistate,track,person,obj,label,button_list):
|
||||||
|
|
||||||
surnames = parent.db.get_surname_list()
|
surnames = state.db.get_surname_list()
|
||||||
|
|
||||||
custom_str = Utils.name_types[RelLib.Name.CUSTOM]
|
custom_str = Utils.name_types[RelLib.Name.CUSTOM]
|
||||||
types = filter(lambda x: x != custom_str, Utils.name_types.values())
|
types = filter(lambda x: x != custom_str, Utils.name_types.values())
|
||||||
@ -459,7 +471,8 @@ class NameListBox(ReorderListBox):
|
|||||||
]
|
]
|
||||||
|
|
||||||
self.data = person.get_alternate_names()[:]
|
self.data = person.get_alternate_names()[:]
|
||||||
ReorderListBox.__init__(self, parent, person, obj, label,
|
ReorderListBox.__init__(self, state, uistate, track,
|
||||||
|
person, obj, label,
|
||||||
button_list, titles, DdTargets.NAME)
|
button_list, titles, DdTargets.NAME)
|
||||||
|
|
||||||
self.name_name_map,self.name_val_map = self.build_maps(
|
self.name_name_map,self.name_val_map = self.build_maps(
|
||||||
@ -486,14 +499,14 @@ class NameListBox(ReorderListBox):
|
|||||||
self.data[index].set_suffix(value)
|
self.data[index].set_suffix(value)
|
||||||
|
|
||||||
def add(self,obj):
|
def add(self,obj):
|
||||||
NameEdit.NameEditor(self.parent, None, self.edit_callback,
|
NameEdit.NameEditor(self.state, self.uistate, None, self.edit_callback)
|
||||||
self.parent.window)
|
|
||||||
|
|
||||||
def update(self,obj):
|
def update(self,obj):
|
||||||
store,node = self.list_model.get_selected()
|
store,node = self.list_model.get_selected()
|
||||||
if node:
|
if node:
|
||||||
NameEdit.NameEditor(self.parent, self.list_model.get_object(node),
|
NameEdit.NameEditor(self.state, self.uistate,
|
||||||
self.edit_callback, self.parent.window)
|
self.list_model.get_object(node),
|
||||||
|
self.edit_callback)
|
||||||
|
|
||||||
def display_data(self,name):
|
def display_data(self,name):
|
||||||
has_note = name.get_note()
|
has_note = name.get_note()
|
||||||
@ -518,7 +531,7 @@ class NameListBox(ReorderListBox):
|
|||||||
|
|
||||||
class AddressListBox(ReorderListBox):
|
class AddressListBox(ReorderListBox):
|
||||||
|
|
||||||
def __init__(self,parent,person,obj,label,button_list):
|
def __init__(self,state,uistate,track,person,obj,label,button_list):
|
||||||
|
|
||||||
titles = [
|
titles = [
|
||||||
# Title Sort Col Size, Type
|
# Title Sort Col Size, Type
|
||||||
@ -532,7 +545,8 @@ class AddressListBox(ReorderListBox):
|
|||||||
]
|
]
|
||||||
|
|
||||||
self.data = person.get_address_list()[:]
|
self.data = person.get_address_list()[:]
|
||||||
ReorderListBox.__init__(self, parent, person, obj, label,
|
ReorderListBox.__init__(self, state, uistate, track,
|
||||||
|
person, obj, label,
|
||||||
button_list, titles, DdTargets.ADDRESS)
|
button_list, titles, DdTargets.ADDRESS)
|
||||||
|
|
||||||
def set_date(self,index,value):
|
def set_date(self,index,value):
|
||||||
@ -551,15 +565,15 @@ class AddressListBox(ReorderListBox):
|
|||||||
self.data[index].set_country(value)
|
self.data[index].set_country(value)
|
||||||
|
|
||||||
def add(self,obj):
|
def add(self,obj):
|
||||||
AddrEdit.AddressEditor(self.parent, None, self.edit_callback,
|
AddrEdit.AddressEditor(self.state,self.uistate, None,
|
||||||
self.parent.window)
|
self.edit_callback)
|
||||||
|
|
||||||
def update(self,obj):
|
def update(self,obj):
|
||||||
store,node = self.list_model.get_selected()
|
store,node = self.list_model.get_selected()
|
||||||
if node:
|
if node:
|
||||||
item = self.list_model.get_object(node)
|
item = self.list_model.get_object(node)
|
||||||
AddrEdit.AddressEditor(self.parent, item,
|
AddrEdit.AddressEditor(self.state,self.uistate, item,
|
||||||
self.edit_callback, self.parent.window)
|
self.edit_callback)
|
||||||
|
|
||||||
def display_data(self,item):
|
def display_data(self,item):
|
||||||
has_note = item.get_note()
|
has_note = item.get_note()
|
||||||
@ -578,7 +592,7 @@ class AddressListBox(ReorderListBox):
|
|||||||
|
|
||||||
class UrlListBox(ReorderListBox):
|
class UrlListBox(ReorderListBox):
|
||||||
|
|
||||||
def __init__(self,parent,person,obj,label,button_list):
|
def __init__(self,state,uistate,track,person,obj,label,button_list):
|
||||||
|
|
||||||
titles = [
|
titles = [
|
||||||
# Title Sort Col Size, Type
|
# Title Sort Col Size, Type
|
||||||
@ -586,7 +600,8 @@ class UrlListBox(ReorderListBox):
|
|||||||
(_('Description'), NOSORT, 100, TEXT, None, self.set_description),
|
(_('Description'), NOSORT, 100, TEXT, None, self.set_description),
|
||||||
]
|
]
|
||||||
self.data = person.get_url_list()[:]
|
self.data = person.get_url_list()[:]
|
||||||
ReorderListBox.__init__(self, parent, person, obj, label,
|
ReorderListBox.__init__(self, state, uistate, track,
|
||||||
|
person, obj, label,
|
||||||
button_list, titles, DdTargets.URL)
|
button_list, titles, DdTargets.URL)
|
||||||
|
|
||||||
def set_path(self,index,value):
|
def set_path(self,index,value):
|
||||||
@ -596,17 +611,15 @@ class UrlListBox(ReorderListBox):
|
|||||||
self.data[index].set_description(value)
|
self.data[index].set_description(value)
|
||||||
|
|
||||||
def add(self,obj):
|
def add(self,obj):
|
||||||
UrlEdit.UrlEditor(self.parent, self.name, None,
|
UrlEdit.UrlEditor(self.state, self.uistate, self.name, None,
|
||||||
self.edit_callback, self.parent.window)
|
self.edit_callback)
|
||||||
|
|
||||||
def update(self,obj):
|
def update(self,obj):
|
||||||
store,node = self.list_model.get_selected()
|
store,node = self.list_model.get_selected()
|
||||||
if node:
|
if node:
|
||||||
UrlEdit.UrlEditor(self.parent, self.name,
|
UrlEdit.UrlEditor(self.state, self.uistate, self.name,
|
||||||
self.list_model.get_object(node),
|
self.list_model.get_object(node),
|
||||||
self.edit_callback, self.window)
|
self.edit_callback, self.window)
|
||||||
|
|
||||||
def display_data(self,url):
|
def display_data(self,url):
|
||||||
return [url.get_path(), url.get_description()]
|
return [url.get_path(), url.get_description()]
|
||||||
|
|
||||||
|
|
||||||
|
@ -449,11 +449,11 @@ class PersonView(PageView.PersonNavView):
|
|||||||
|
|
||||||
def add(self,obj):
|
def add(self,obj):
|
||||||
person = RelLib.Person()
|
person = RelLib.Person()
|
||||||
EditPerson.EditPerson(self.dbstate, self.uistate, person)
|
EditPerson.EditPerson(self.dbstate, self.uistate, [], person)
|
||||||
|
|
||||||
def edit(self,obj):
|
def edit(self,obj):
|
||||||
if self.dbstate.active:
|
if self.dbstate.active:
|
||||||
EditPerson.EditPerson(self.dbstate, self.uistate, self.dbstate.active)
|
EditPerson.EditPerson(self.dbstate, self.uistate, [], self.dbstate.active)
|
||||||
|
|
||||||
def remove(self,obj):
|
def remove(self,obj):
|
||||||
mlist = self.get_selected_objects()
|
mlist = self.get_selected_objects()
|
||||||
@ -736,7 +736,7 @@ class PersonView(PageView.PersonNavView):
|
|||||||
handle = self.first_selected()
|
handle = self.first_selected()
|
||||||
person = self.dbstate.db.get_person_from_handle(handle)
|
person = self.dbstate.db.get_person_from_handle(handle)
|
||||||
if person:
|
if person:
|
||||||
EditPerson.EditPerson(self.dbstate, self.uistate,person)
|
EditPerson.EditPerson(self.dbstate, self.uistate, [], person)
|
||||||
return True
|
return True
|
||||||
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
||||||
menu = self.uistate.uimanager.get_widget('/Popup')
|
menu = self.uistate.uimanager.get_widget('/Popup')
|
||||||
|
Loading…
Reference in New Issue
Block a user