* 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:
parent
a0f9a7c5eb
commit
527d01a583
@ -1,4 +1,7 @@
|
||||
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/ChangeNames.py: fix close arguments
|
||||
* src/plugins/Merge.py: fix close arguments
|
||||
|
@ -88,7 +88,6 @@ class PluginStatus(ManagedWindow.ManagedWindow):
|
||||
|
||||
scrolled_window.add(self.list)
|
||||
self.window.vbox.add(scrolled_window)
|
||||
self.window.connect
|
||||
self.window.show_all()
|
||||
|
||||
for i in PluginMgr.failmsg_list:
|
||||
|
@ -101,8 +101,7 @@ class PluginDialog(ManagedWindow.ManagedWindow):
|
||||
self.dialog = gtk.glade.XML(const.plugins_glade,"report","gramps")
|
||||
self.dialog.signal_autoconnect({
|
||||
"on_report_apply_clicked" : self.on_apply_clicked,
|
||||
"destroy_passed_object" : self.close,
|
||||
"on_delete_event" : self.on_delete_event,
|
||||
"destroy_passed_object" : self.close_window,
|
||||
})
|
||||
|
||||
self.tree = self.dialog.get_widget("tree")
|
||||
@ -146,11 +145,8 @@ class PluginDialog(ManagedWindow.ManagedWindow):
|
||||
self.build_plugin_tree(item_list,categories)
|
||||
self.window.show()
|
||||
|
||||
def on_delete_event(self,obj,b):
|
||||
pass
|
||||
|
||||
def close(self,ok=0):
|
||||
self.window.destroy()
|
||||
def close_window(self, obj):
|
||||
self.close()
|
||||
|
||||
def on_apply_clicked(self,obj):
|
||||
"""Execute the selected report"""
|
||||
|
@ -96,6 +96,28 @@ class Tool:
|
||||
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
|
||||
|
@ -114,7 +114,7 @@ class StartupDialog:
|
||||
|
||||
if not const.no_gconf and upgrade_prefs():
|
||||
Config.save_startup(const.startup)
|
||||
self.close(None)
|
||||
self.close()
|
||||
return
|
||||
self.w = Assistant.Assistant(self.complete)
|
||||
self.w.add_text_page(
|
||||
|
@ -44,7 +44,6 @@ from PluginUtils import Tool, register_tool
|
||||
# GTK/GNOME modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import gobject
|
||||
import gtk
|
||||
import gtk.glade
|
||||
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):
|
||||
|
||||
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)
|
||||
|
||||
self.dbstate = dbstate
|
||||
self.active = dbstate.get_active_person()
|
||||
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__)
|
||||
glade_file = base + os.sep + "desbrowse.glade"
|
||||
|
||||
self.glade = gtk.glade.XML(glade_file,"top","gramps")
|
||||
self.glade.signal_autoconnect({
|
||||
"destroy_passed_object" : self.close,
|
||||
"destroy_passed_object" : self.close_window,
|
||||
"on_help_clicked" : self.on_help_clicked,
|
||||
})
|
||||
self.window = self.glade.get_widget("top")
|
||||
@ -96,6 +93,9 @@ class DesBrowse(Tool.Tool, ManagedWindow.ManagedWindow):
|
||||
|
||||
self.window.show()
|
||||
|
||||
def close_window(self,obj):
|
||||
self.close()
|
||||
|
||||
def make_new_model(self):
|
||||
self.model = gtk.TreeStore(str, object)
|
||||
self.tree.set_model(self.model)
|
||||
@ -129,7 +129,8 @@ class DesBrowse(Tool.Tool, ManagedWindow.ManagedWindow):
|
||||
if iter:
|
||||
person_handle = store.get_value(node, 1)
|
||||
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):
|
||||
self.callback(epo, val)
|
||||
|
Loading…
Reference in New Issue
Block a user