Added hooke.plugin.Plugin.name attribute.
authorW. Trevor King <wking@drexel.edu>
Sat, 8 May 2010 02:26:56 +0000 (22:26 -0400)
committerW. Trevor King <wking@drexel.edu>
Sat, 8 May 2010 02:26:56 +0000 (22:26 -0400)
Also:
  * Reordered Plugin methods from first called -> last called.
  * Removed old Commands class.

hooke/plugin/__init__.py

index b9e7988253342a3e061680d53c09a36bd804350a..0770f9e6f815fbaa81ea361fb6f1eb5a569b7993 100644 (file)
@@ -43,17 +43,21 @@ def Plugin (object):
     Fulfills the same role for Hooke that a software package does for
     an operating system.
     """
+    name = "base plugin"
+
     def dependencies(self):
         """Return a list of Plugins we require."""
         return []
-    def commands(self):
-        """Return a list of Commands provided."""
-        return []
+
     def default_settings(self):
         """Return a list of hooke.config.Settings() for any
         configurable module settings."""
         return []
 
+    def commands(self):
+        """Return a list of Commands provided."""
+        return []
+
 PLUGINS = {}
 """(name,instance) :class:`dict` of all possible :class:`Plugin`\s.
 """
@@ -73,48 +77,6 @@ PLUGIN_GRAPH = Graph([Node(
             )])
 PLUGIN_GRAPH.topological_sort()
 
-#class Commands(wx.Panel):
-#
-#    def __init__(self, parent):
-#        # Use the WANTS_CHARS style so the panel doesn't eat the Return key.
-#        wx.Panel.__init__(self, parent, -1, style=wx.WANTS_CHARS|wx.NO_BORDER, size=(160, 200))
-#
-#        self.CommandsTree = wx.TreeCtrl(self, -1, wx.Point(0, 0), wx.Size(160, 250), wx.TR_DEFAULT_STYLE|wx.NO_BORDER|wx.TR_HIDE_ROOT)
-#        imglist = wx.ImageList(16, 16, True, 2)
-#        imglist.Add(wx.ArtProvider.GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, wx.Size(16, 16)))
-#        imglist.Add(wx.ArtProvider.GetBitmap(wx.ART_EXECUTABLE_FILE, wx.ART_OTHER, wx.Size(16, 16)))
-#        self.CommandsTree.AssignImageList(imglist)
-#        self.CommandsTree.AddRoot('Commands and Settings', 0)
-#
-#        self.ExecuteButton = wx.Button(self, -1, 'Execute')
-#
-#        sizer = wx.BoxSizer(wx.VERTICAL)
-#        sizer.Add(self.CommandsTree, 1, wx.EXPAND)
-#        sizer.Add(self.ExecuteButton, 0, wx.EXPAND)
-#
-#        self.SetSizer(sizer)
-#        sizer.Fit(self)
-#
-#    def Initialize(self, plugins):
-#        tree_root = self.CommandsTree.GetRootItem()
-#        for plugin in plugins:
-#            filename = ''.join([plugin, '.ini'])
-#            path = lh.get_file_path(filename, ['plugins'])
-#            config = ConfigObj()
-#            if os.path.isfile(path):
-#                config.filename = path
-#                config.reload()
-#                #append the ini file to the plugin
-#                plugin_root = self.CommandsTree.AppendItem(tree_root, plugin, 0, data=wx.TreeItemData(config))
-#            else:
-#                plugin_root = self.CommandsTree.AppendItem(tree_root, plugin, 0)
-#
-#            #add all commands to the tree
-#            for command in plugins[plugin]:
-#                command_label = command.replace('do_', '')
-#                #do not add the ini file to the command (we'll access the ini file of the plugin (ie parent) instead, see above)
-#                self.CommandsTree.AppendItem(plugin_root, command_label, 1)
-#            self.CommandsTree.Expand(plugin_root)
 
 def default_settings(self):
     settings = [Setting(