Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2011-07-09 21:27:31 (GMT)
committer Walter Bender <walter.bender@gmail.com>2011-07-09 21:27:31 (GMT)
commite0639d3df7aa60846f950970bdeb0ca5733e01bc (patch)
tree2163c9961e4cbb5dfffdb2c1a198429203841d06
parent0589f70b7c91a814cd5db14c5c2857a7203a7f87 (diff)
replaced hippo with a container
-rw-r--r--src/sugar/graphics/toolbox.py56
1 files changed, 47 insertions, 9 deletions
diff --git a/src/sugar/graphics/toolbox.py b/src/sugar/graphics/toolbox.py
index 9f29281..e368d94 100644
--- a/src/sugar/graphics/toolbox.py
+++ b/src/sugar/graphics/toolbox.py
@@ -21,10 +21,55 @@ STABLE.
import gtk
import gobject
-import hippo
from sugar.graphics import style
+class ToolboxContainer(gtk.Container):
+ __gtype_name__ = 'SugarToolboxContainer'
+
+ def __init__(self, **kwargs):
+ gobject.GObject.__init__(self, **kwargs)
+
+ super(ToolboxContainer, self).__init__()
+
+ def do_realize(self):
+ self.set_flags(self.flags() | gtk.REALIZED)
+
+ self.window = gtk.gdk.Window(
+ self.get_parent_window(),
+ width=self.allocation.width,
+ height=self.allocation.height,
+ window_type=gtk.gdk.WINDOW_CHILD,
+ wclass=gtk.gdk.INPUT_OUTPUT,
+ event_mask=self.get_events() | gtk.gdk.EXPOSURE_MASK
+ | gtk.gdk.BUTTON1_MOTION_MASK
+ | gtk.gdk.BUTTON_PRESS_MASK
+ | gtk.gdk.POINTER_MOTION_MASK
+ | gtk.gdk.POINTER_MOTION_HINT_MASK)
+ self.window.set_user_data(self)
+
+ self.style.attach(self.window)
+ self.style.set_background(self.window, gtk.STATE_NORMAL)
+ self.window.move_resize(*self.allocation)
+ self.gc = self.style.fg_gc[gtk.STATE_NORMAL]
+
+ self.modify_bg(gtk.STATE_NORMAL,
+ style.COLOR_PANEL_GREY.get_gdk_color())
+
+ def do_size_request(self, requisition):
+ requisition.height = style.TOOLBOX_SEPARATOR_HEIGHT
+ # TODO: calculate our mininum width size
+ requisition.width = 200
+
+ def do_size_allocate(self, allocation):
+ if self.flags() & gtk.REALIZED:
+ self.window.move_resize(*allocation)
+
+ width, height = allocation.width, allocation.height
+
+ def do_remove(self, child):
+ pass
+
class Toolbox(gtk.VBox):
@@ -47,14 +92,7 @@ class Toolbox(gtk.VBox):
self.pack_start(self._notebook)
self._notebook.show()
- # FIXME improve gtk.Notebook and do this in the theme
- self._separator = hippo.Canvas()
- box = hippo.CanvasBox(
- border_color=style.COLOR_BUTTON_GREY.get_int(),
- background_color=style.COLOR_PANEL_GREY.get_int(),
- box_height=style.TOOLBOX_SEPARATOR_HEIGHT,
- border_bottom=style.LINE_WIDTH)
- self._separator.set_root(box)
+ self._separator = ToolboxContainer()
self.pack_start(self._separator, False)
self._notebook.connect('notify::page', self._notify_page_cb)