diff options
Diffstat (limited to 'sugardummy.py')
-rw-r--r-- | sugardummy.py | 57 |
1 files changed, 51 insertions, 6 deletions
diff --git a/sugardummy.py b/sugardummy.py index 21288c2..6a2f796 100644 --- a/sugardummy.py +++ b/sugardummy.py @@ -6,6 +6,8 @@ class activity: # Dummy class for Activity class Activity: + _canvas = None + _toobox = None def __init__(self, handle): self.window = gtk.Window() @@ -13,24 +15,67 @@ class activity: self.window.connect("destroy", gtk.main_quit) def set_canvas(self, canvas): - self.window.add(canvas) + self._canvas = canvas def show_all(self): + vbox = gtk.VBox(False) + vbox.pack_start(self._toolbox, True, True, 0) + vbox.pack_start(self._canvas, True, True, 0) + self.window.add(vbox) self.window.show_all() def create_pango_context(self): return gtk.Widget.create_pango_context(self.window) def set_toolbox(self, toolbox): - pass + self._toolbox = toolbox # Dummy class for Toolbox - class ActivityToolbox: + class ActivityToolbox(gtk.Toolbar): def __init__(self, window): - pass + gtk.Toolbar.__init__(self) + self.toolbars = {} def show(self): - pass -
\ No newline at end of file + for t in self.toolbars.itervalues(): + for i in t.myitems: + action = gtk.Action(i.id, i.tooltip, i.tooltip, gtk.STOCK_INFO) + if 'clicked' in i.methods: + action.connect('activate', i.methods['clicked']) + item = action.create_tool_item() + gtk.Toolbar.insert(self, item, -1) + + def add_toolbar(self, name, toolbar): + self.toolbars[name] = toolbar + + +# Dummy class for Toolbar +class Toolbar: + + def __init__(self): + self.myitems = [] + + def insert(self, tool, index): + self.myitems.insert(index, tool) + + +# Dummy class for ToolButton +class ToolButton: + + def __init__(self, id): + self.id = id + self.tooltip = '' + self.methods = {} + + def set_tooltip(self, text): + self.tooltip = text + + def set_accelerator(self, key): + pass + + def connect(self, event, callback): + self.methods[event] = callback + + |