--- /dev/null
+# Copyright (C) 2006 by Aiwota Programmer
+# aiwotaprog@tetteke.tk
+#
+# 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
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+# base class for Board Plugin
+class BoardPluginBase:
+
+ # second argument is GtkTreeView widget
+ # third argument is GtkMenuItem widget
+ def __init__(self, widget_tree):
+ self.widget_tree = widget_tree
+ self.initialize()
+
+ # please override
+ def initialize(self):
+ pass
import itertools
import config
+from board_plugin_base import BoardPluginBase
base_path = os.path.join(config.get_config_dir_path(), "scripts")
-version = (0, 1)
+version = (0, 2)
def generate_board_plugin():
plugin_list = []
else:
return version[1] <= plugin_version[1]
-def load_plugin(plugin_module, treeview, menuitem):
+def load_plugin(plugin_module, widget_tree):
try:
if check_compatible(plugin_module.version):
- plugin_module.BoardPlugin(treeview, menuitem)
+ klass = plugin_module.BoardPlugin
+ if issubclass(klass, BoardPluginBase):
+ klass(widget_tree)
+ else:
+ print klass, "is not subclass of BoardPluginBase"
else:
print plugin_module.__file__, "not compatible", \
plugin_module.version
except:
traceback.print_exc()
-def load(treeview, menuitem):
- for i in itertools.imap(lambda e: load_plugin(e, treeview, menuitem),
+def load(widget_tree):
+ for i in itertools.imap(lambda e: load_plugin(e, widget_tree),
generate_board_plugin()): -1
self.treeview.set_fixed_height_mode(True)
# menu plugins
- board_plugins.load(self.treeview, self.menu_edit)
+ board_plugins.load(self.widget_tree)
self.restore()
self.window.show()
self.filterbar = self.widget_tree.get_widget(
"bonobodockitem_filterbar")
self.entry_filterbar = self.widget_tree.get_widget("entry_filterbar")
- self.menu_edit = self.widget_tree.get_widget("menu_edit").get_submenu()
def set_status(self, text):
self.statusbar.set_status(text)