* src/EditSource.py: allow double click on reference to bring up the referece
editor * src/EventEdit.py: don't require a callback * src/ImageSelect.py: horrible hack for handling removing parent windows. Alex: HELP! svn: r4360
This commit is contained in:
parent
2059945bc6
commit
c289f6c04b
@ -1,4 +1,9 @@
|
||||
2005-04-13 Don Allingham <don@gramps-project.org>
|
||||
* src/EditSource.py: allow double click on reference to bring up the referece
|
||||
editor
|
||||
* src/EventEdit.py: don't require a callback
|
||||
* src/ImageSelect.py: horrible hack for handling removing parent windows.
|
||||
Alex: HELP!
|
||||
* src/gramps_main.py: check for reentrancy into the undo handler
|
||||
* src/plugins/WebPage.py: fixed check on dialog run() return value,
|
||||
changed deprecated gtk.mainiteration to gtk.main_iteration
|
||||
|
@ -64,7 +64,7 @@ class EditSource:
|
||||
self.parent = parent
|
||||
self.name_display = NameDisplay.displayer.display
|
||||
if source:
|
||||
if self.parent.child_windows.has_key(source.get_handle()):
|
||||
if parent and self.parent.child_windows.has_key(source.get_handle()):
|
||||
self.parent.child_windows[source.get_handle()].present(None)
|
||||
return
|
||||
else:
|
||||
@ -253,6 +253,37 @@ class EditSource:
|
||||
def present(self,obj):
|
||||
self.top.present()
|
||||
|
||||
def button_press(self,obj):
|
||||
data = self.model.get_selected_objects()
|
||||
(type,handle) = data[0]
|
||||
if type == 0:
|
||||
import EditPerson
|
||||
person = self.db.get_person_from_handle(handle)
|
||||
EditPerson.EditPerson(self.parent,person,self.db)
|
||||
elif type == 1:
|
||||
import Marriage
|
||||
family = self.db.get_family_from_handle(handle)
|
||||
Marriage.Marriage(self.parent,family,self.db)
|
||||
elif type == 2:
|
||||
import EventEdit
|
||||
event = self.db.get_event_from_handle(handle)
|
||||
if event.get_name() in const.marriageEvents:
|
||||
EventEdit.EventEditor(
|
||||
self,", ", const.marriageEvents, const.family_events,
|
||||
event, None, 0, None, None, self.db.readonly)
|
||||
elif event.get_name() in const.personalEvents + [_("Birth"),_("Death")]:
|
||||
EventEdit.EventEditor(
|
||||
self,", ", const.personalEvents, const.personal_events,
|
||||
event, None, 0, None, None, self.db.readonly)
|
||||
elif type == 3:
|
||||
import EditPlace
|
||||
family = self.db.get_place_from_handle(handle)
|
||||
EditPlace.EditPlace(self.parent,family,self.db)
|
||||
elif type == 5:
|
||||
import ImageSelect
|
||||
media = self.db.get_object_from_handle(handle)
|
||||
ImageSelect.GlobalMediaProperties(self.db,media,self.parent)
|
||||
|
||||
def display_references(self):
|
||||
|
||||
(person_list,family_list,event_list,
|
||||
@ -266,43 +297,43 @@ class EditSource:
|
||||
|
||||
titles = [(_('Type'),0,150),(_('ID'),1,75),(_('Name'),2,150)]
|
||||
|
||||
self.model = ListModel.ListModel(slist,titles)
|
||||
self.model = ListModel.ListModel(slist,titles,event_func=self.button_press)
|
||||
|
||||
for handle in person_list:
|
||||
person = self.db.get_person_from_handle(handle)
|
||||
name = self.name_display(person)
|
||||
gramps_id = person.get_gramps_id()
|
||||
self.model.add([_("Person"),gramps_id,name])
|
||||
self.model.add([_("Person"),gramps_id,name],(0,handle))
|
||||
|
||||
for handle in family_list:
|
||||
family = self.db.get_family_from_handle(handle)
|
||||
name = Utils.family_name(family,self.db)
|
||||
gramps_id = family.get_gramps_id()
|
||||
self.model.add([_("Family"),gramps_id,name])
|
||||
self.model.add([_("Family"),gramps_id,name],(1,handle))
|
||||
|
||||
for handle in event_list:
|
||||
event = self.db.get_event_from_handle(handle)
|
||||
name = event.get_name()
|
||||
gramps_id = event.get_gramps_id()
|
||||
self.model.add([_("Event"),gramps_id,name])
|
||||
self.model.add([_("Event"),gramps_id,name],(2,handle))
|
||||
|
||||
for handle in place_list:
|
||||
place = self.db.get_place_from_handle(handle)
|
||||
name = place.get_title()
|
||||
gramps_id = place.get_gramps_id()
|
||||
self.model.add([_("Place"),gramps_id,name])
|
||||
self.model.add([_("Place"),gramps_id,name],(3,handle))
|
||||
|
||||
for handle in source_list:
|
||||
source = self.db.get_source_from_handle(handle)
|
||||
name = source.get_title()
|
||||
gramps_id = source.get_gramps_id()
|
||||
self.model.add([_("Source"),gramps_id,name])
|
||||
self.model.add([_("Source"),gramps_id,name],(4,handle))
|
||||
|
||||
for handle in media_list:
|
||||
media = self.db.get_object_from_handle(handle)
|
||||
name = media.get_description()
|
||||
gramps_id = media.get_gramps_id()
|
||||
self.model.add([_("Media"),gramps_id,name])
|
||||
self.model.add([_("Media"),gramps_id,name],(5,handle))
|
||||
|
||||
if any:
|
||||
Utils.bold_label(self.refs_label)
|
||||
|
@ -244,7 +244,10 @@ class EventEditor:
|
||||
self.top.get_widget('sel_obj').set_sensitive(not noedit)
|
||||
self.top.get_widget('add_obj').set_sensitive(not noedit)
|
||||
|
||||
self.window.set_transient_for(self.parent.window)
|
||||
try:
|
||||
self.window.set_transient_for(self.parent.window)
|
||||
except AttributeError:
|
||||
pass
|
||||
self.add_itself_to_menu()
|
||||
self.window.show()
|
||||
|
||||
@ -284,7 +287,8 @@ class EventEditor:
|
||||
self.winsmenu.append(self.menu_item)
|
||||
|
||||
def remove_itself_from_menu(self):
|
||||
del self.parent.child_windows[self.win_key]
|
||||
if self.window:
|
||||
del self.parent.child_windows[self.win_key]
|
||||
self.menu_item.destroy()
|
||||
self.winsmenu.destroy()
|
||||
self.parent_menu_item.destroy()
|
||||
@ -352,7 +356,8 @@ class EventEditor:
|
||||
self.db.transaction_commit(trans,_("Edit Event"))
|
||||
self.close(obj)
|
||||
self.parent.redraw_event_list()
|
||||
self.callback(self.event)
|
||||
if self.callback:
|
||||
self.callback(self.event)
|
||||
|
||||
def update_event(self,name,date,place,desc,note,format,priv,cause,trans):
|
||||
if place:
|
||||
|
@ -743,16 +743,25 @@ class LocalMediaProperties:
|
||||
self.redraw_attr_list()
|
||||
if parent_window:
|
||||
self.window.set_transient_for(parent_window)
|
||||
self.add_itself_to_menu()
|
||||
try:
|
||||
self.add_itself_to_menu()
|
||||
except:
|
||||
pass
|
||||
self.window.show()
|
||||
|
||||
def on_delete_event(self,obj,b):
|
||||
self.close_child_windows()
|
||||
self.remove_itself_from_menu()
|
||||
try:
|
||||
self.remove_itself_from_menu()
|
||||
except:
|
||||
pass
|
||||
|
||||
def close(self,obj):
|
||||
self.close_child_windows()
|
||||
self.remove_itself_from_menu()
|
||||
try:
|
||||
self.remove_itself_from_menu()
|
||||
except:
|
||||
pass
|
||||
self.window.destroy()
|
||||
|
||||
def close_child_windows(self):
|
||||
@ -882,10 +891,13 @@ class GlobalMediaProperties:
|
||||
self.dp = DateHandler.parser
|
||||
self.dd = DateHandler.displayer
|
||||
if obj:
|
||||
if self.parent.parent.child_windows.has_key(obj.get_handle()):
|
||||
self.parent.parent.child_windows[obj.get_handle()].present(None)
|
||||
return
|
||||
else:
|
||||
try:
|
||||
if self.parent.parent.child_windows.has_key(obj.get_handle()):
|
||||
self.parent.parent.child_windows[obj.get_handle()].present(None)
|
||||
return
|
||||
else:
|
||||
self.win_key = obj.get_handle()
|
||||
except:
|
||||
self.win_key = obj.get_handle()
|
||||
else:
|
||||
self.win_key = self
|
||||
@ -1027,7 +1039,10 @@ class GlobalMediaProperties:
|
||||
self.display_refs()
|
||||
if parent_window:
|
||||
self.window.set_transient_for(parent_window)
|
||||
self.add_itself_to_menu()
|
||||
try:
|
||||
self.add_itself_to_menu()
|
||||
except:
|
||||
pass
|
||||
self.window.show()
|
||||
|
||||
def on_delete_event(self,obj,b):
|
||||
@ -1036,7 +1051,10 @@ class GlobalMediaProperties:
|
||||
|
||||
def close(self,obj):
|
||||
self.close_child_windows()
|
||||
self.remove_itself_from_menu()
|
||||
try:
|
||||
self.remove_itself_from_menu()
|
||||
except:
|
||||
pass
|
||||
self.window.destroy()
|
||||
|
||||
def close_child_windows(self):
|
||||
|
@ -54,13 +54,6 @@ import GrampsDBCallback
|
||||
|
||||
from DdTargets import DdTargets
|
||||
|
||||
|
||||
##pycode_tgts = [('url', 0, 0),
|
||||
## ('pevent', 0, 1),
|
||||
## ('pattr', 0, 2),
|
||||
## ('paddr', 0, 3),
|
||||
## ('srcref', 0, 4)]
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# SourceSelector
|
||||
@ -92,13 +85,13 @@ class SourceSelector:
|
||||
_('Source Reference Selection'))
|
||||
|
||||
self.top.signal_autoconnect({
|
||||
"on_add_src_clicked" : self.add_src_clicked,
|
||||
"on_del_src_clicked" : self.del_src_clicked,
|
||||
"on_edit_src_clicked" : self.edit_src_clicked,
|
||||
"on_help_srcsel_clicked" : self.on_help_clicked,
|
||||
"on_cancel_srcsel_clicked" : self.close,
|
||||
"on_ok_srcsel_clicked" : self.src_ok_clicked,
|
||||
"on_srcsel_delete_event" : self.on_delete_event,
|
||||
"on_add_src_clicked" : self.add_src_clicked,
|
||||
"on_del_src_clicked" : self.del_src_clicked,
|
||||
"on_edit_src_clicked" : self.edit_src_clicked,
|
||||
"on_help_srcsel_clicked" : self.on_help_clicked,
|
||||
"on_cancel_srcsel_clicked" : self.close,
|
||||
"on_ok_srcsel_clicked" : self.src_ok_clicked,
|
||||
"on_srcsel_delete_event" : self.on_delete_event,
|
||||
})
|
||||
|
||||
self.slist = self.top.get_widget("slist")
|
||||
@ -116,7 +109,7 @@ class SourceSelector:
|
||||
renderer = gtk.CellRendererText ()
|
||||
renderer.set_fixed_height_from_font(1)
|
||||
column = gtk.TreeViewColumn (title[0], renderer, text=colno)
|
||||
colno = colno + 1
|
||||
colno += 1
|
||||
column.set_clickable (True)
|
||||
column.set_resizable(True)
|
||||
column.set_sort_column_id(title[1])
|
||||
|
Loading…
Reference in New Issue
Block a user