* src/EditPlace.py: fix windowing history

svn: r5194
This commit is contained in:
Don Allingham 2005-09-16 04:07:53 +00:00
parent 2663b12f13
commit ac4f55f71b
4 changed files with 37 additions and 75 deletions

View File

@ -1,3 +1,6 @@
2005-09-15 Don Allingham <don@gramps-project.org>
* src/EditPlace.py: fix windowing history
2005-08-25 Martin Hawlisch <Martin.Hawlisch@gmx.de> 2005-08-25 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/gramps_main.py: pass DisplayState to TipOfDay * src/gramps_main.py: pass DisplayState to TipOfDay
* src/TipOfDay.py: Use DisplayState * src/TipOfDay.py: Use DisplayState

View File

@ -314,13 +314,8 @@ class EditPerson(DisplayState.ManagedWindow):
"destroy_passed_object" : self.on_cancel_edit, "destroy_passed_object" : self.on_cancel_edit,
"on_up_clicked" : self.on_up_clicked, "on_up_clicked" : self.on_up_clicked,
"on_down_clicked" : self.on_down_clicked, "on_down_clicked" : self.on_down_clicked,
# "on_addphoto_clicked" : self.gallery.on_add_media_clicked,
# "on_selectphoto_clicked" : self.gallery.on_select_media_clicked,
"on_apply_person_clicked" : self.on_apply_person_clicked, "on_apply_person_clicked" : self.on_apply_person_clicked,
"on_delete_event" : self.on_delete_event, "on_delete_event" : self.on_delete_event,
# "on_deletephoto_clicked" : self.gallery.on_delete_media_clicked,
# "on_edit_properties_clicked": self.gallery.popup_change_description,
# "on_editphoto_clicked" : self.gallery.on_edit_media_clicked,
"on_editperson_switch_page" : self.on_switch_page, "on_editperson_switch_page" : self.on_switch_page,
"on_edit_name_clicked" : self.on_edit_name_clicked, "on_edit_name_clicked" : self.on_edit_name_clicked,
"on_ldsbap_note_clicked" : self.on_ldsbap_note_clicked, "on_ldsbap_note_clicked" : self.on_ldsbap_note_clicked,

View File

