2006-04-27 Alex Roitman <shura@gramps-project.org>
* src/PluginUtils/_PluginStatus.py: Fix wm. * src/PluginUtils/_Plugins.py: Fix Reload tool. The re-building of the menus still needs to be fixed. * src/plugins/Leak.py: Fix wm. * src/docgen/LPRDoc.py: Import Errors module before it is called. * src/plugins/DumpGenderStats.py: Fix wm. svn: r6468
This commit is contained in:
@@ -55,15 +55,14 @@ class PluginStatus(ManagedWindow.ManagedWindow):
|
||||
def __init__(self, state, uistate, track=[]):
|
||||
|
||||
self.title = _("Plugin Status")
|
||||
ManagedWindow.ManagedWindow.__init__(self, uistate, track, self)
|
||||
ManagedWindow.ManagedWindow.__init__(self,uistate,track,self.__class__)
|
||||
|
||||
self.set_window(gtk.Dialog("",uistate.window,
|
||||
gtk.DIALOG_DESTROY_WITH_PARENT,
|
||||
(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)),
|
||||
None, self.title)
|
||||
self.window.set_size_request(600,400)
|
||||
self.window.connect('delete-event',self.close_window)
|
||||
self.window.connect('response', self.close_window)
|
||||
self.window.connect('response', self.close)
|
||||
|
||||
scrolled_window = gtk.ScrolledWindow()
|
||||
self.list = gtk.TreeView()
|
||||
@@ -106,9 +105,6 @@ class PluginStatus(ManagedWindow.ManagedWindow):
|
||||
'<span weight="bold" color="#267726">%s</span>' % _("OK"),
|
||||
i[0], descr, None])
|
||||
|
||||
def close_window(self, *obj):
|
||||
self.close()
|
||||
|
||||
def button_press(self, obj, event):
|
||||
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
||||
model, node = self.selection.get_selected()
|
||||
@@ -138,8 +134,7 @@ class PluginTrace(ManagedWindow.ManagedWindow):
|
||||
(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)),
|
||||
None, title)
|
||||
self.window.set_size_request(600,400)
|
||||
self.window.connect('delete-event',self.close_window)
|
||||
self.window.connect('response', self.close_window)
|
||||
self.window.connect('response', self.close)
|
||||
|
||||
scrolled_window = gtk.ScrolledWindow()
|
||||
scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
|
||||
@@ -153,6 +148,3 @@ class PluginTrace(ManagedWindow.ManagedWindow):
|
||||
|
||||
def build_menu_names(self,obj):
|
||||
return (self.name, None)
|
||||
|
||||
def close_window(self, *obj):
|
||||
self.close()
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000-2005 Donald N. Allingham
|
||||
# Copyright (C) 2000-2006 Donald N. Allingham
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -60,6 +60,7 @@ import Errors
|
||||
import _Report
|
||||
import _Tool
|
||||
import _PluginMgr
|
||||
import _PluginStatus
|
||||
import GrampsDisplay
|
||||
import ManagedWindow
|
||||
|
||||
@@ -379,8 +380,8 @@ def by_menu_name(a,b):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Reload(_Tool.Tool):
|
||||
def __init__(self,db,person,options_class,name,callback=None,parent=None):
|
||||
_Tool.Tool.__init__(self,db,person,options_class,name)
|
||||
def __init__(self, dbstate, uistate, options_class, name, callback=None):
|
||||
_Tool.Tool.__init__(self,dbstate,options_class,name)
|
||||
|
||||
"""
|
||||
Treated as a callback, causes all plugins to get reloaded.
|
||||
@@ -393,12 +394,12 @@ class Reload(_Tool.Tool):
|
||||
_PluginMgr.failmsg_list = []
|
||||
|
||||
# attempt to reload all plugins that have succeeded in the past
|
||||
for plugin in _PluginMgr._success_list:
|
||||
filename = os.path.basename(plugin.__file__)
|
||||
for plugin in _PluginMgr.success_list:
|
||||
filename = plugin[0]
|
||||
filename = filename.replace('pyc','py')
|
||||
filename = filename.replace('pyo','py')
|
||||
try:
|
||||
reload(plugin)
|
||||
reload(plugin[1])
|
||||
except:
|
||||
_PluginMgr.failmsg_list.append((filename,sys.exc_info()))
|
||||
|
||||
@@ -440,7 +441,7 @@ class Reload(_Tool.Tool):
|
||||
# Looks like a bug in Python.
|
||||
a = __import__(plugin)
|
||||
reload(a)
|
||||
_PluginMgr._success_list.append(a)
|
||||
_PluginMgr.success_list.append((filename,a))
|
||||
except:
|
||||
_PluginMgr.failmsg_list.append((filename,sys.exc_info()))
|
||||
|
||||
@@ -457,21 +458,25 @@ class Reload(_Tool.Tool):
|
||||
plugin = match.groups()[0]
|
||||
try:
|
||||
a = __import__(plugin)
|
||||
if a not in _PluginMgr._success_list:
|
||||
_PluginMgr._success_list.append(a)
|
||||
if a not in [plugin[1]
|
||||
for plugin in _PluginMgr.success_list]:
|
||||
_PluginMgr.success_list.append((filename,a))
|
||||
except:
|
||||
_PluginMgr.failmsg_list.append((filename,sys.exc_info()))
|
||||
|
||||
if Config.get(Config.POP_PLUGIN_STATUS) and len(_PluginMgr.failmsg_list):
|
||||
PluginStatus()
|
||||
else:
|
||||
global status_up
|
||||
if status_up:
|
||||
status_up.close(None)
|
||||
status_up = None
|
||||
if Config.get(Config.POP_PLUGIN_STATUS) \
|
||||
and len(_PluginMgr.failmsg_list):
|
||||
try:
|
||||
_PluginStatus.PluginStatus(dbstate,uistate)
|
||||
except Errors.WindowActiveError:
|
||||
old_win = uistate.gwm.get_item_from_id(
|
||||
_PluginStatus.PluginStatus)
|
||||
old_win.close()
|
||||
_PluginStatus.PluginStatus(dbstate,uistate)
|
||||
|
||||
# Re-generate tool and report menus
|
||||
parent.build_plugin_menus(rebuild=True)
|
||||
# FIXME: This needs to be fixed!
|
||||
# build_plugin_menus(rebuild=True)
|
||||
|
||||
class ReloadOptions(_Tool.ToolOptions):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user