* src/StartupDialog.py: fix close

* src/plugins/Desbrowser.py: Use ActivPersonTool
	* src/PluginUtils/_Tool.py: active person tool added


svn: r6412
This commit is contained in:
Don Allingham 2006-04-22 04:48:40 +00:00
parent a0f9a7c5eb
commit 527d01a583
6 changed files with 41 additions and 20 deletions

View File

@ -1,4 +1,7 @@
2006-04-21 Don Allingham <don@gramps-project.org> 2006-04-21 Don Allingham <don@gramps-project.org>
* src/StartupDialog.py: fix close
* src/plugins/Desbrowser.py: Use ActivPersonTool
* src/PluginUtils/_Tool.py: active person tool added
* src/plugins/FilterEditor.py: fix close arguments * src/plugins/FilterEditor.py: fix close arguments
* src/plugins/ChangeNames.py: fix close arguments * src/plugins/ChangeNames.py: fix close arguments
* src/plugins/Merge.py: fix close arguments * src/plugins/Merge.py: fix close arguments

View File

@ -88,7 +88,6 @@ class PluginStatus(ManagedWindow.ManagedWindow):
scrolled_window.add(self.list) scrolled_window.add(self.list)
self.window.vbox.add(scrolled_window) self.window.vbox.add(scrolled_window)
self.window.connect
self.window.show_all() self.window.show_all()
for i in PluginMgr.failmsg_list: for i in PluginMgr.failmsg_list:

View File

@ -101,8 +101,7 @@ class PluginDialog(ManagedWindow.ManagedWindow):
self.dialog = gtk.glade.XML(const.plugins_glade,"report","gramps") self.dialog = gtk.glade.XML(const.plugins_glade,"report","gramps")
self.dialog.signal_autoconnect({ self.dialog.signal_autoconnect({
"on_report_apply_clicked" : self.on_apply_clicked, "on_report_apply_clicked" : self.on_apply_clicked,
"destroy_passed_object" : self.close, "destroy_passed_object" : self.close_window,
"on_delete_event" : self.on_delete_event,
}) })
self.tree = self.dialog.get_widget("tree") self.tree = self.dialog.get_widget("tree")
@ -146,11 +145,8 @@ class PluginDialog(ManagedWindow.ManagedWindow):
self.build_plugin_tree(item_list,categories) self.build_plugin_tree(item_list,categories)
self.window.show() self.window.show()
def on_delete_event(self,obj,b): def close_window(self, obj):
pass self.close()
def close(self,ok=0):
self.window.destroy()
def on_apply_clicked(self,obj): def on_apply_clicked(self,obj):
"""Execute the selected report""" """Execute the selected report"""

View File

@ -96,6 +96,28 @@ class Tool:
pass pass
class ActivePersonTool(Tool):
"""
The Tool base class. This is a base class for generating
customized tools. It cannot be used as is, but it can be easily
sub-classed to create a functional tool.
"""
def __init__(self, dbstate, options_class, name):
if not dbstate.get_active_person():
from QuestionDialog import ErrorDialog
ErrorDialog(_('Active person has not been set'),
_('You must select an active person for this '
'tool to work properly.'))
self.fail = True
return
Tool.__init__(self, dbstate, options_class, name)
self.fail = False
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# Command-line tool # Command-line tool

View File

@ -114,7 +114,7 @@ class StartupDialog:
if not const.no_gconf and upgrade_prefs(): if not const.no_gconf and upgrade_prefs():
Config.save_startup(const.startup) Config.save_startup(const.startup)
self.close(None) self.close()
return return
self.w = Assistant.Assistant(self.complete) self.w = Assistant.Assistant(self.complete)
self.w.add_text_page( self.w.add_text_page(

View File

@ -44,7 +44,6 @@ from PluginUtils import Tool, register_tool
# GTK/GNOME modules # GTK/GNOME modules
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
import gobject
import gtk import gtk
import gtk.glade import gtk.glade
import GrampsDisplay import GrampsDisplay
@ -55,28 +54,26 @@ import ManagedWindow
# #
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
class DesBrowse(Tool.Tool, ManagedWindow.ManagedWindow): class DesBrowse(Tool.ActivePersonTool, ManagedWindow.ManagedWindow):
def __init__(self, dbstate, uistate, options_class, name, callback=None): def __init__(self, dbstate, uistate, options_class, name, callback=None):
Tool.Tool.__init__(self, dbstate, options_class, name) Tool.ActivePersonTool.__init__(self, dbstate, options_class, name)
if self.fail:
return
ManagedWindow.ManagedWindow.__init__(self, uistate, [], self) ManagedWindow.ManagedWindow.__init__(self, uistate, [], self)
self.dbstate = dbstate
self.active = dbstate.get_active_person() self.active = dbstate.get_active_person()
self.callback = callback self.callback = callback
if not self.active:
ErrorDialog(_('Active person has not been set'),
_('You must select an active person for this '
'tool to work properly.'))
return
base = os.path.dirname(__file__) base = os.path.dirname(__file__)
glade_file = base + os.sep + "desbrowse.glade" glade_file = base + os.sep + "desbrowse.glade"
self.glade = gtk.glade.XML(glade_file,"top","gramps") self.glade = gtk.glade.XML(glade_file,"top","gramps")
self.glade.signal_autoconnect({ self.glade.signal_autoconnect({
"destroy_passed_object" : self.close, "destroy_passed_object" : self.close_window,
"on_help_clicked" : self.on_help_clicked, "on_help_clicked" : self.on_help_clicked,
}) })
self.window = self.glade.get_widget("top") self.window = self.glade.get_widget("top")
@ -96,6 +93,9 @@ class DesBrowse(Tool.Tool, ManagedWindow.ManagedWindow):
self.window.show() self.window.show()
def close_window(self,obj):
self.close()
def make_new_model(self): def make_new_model(self):
self.model = gtk.TreeStore(str, object) self.model = gtk.TreeStore(str, object)
self.tree.set_model(self.model) self.tree.set_model(self.model)
@ -129,7 +129,8 @@ class DesBrowse(Tool.Tool, ManagedWindow.ManagedWindow):
if iter: if iter:
person_handle = store.get_value(node, 1) person_handle = store.get_value(node, 1)
person = self.db.get_person_from_handle(person_handle) person = self.db.get_person_from_handle(person_handle)
EditPerson(self.parent, person, self.db, self.this_callback) EditPerson(self.dbstate, self.uistate, self.track, person,
self.this_callback)
def this_callback(self, epo, val): def this_callback(self, epo, val):
self.callback(epo, val) self.callback(epo, val)