* src/srcsel.glade: Add handlers.
* src/Sources.py: Make SourceInfo non-modal, use Windows menu. svn: r2874
This commit is contained in:
parent
da5acff6d5
commit
21b64c8a9d
@ -6,6 +6,8 @@
|
|||||||
* src/gramps_main.py: Get Windows menu and its submenu.
|
* src/gramps_main.py: Get Windows menu and its submenu.
|
||||||
Pass Gramps class to the children -- first-class object editors.
|
Pass Gramps class to the children -- first-class object editors.
|
||||||
* src/dialog.glade: Add handler.
|
* src/dialog.glade: Add handler.
|
||||||
|
* src/srcsel.glade: Add handlers.
|
||||||
|
* src/Sources.py: Make SourceInfo non-modal, use Windows menu.
|
||||||
|
|
||||||
2004-02-16 Alex Roitman <shura@alex.neuro.umn.edu>
|
2004-02-16 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||||
* src/Relationship.py: Factor out relationship distance computation.
|
* src/Relationship.py: Factor out relationship distance computation.
|
||||||
|
@ -142,7 +142,7 @@ class NameEditor:
|
|||||||
|
|
||||||
def close_child_windows(self):
|
def close_child_windows(self):
|
||||||
for child_window in self.child_windows:
|
for child_window in self.child_windows:
|
||||||
child_window.close()
|
child_window.close(None)
|
||||||
|
|
||||||
def add_itself_to_menu(self):
|
def add_itself_to_menu(self):
|
||||||
if not self.name:
|
if not self.name:
|
||||||
|
@ -247,6 +247,7 @@ class SourceEditor:
|
|||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.update = update
|
self.update = update
|
||||||
self.source_ref = srcref
|
self.source_ref = srcref
|
||||||
|
self.child_windows = []
|
||||||
self.showSource = gtk.glade.XML(const.srcselFile, "sourceDisplay","gramps")
|
self.showSource = gtk.glade.XML(const.srcselFile, "sourceDisplay","gramps")
|
||||||
self.sourceDisplay = self.get_widget("sourceDisplay")
|
self.sourceDisplay = self.get_widget("sourceDisplay")
|
||||||
|
|
||||||
@ -257,6 +258,9 @@ class SourceEditor:
|
|||||||
"on_source_changed" : self.on_source_changed,
|
"on_source_changed" : self.on_source_changed,
|
||||||
"on_add_src_clicked" : self.add_src_clicked,
|
"on_add_src_clicked" : self.add_src_clicked,
|
||||||
"on_help_srcDisplay_clicked" : self.on_help_clicked,
|
"on_help_srcDisplay_clicked" : self.on_help_clicked,
|
||||||
|
"on_ok_srcDisplay_clicked" : self.on_sourceok_clicked,
|
||||||
|
"on_cancel_srcDisplay_clicked" : self.close,
|
||||||
|
"on_sourceDisplay_delete_event" : self.on_delete_event,
|
||||||
})
|
})
|
||||||
self.source_field = self.get_widget("sourceList")
|
self.source_field = self.get_widget("sourceList")
|
||||||
self.title_menu = self.get_widget("source_title")
|
self.title_menu = self.get_widget("source_title")
|
||||||
@ -280,18 +284,56 @@ class SourceEditor:
|
|||||||
|
|
||||||
self.draw(self.active_source)
|
self.draw(self.active_source)
|
||||||
self.set_button()
|
self.set_button()
|
||||||
self.sourceDisplay.show()
|
|
||||||
if self.parent:
|
if self.parent:
|
||||||
self.sourceDisplay.set_transient_for(self.parent.window)
|
self.sourceDisplay.set_transient_for(self.parent.window)
|
||||||
self.val = self.sourceDisplay.run()
|
self.parent.parent.child_windows.append(self)
|
||||||
if self.val == gtk.RESPONSE_OK:
|
self.add_itself_to_menu()
|
||||||
self.on_sourceok_clicked()
|
self.sourceDisplay.show()
|
||||||
self.sourceDisplay.destroy()
|
|
||||||
|
def on_delete_event(self,obj,b):
|
||||||
|
self.close_child_windows()
|
||||||
|
self.parent.parent.child_windows.remove(self)
|
||||||
|
self.remove_itself_from_menu()
|
||||||
|
|
||||||
|
def close(self,obj):
|
||||||
|
self.close_child_windows()
|
||||||
|
self.parent.parent.child_windows.remove(self)
|
||||||
|
self.remove_itself_from_menu()
|
||||||
|
Utils.destroy_passed_object(self.sourceDisplay)
|
||||||
|
|
||||||
|
def close_child_windows(self):
|
||||||
|
for child_window in self.child_windows:
|
||||||
|
child_window.close()
|
||||||
|
|
||||||
|
def add_itself_to_menu(self):
|
||||||
|
if self.active_source:
|
||||||
|
label = self.active_source.get_title()
|
||||||
|
else:
|
||||||
|
label = _("New Source")
|
||||||
|
if not label.strip():
|
||||||
|
label = _("New Source")
|
||||||
|
label = "%s: %s" % (_('Source Reference'),label)
|
||||||
|
self.parent_menu_item = gtk.MenuItem(label)
|
||||||
|
self.parent_menu_item.set_submenu(gtk.Menu())
|
||||||
|
self.parent_menu_item.show()
|
||||||
|
self.parent.parent.menu.append(self.parent_menu_item)
|
||||||
|
self.menu = self.parent_menu_item.get_submenu()
|
||||||
|
self.menu_item = gtk.MenuItem(_('Source Information'))
|
||||||
|
self.menu_item.connect("activate",self.present)
|
||||||
|
self.menu_item.show()
|
||||||
|
self.menu.append(self.menu_item)
|
||||||
|
|
||||||
|
def remove_itself_from_menu(self):
|
||||||
|
self.menu_item.destroy()
|
||||||
|
self.menu.destroy()
|
||||||
|
self.parent_menu_item.destroy()
|
||||||
|
|
||||||
|
def present(self,obj):
|
||||||
|
self.window.present()
|
||||||
|
|
||||||
def on_help_clicked(self,obj):
|
def on_help_clicked(self,obj):
|
||||||
"""Display the relevant portion of GRAMPS manual"""
|
"""Display the relevant portion of GRAMPS manual"""
|
||||||
gnome.help_display('gramps-manual','adv-si')
|
gnome.help_display('gramps-manual','adv-si')
|
||||||
self.val = self.sourceDisplay.run()
|
|
||||||
|
|
||||||
def set_button(self):
|
def set_button(self):
|
||||||
if self.active_source:
|
if self.active_source:
|
||||||
@ -352,7 +394,7 @@ class SourceEditor:
|
|||||||
else:
|
else:
|
||||||
self.title_menu.set_sensitive(0)
|
self.title_menu.set_sensitive(0)
|
||||||
|
|
||||||
def on_sourceok_clicked(self):
|
def on_sourceok_clicked(self,obj):
|
||||||
|
|
||||||
if self.active_source != self.db.find_source_from_id(self.source_ref.get_base_id()):
|
if self.active_source != self.db.find_source_from_id(self.source_ref.get_base_id()):
|
||||||
self.source_ref.set_base_id(self.active_source)
|
self.source_ref.set_base_id(self.active_source)
|
||||||
@ -382,6 +424,7 @@ class SourceEditor:
|
|||||||
self.update(self.parent,self.source_ref)
|
self.update(self.parent,self.source_ref)
|
||||||
|
|
||||||
Utils.modified()
|
Utils.modified()
|
||||||
|
self.close()
|
||||||
|
|
||||||
def on_source_changed(self,obj):
|
def on_source_changed(self,obj):
|
||||||
sel = obj.list.get_selection()
|
sel = obj.list.get_selection()
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
<property name="destroy_with_parent">False</property>
|
<property name="destroy_with_parent">False</property>
|
||||||
<property name="icon">gramps.png</property>
|
<property name="icon">gramps.png</property>
|
||||||
<property name="has_separator">False</property>
|
<property name="has_separator">False</property>
|
||||||
|
<signal name="delete_event" handler="on_sourceDisplay_delete_event" last_modification_time="Thu, 19 Feb 2004 23:20:28 GMT"/>
|
||||||
|
|
||||||
<child internal-child="vbox">
|
<child internal-child="vbox">
|
||||||
<widget class="GtkVBox" id="vbox27">
|
<widget class="GtkVBox" id="vbox27">
|
||||||
@ -36,6 +37,7 @@
|
|||||||
<property name="use_stock">True</property>
|
<property name="use_stock">True</property>
|
||||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
<property name="response_id">-6</property>
|
<property name="response_id">-6</property>
|
||||||
|
<signal name="clicked" handler="on_cancel_srcDisplay_clicked" last_modification_time="Thu, 19 Feb 2004 23:19:53 GMT"/>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
@ -49,6 +51,7 @@
|
|||||||
<property name="use_stock">True</property>
|
<property name="use_stock">True</property>
|
||||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
<property name="response_id">-5</property>
|
<property name="response_id">-5</property>
|
||||||
|
<signal name="clicked" handler="on_ok_srcDisplay_clicked" last_modification_time="Thu, 19 Feb 2004 23:20:09 GMT"/>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user