Do not fail in <0.86 environment

This commit is contained in:
Aleksey Lim 2009-07-13 03:18:24 +00:00
parent 165b9e1e05
commit b2fa922b01
3 changed files with 12 additions and 9 deletions

View File

@ -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):

View File

@ -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

View File

@ -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)