From 822586d8a54b9ff8b2007afd89108c352a33054d Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Tue, 3 Nov 2009 01:39:47 +0000 Subject: [PATCH] Added plugin.fpath to keep track of path; added edit button in plugin window svn: r13484 --- src/PluginUtils/_PluginWindows.py | 25 +++++++++++++++++++++++-- src/gen/plug/_pluginreg.py | 1 + 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/PluginUtils/_PluginWindows.py b/src/PluginUtils/_PluginWindows.py index c5576d7c1..95eb4ae24 100644 --- a/src/PluginUtils/_PluginWindows.py +++ b/src/PluginUtils/_PluginWindows.py @@ -28,6 +28,7 @@ #------------------------------------------------------------------------- import traceback from gettext import gettext as _ +import os #------------------------------------------------------------------------- # @@ -113,6 +114,9 @@ class PluginStatus(ManagedWindow.ManagedWindow): hbutbox.add(self.__hide_btn) self.__hide_btn.connect('clicked', self.__hide) if __debug__: + self.__edit_btn = gtk.Button(_("Edit")) + hbutbox.add(self.__edit_btn) + self.__edit_btn.connect('clicked', self.__edit) self.__load_btn = gtk.Button(_("Load")) hbutbox.add(self.__load_btn) self.__load_btn.connect('clicked', self.__load) @@ -258,13 +262,15 @@ Description: %(descr)s Authors: %(authors)s Email: %(email)s Filename: %(fname)s - """ % { +Location: %(fpath)s +""" % { 'name': pdata.name, 'typestr': typestr, 'descr': pdata.description, 'authors': auth, 'email': email, - 'fname': pdata.fname + 'fname': pdata.fname, + 'fpath': pdata.fpath, } InfoDialog('Detailed Info', infotxt, parent=self.window) @@ -297,6 +303,21 @@ Filename: %(fname)s self.__pmgr.load_plugin(pdata) self.__rebuild_load_list() + def __edit(self, obj): + """ Callback function from the "Load" button + """ + model, node = self.selection_reg.get_selected() + if not node: + return + id = model.get_value(node, 4) + pdata = self.__preg.get_plugin(id) + if "EDITOR" in os.environ: + os.system("""$EDITOR "%s" &""" % + os.path.join(pdata.fpath, pdata.fname)) + else: + os.system("""gedit "%s" &""" % + os.path.join(pdata.fpath, pdata.fname)) + #------------------------------------------------------------------------- # # Details for an individual plugin that failed diff --git a/src/gen/plug/_pluginreg.py b/src/gen/plug/_pluginreg.py index 11faab575..033e80fed 100644 --- a/src/gen/plug/_pluginreg.py +++ b/src/gen/plug/_pluginreg.py @@ -844,6 +844,7 @@ class PluginRegister(object): continue module = match.groups()[0] plugin.mod_name = module + plugin.fpath = dir rmlist.reverse() for ind in rmlist: del self.__plugindata[ind]