diff options
Diffstat (limited to 'atoidepoc/ui/toolbar.py')
-rw-r--r-- | atoidepoc/ui/toolbar.py | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/atoidepoc/ui/toolbar.py b/atoidepoc/ui/toolbar.py index f7e729c..9d063fc 100644 --- a/atoidepoc/ui/toolbar.py +++ b/atoidepoc/ui/toolbar.py @@ -9,18 +9,38 @@ import gtk # sugar import from sugar.graphics.toolbutton import ToolButton +# atoidepoc import +from atoidepoc.storage import utils +from atoidepoc.ui import screens + # get application logger logger = logging.getLogger('atoidepoc') + def _cb_add(widget, toolbar): - logger.debug('[toolbar] _cb_add - name: %s' % toolbar.name) + # browser screen factory + if toolbar.name == 'graphic': + _cls = screens.ScreenBrowserGraphics + elif toolbar.name == 'sound': + _cls = screens.ScreenBrowserSounds + # ?? + else: + # DEBUG + return logger.debug('[toolbar] _cb_add - unknown: %s' % toolbar.name) + # do switch + _cls(toolbar) + def _cb_open(widget, toolbar): + # DEBUG logger.debug('[toolbar] _cb_open - name: %s' % toolbar.name) + def _cb_play(widget, toolbar): + # DEBUG logger.debug('[toolbar] _cb_play - name: %s' % toolbar.name) + BUTTONS = { 'add' : ['list-add', _cb_add], 'open' : ['media', _cb_open], @@ -55,18 +75,22 @@ TITLES = { }, } + class Toolbar(gtk.Toolbar): - def __init__(self, toolbox, name='player'): + def __init__(self, activity, name='player'): # init parent gtk.Toolbar.__init__(self) + # keep activity + self.activity = activity # keep the name self.set_name(name) # add buttons for _b in TOOLBARS[self.name]: self._add_button(_b) # add to parent - toolbox.add_toolbar(TITLES[self.name]['toolbar'], self) + _toolbox = self.activity.get_toolbox() + _toolbox.add_toolbar(TITLES[self.name]['toolbar'], self) # show self.show() |