@ -48,6 +48,7 @@ import Utils
import Sources import Sources
import ImageSelect import ImageSelect
import NameDisplay import NameDisplay
import DisplayState
import Spell import Spell
from DdTargets import DdTargets from DdTargets import DdTargets
@ -57,28 +58,18 @@ from DdTargets import DdTargets
# EditPlace # EditPlace
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class EditPlace: class EditPlace(DisplayState.ManagedWindow):
def __init__(self,parent,place,dbstate,uistate): def __init__(self,place,dbstate,uistate):
#self.parent = parent
self.dbstate = dbstate self.dbstate = dbstate
self.uistate = uistate self.uistate = uistate
# if place and place.get_handle():
# if self.parent.child_windows.has_key(place.get_handle()): self.ref_not_loaded = place and place.get_handle()
# self.parent.child_windows[place.get_handle()].present(None)
# return
# else:
# self.win_key = place.get_handle()
# self.ref_not_loaded = 1
# else:
# self.win_key = self
# self.ref_not_loaded = 0
self.name_display = NameDisplay.displayer.display self.name_display = NameDisplay.displayer.display
self.place = place self.place = place
self.db = parent.db self.db = dbstate.db
# self.child_windows = {} self.path = dbstate.db.get_save_path()
# self.path = parent.db.get_save_path() self.not_loaded = True
self.not_loaded = 1
self.lists_changed = 0 self.lists_changed = 0
if place: if place:
self.srcreflist = place.get_source_references() self.srcreflist = place.get_source_references()
@ -245,19 +236,23 @@ class EditPlace:
self.redraw_url_list() self.redraw_url_list()
self.redraw_location_list() self.redraw_location_list()
if parent_window:
self.top.set_transient_for(parent_window)
self.add_itself_to_menu()
self.top_window.get_widget('ok').set_sensitive(not self.db.readonly) self.top_window.get_widget('ok').set_sensitive(not self.db.readonly)
self.top.show() self.top.show()
win_menu_label = place.get_title()
if not win_menu_label.strip():
win_menu_label = _("New Place")
DisplayState.ManagedWindow.__init__(
self, uistate, [], self, win_menu_label, _('Edit Place'))
self.pdmap = {} self.pdmap = {}
self.build_pdmap() self.build_pdmap()
if self.ref_not_loaded: if self.ref_not_loaded:
Utils.temp_label(self.refs_label,self.top) Utils.temp_label(self.refs_label,self.top)
gobject.idle_add(self.display_references) gobject.idle_add(self.display_references)
self.ref_not_loaded = 0 self.ref_not_loaded = False
def build_pdmap(self): def build_pdmap(self):
self.pdmap.clear() self.pdmap.clear()
@ -271,47 +266,12 @@ class EditPlace:
def on_delete_event(self,obj,b): def on_delete_event(self,obj,b):
self.glry.close() self.glry.close()
self.close_child_windows()
self.remove_itself_from_menu() self.remove_itself_from_menu()
def close(self,obj): def close(self,obj):
self.glry.close() self.glry.close()
self.close_child_windows()
self.remove_itself_from_menu()
self.top.destroy() self.top.destroy()
def close_child_windows(self):
for child_window in self.child_windows.values():
child_window.close(None)
self.child_windows = {}
def add_itself_to_menu(self):
return
self.parent.child_windows[self.win_key] = self
if not self.place.get_title():
label = _("New Place")
else:
label = self.place.get_title()
if not label.strip():
label = _("New Place")
label = "%s: %s" % (_('Place'),label)
self.parent_menu_item = gtk.MenuItem(label)
self.parent_menu_item.set_submenu(gtk.Menu())
self.parent_menu_item.show()
self.parent.winsmenu.append(self.parent_menu_item)
self.winsmenu = self.parent_menu_item.get_submenu()
self.menu_item = gtk.MenuItem(_('Place Editor'))
self.menu_item.connect("activate",self.present)
self.menu_item.show()
self.winsmenu.append(self.menu_item)
def remove_itself_from_menu(self):
return
del self.parent.child_windows[self.win_key]
self.menu_item.destroy()
self.winsmenu.destroy()
self.parent_menu_item.destroy()
def present(self,obj): def present(self,obj):
self.top.present() self.top.present()
@ -439,10 +399,10 @@ class EditPlace:
def on_switch_page(self,obj,a,page): def on_switch_page(self,obj,a,page):
if page == 4 and self.not_loaded: if page == 4 and self.not_loaded:
self.not_loaded = 0 self.not_loaded = False
self.glry.load_images() self.glry.load_images()
elif page == 6 and self.ref_not_loaded: elif page == 6 and self.ref_not_loaded:
self.ref_not_loaded = 0 self.ref_not_loaded = False
Utils.temp_label(self.refs_label,self.top) Utils.temp_label(self.refs_label,self.top)
gobject.idle_add(self.display_references) gobject.idle_add(self.display_references)
text = unicode(self.note_buffer.get_text(self.note_buffer.get_start_iter(), text = unicode(self.note_buffer.get_text(self.note_buffer.get_start_iter(),
@ -538,14 +498,20 @@ class EditPlace:
msg = "" msg = ""
for key in self.db.get_person_handles(sort_handles=False): for key in self.db.get_person_handles(sort_handles=False):
p = self.db.get_person_from_handle(key) p = self.db.get_person_from_handle(key)
for event_handle in [p.get_birth_handle(), p.get_death_handle()] + p.get_event_list():
event = self.db.get_event_from_handle(event_handle) ref_list = [p.get_birth_ref(), p.get_death_ref()] + p.get_event_ref_list()
ref_list = [ ref for ref in ref_list if ref ]
for event_ref in ref_list:
event = self.db.get_event_from_handle(event_ref.ref)
if event and event.get_place_handle() == self.place.get_handle(): if event and event.get_place_handle() == self.place.get_handle():
pevent.append((p,event)) pevent.append((p,event))
for family_handle in self.db.get_family_handles(): for family_handle in self.db.get_family_handles():
f = self.db.get_family_from_handle(family_handle) f = self.db.get_family_from_handle(family_handle)
for event_handle in f.get_event_list():
event = self.db.get_event_from_handle(event_handle) for event_ref in f.get_event_ref_list():
event = self.db.get_event_from_handle(event_ref.ref)
if event and event.get_place_handle() == self.place.get_handle(): if event and event.get_place_handle() == self.place.get_handle():
fevent.append((f,event)) fevent.append((f,event))
@ -557,7 +523,7 @@ class EditPlace:
t = _("%s [%s]: event %s\n") t = _("%s [%s]: event %s\n")
for e in pevent: for e in pevent:
msg = msg + ( t % (self.name_display(e[0]),e[0].get_gramps_id(),_(e[1].get_name()))) msg = msg + ( t % (self.name_display(e[0]),e[0].get_gramps_id(),_(e[1].get_type())))
if len(fevent) > 0: if len(fevent) > 0:
any = 1 any = 1
@ -577,7 +543,7 @@ class EditPlace:
else: else:
fname = self.name_display( self.db.get_person_from_handle( mother)) fname = self.name_display( self.db.get_person_from_handle( mother))
msg = msg + ( t % (fname,e[0].get_gramps_id(),_(e[1].get_name()))) msg = msg + ( t % (fname,e[0].get_gramps_id(),_(e[1].get_type())))
self.refinfo.get_buffer().set_text(msg) self.refinfo.get_buffer().set_text(msg)
if any: if any:

View File

@ -115,10 +115,8 @@ class NameEditor:
self.preform = self.top.get_widget("alt_preform") self.preform = self.top.get_widget("alt_preform")
self.group_over = self.top.get_widget('group_over') self.group_over = self.top.get_widget('group_over')
self.type_selector = \ self.type_selector = AutoComp.StandardCustomSelector(
AutoComp.StandardCustomSelector(Utils.name_types, Utils.name_types, self.type_combo, RelLib.Name.CUSTOM,
self.type_combo,
RelLib.Name.CUSTOM,
RelLib.Name.BIRTH) RelLib.Name.BIRTH)
full_name = NameDisplay.displayer.display_name(name) full_name = NameDisplay.displayer.display_name(name)