From b2fa922b01b758b92fbe0b4186e0498439758c42 Mon Sep 17 00:00:00 2001 From: Aleksey Lim Date: Mon, 13 Jul 2009 03:18:24 +0000 Subject: [PATCH] Do not fail in <0.86 environment --- src/sugar/graphics/radiopalette.py | 10 ++++++---- src/sugar/graphics/style.py | 2 -- src/sugar/graphics/toolbar.py | 9 ++++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/sugar/graphics/radiopalette.py b/src/sugar/graphics/radiopalette.py index c9387dd8..d7f2d2a5 100644 --- a/src/sugar/graphics/radiopalette.py +++ b/src/sugar/graphics/radiopalette.py @@ -23,6 +23,9 @@ from sugar.graphics.toolbutton import ToolButton from sugar.graphics.palette import Palette from sugar.graphics.radiotoolbutton import RadioToolButton +ARROW_SIZE = hasattr(style, 'TOOLBAR_ARROW_SIZE') and style.TOOLBAR_ARROW_SIZE \ + or 8 + class RadioPaletteButton(ToolButton): def __init__(self, **kwargs): ToolButton.__init__(self, **kwargs) @@ -70,10 +73,9 @@ class RadioMenuButton(RadioPaletteButton): self.get_style().paint_arrow(event.window, gtk.STATE_NORMAL, gtk.SHADOW_IN, event.area, self, None, type, True, - a.x + a.width/2 - style.TOOLBAR_ARROW_SIZE/2, - a.y + a.height - style.TOOLBAR_ARROW_SIZE - \ - style._FOCUS_LINE_WIDTH, - style.TOOLBAR_ARROW_SIZE, style.TOOLBAR_ARROW_SIZE) + a.x + a.width/2 - ARROW_SIZE/2, + a.y + a.height - ARROW_SIZE - style._FOCUS_LINE_WIDTH, + ARROW_SIZE, ARROW_SIZE) class RadioToolsButton(RadioPaletteButton): def __init__(self, **kwargs): diff --git a/src/sugar/graphics/style.py b/src/sugar/graphics/style.py index ed229693..438aab79 100644 --- a/src/sugar/graphics/style.py +++ b/src/sugar/graphics/style.py @@ -132,6 +132,4 @@ COLOR_TEXT_FIELD_GREY = Color('#E5E5E5') PALETTE_CURSOR_DISTANCE = zoom(10) -#TOOLBAR_COLOR = COLOR_BLACK -TOOLBAR_COLOR = COLOR_TOOLBAR_GREY TOOLBAR_ARROW_SIZE = 8 diff --git a/src/sugar/graphics/toolbar.py b/src/sugar/graphics/toolbar.py index 3ae1bb29..b0ba0300 100644 --- a/src/sugar/graphics/toolbar.py +++ b/src/sugar/graphics/toolbar.py @@ -25,6 +25,9 @@ from sugar.graphics.palette import MouseSpeedDetector, Invoker from sugar.graphics import animator from sugar.graphics import palettegroup +ARROW_SIZE = hasattr(style, 'TOOLBAR_ARROW_SIZE') and style.TOOLBAR_ARROW_SIZE \ + or 8 + class ToolbarButton(ToolButton): def __init__(self, **kwargs): self._page = None @@ -403,6 +406,6 @@ def _paint_arrow(widget, event, type): widget.get_style().paint_arrow(event.window, gtk.STATE_NORMAL, gtk.SHADOW_IN, event.area, widget, None, type, True, - a.x + a.width/2 - style.TOOLBAR_ARROW_SIZE/2, - a.y + a.height - style.TOOLBAR_ARROW_SIZE - style._FOCUS_LINE_WIDTH, - style.TOOLBAR_ARROW_SIZE, style.TOOLBAR_ARROW_SIZE) + a.x + a.width/2 - ARROW_SIZE/2, + a.y + a.height - ARROW_SIZE - style._FOCUS_LINE_WIDTH, + ARROW_SIZE, ARROW_SIZE)