updated PluginStatus dialog
svn: r6390
This commit is contained in:
@@ -65,7 +65,7 @@ bkitems_list = []
|
||||
cl_list = []
|
||||
cli_tool_list = []
|
||||
|
||||
_success_list = []
|
||||
success_list = []
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@@ -90,11 +90,11 @@ _unavailable = _("No description was provided"),
|
||||
def load_plugins(direct):
|
||||
"""Searches the specified directory, and attempts to load any python
|
||||
modules that it finds, adding name to the attempt_lists list. If the module
|
||||
successfully loads, it is added to the _success_list list. Each plugin is
|
||||
successfully loads, it is added to the success_list list. Each plugin is
|
||||
responsible for registering itself in the correct manner. No attempt
|
||||
is done in this routine to register the tasks."""
|
||||
|
||||
global _success_list,attempt_list,loaddir_list,failmsg_list
|
||||
global success_list,attempt_list,loaddir_list,failmsg_list
|
||||
|
||||
# if the directory does not exist, do nothing
|
||||
if not os.path.isdir(direct):
|
||||
@@ -113,7 +113,7 @@ def load_plugins(direct):
|
||||
|
||||
# loop through each file in the directory, looking for files that
|
||||
# have a .py extention, and attempt to load the file. If it succeeds,
|
||||
# add it to the _success_list list. If it fails, add it to the _failure
|
||||
# add it to the success_list list. If it fails, add it to the _failure
|
||||
# list
|
||||
|
||||
for filename in os.listdir(direct):
|
||||
@@ -125,7 +125,7 @@ def load_plugins(direct):
|
||||
plugin = match.groups()[0]
|
||||
try:
|
||||
a = __import__(plugin)
|
||||
_success_list.append(a)
|
||||
success_list.append((filename,a))
|
||||
except Errors.PluginError, msg:
|
||||
expect_list.append((filename,str(msg)))
|
||||
except:
|
||||
|
@@ -297,73 +297,6 @@ class ToolPlugins(PluginDialog):
|
||||
_("Run selected tool"),
|
||||
TOOLS)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# PluginStatus
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
class PluginStatus(ManagedWindow.ManagedWindow):
|
||||
"""Displays a dialog showing the status of loaded plugins"""
|
||||
|
||||
def __init__(self,state,uistate,track):
|
||||
|
||||
import cStringIO
|
||||
ManagedWindow.ManagedWindow.__init__(self, uistate, [], None)
|
||||
|
||||
self.state = state
|
||||
self.uistate = uistate
|
||||
|
||||
self.glade = gtk.glade.XML(const.plugins_glade,"plugstat","gramps")
|
||||
self.window = self.glade.get_widget("plugstat")
|
||||
self.window.set_title("%s - GRAMPS" % _('Plugin status'))
|
||||
window = self.glade.get_widget("text")
|
||||
self.pop_button = self.glade.get_widget("pop_button")
|
||||
self.pop_button.set_active(Config.get_pop_plugin_status())
|
||||
self.pop_button.connect('toggled',
|
||||
lambda obj: Config.save_pop_plugin_status(self.pop_button.get_active()))
|
||||
Config.client.notify_add("/apps/gramps/behavior/pop-plugin-status",
|
||||
self.pop_button_update)
|
||||
self.glade.signal_autoconnect({
|
||||
'on_close_clicked' : self.close,
|
||||
'on_help_clicked' : self.help,
|
||||
'on_plugstat_delete_event' : self.on_delete,
|
||||
})
|
||||
|
||||
info = cStringIO.StringIO()
|
||||
|
||||
if len(_PluginMgr.expect_list) + len(_PluginMgr.failmsg_list) == 0:
|
||||
window.get_buffer().set_text(_('All modules were successfully loaded.'))
|
||||
else:
|
||||
info.write(_("The following modules could not be loaded:"))
|
||||
info.write("\n\n")
|
||||
|
||||
for (filename,msg) in _PluginMgr.expect_list:
|
||||
info.write("%s: %s\n\n" % (filename,msg))
|
||||
|
||||
for (filename,msgs) in _PluginMgr.failmsg_list:
|
||||
error = str(msgs[0])
|
||||
if error[0:11] == "exceptions.":
|
||||
error = error[11:]
|
||||
info.write("%s: %s\n" % (filename,error) )
|
||||
traceback.print_exception(msgs[0],msgs[1],msgs[2],None,info)
|
||||
info.write('\n')
|
||||
info.seek(0)
|
||||
window.get_buffer().set_text(info.read())
|
||||
|
||||
def on_delete(self,obj1,obj2):
|
||||
pass
|
||||
|
||||
def close(self,obj):
|
||||
self.window.destroy()
|
||||
|
||||
def help(self,obj):
|
||||
"""Display the GRAMPS manual"""
|
||||
GrampsDisplay.help('gramps-getting-started')
|
||||
|
||||
def pop_button_update(self, client,cnxn_id,entry,data):
|
||||
self.pop_button.set_active(Config.get_pop_plugin_status())
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Building pulldown menus
|
||||
|
@@ -35,3 +35,4 @@ import _ReportOptions as ReportOptions
|
||||
import _ReportUtils as ReportUtils
|
||||
import _Tool as Tool
|
||||
import _Plugins as Plugins
|
||||
import _PluginStatus as PluginStatus
|
||||
|
Reference in New Issue
Block a user