[gedit-plugins] Make all modules available in the commander.modules module



commit a0302d2eca5c279dc221dd610ad5f01d261d3b63
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date:   Sun May 9 16:31:58 2010 +0200

    Make all modules available in the commander.modules module

 plugins/commander/commander/Makefile.am          |    1 +
 plugins/commander/commander/__init__.py          |    2 +-
 plugins/commander/commander/commands/__init__.py |    7 +++++++
 3 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/plugins/commander/commander/Makefile.am b/plugins/commander/commander/Makefile.am
index c639a8a..2da1c0d 100644
--- a/plugins/commander/commander/Makefile.am
+++ b/plugins/commander/commander/Makefile.am
@@ -9,6 +9,7 @@ plugin_PYTHON =	\
 	history.py \
 	info.py \
 	__init__.py \
+	modules.py \
 	transparentwindow.py \
 	utils.py \
 	windowhelper.py
diff --git a/plugins/commander/commander/__init__.py b/plugins/commander/commander/__init__.py
index 2d00d27..5fb9eca 100644
--- a/plugins/commander/commander/__init__.py
+++ b/plugins/commander/commander/__init__.py
@@ -8,7 +8,7 @@ if not path in sys.path:
 
 import gedit
 from windowhelper import WindowHelper
-import commands
+import commander.commands as commands
 
 class Commander(gedit.Plugin):
 	def __init__(self):
diff --git a/plugins/commander/commander/commands/__init__.py b/plugins/commander/commander/commands/__init__.py
index 16cae9e..a9d165d 100644
--- a/plugins/commander/commander/commands/__init__.py
+++ b/plugins/commander/commander/commands/__init__.py
@@ -18,6 +18,8 @@ from accel_group import Accelerator
 
 __all__ = ['is_commander_module', 'Commands', 'Accelerator']
 
+import commander.modules
+
 def attrs(**kwargs):
 	def generator(f):
 		for k in kwargs:
@@ -363,6 +365,9 @@ class Commands(Singleton):
 		if self._accel_group:
 			self.remove_module_accelerators([mod])
 
+		if mod.name in commander.modules.__dict__:
+			del commander.modules.__dict__[mod.name]
+
 	def reload_module(self, mod):
 		if isinstance(mod, basestring):
 			mod = self.resolve_module(mod)
@@ -387,6 +392,8 @@ class Commands(Singleton):
 		for r in mod.roots():
 			bisect.insort(self._modules, r)
 
+		commander.modules.__dict__[mod.name] = mod.mod
+
 		if self._accel_group:
 			self.scan_accelerators([mod])
 
diff --git a/plugins/commander/commander/modules.py b/plugins/commander/commander/modules.py
new file mode 100644
index 0000000..e69de29



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]