Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/atoidepoc/ui/toolbar.py
diff options
context:
space:
mode:
Diffstat (limited to 'atoidepoc/ui/toolbar.py')
-rw-r--r--atoidepoc/ui/toolbar.py72
1 files changed, 60 insertions, 12 deletions
diff --git a/atoidepoc/ui/toolbar.py b/atoidepoc/ui/toolbar.py
index 5caf66f..fa3fed5 100644
--- a/atoidepoc/ui/toolbar.py
+++ b/atoidepoc/ui/toolbar.py
@@ -32,24 +32,52 @@ def _cb_add(widget, toolbar):
def _cb_open(widget, toolbar):
# DEBUG
- logger.debug('[toolbar] _cb_open - name: %s' % toolbar.name)
+ logger.debug('[toolbar] _cb_open - name: %s' % toolbar.name)
def _cb_play(widget, toolbar):
# DEBUG
- logger.debug('[toolbar] _cb_play - name: %s' % toolbar.name)
+ logger.debug('[toolbar] _cb_play - name: %s' % toolbar.name)
+
+
+def _cb_view_fullscreen(widget, toolbar):
+ # DEBUG
+ logger.debug('[toolbar] _cb_fullscreen - name: %s' % toolbar.name)
+ # remove fullscreen button
+ toolbar._remove_button('view_fullscreen')
+ # add return button
+ toolbar._add_button('view_return')
+ # get current screen
+ _screen = toolbar.activity.get_canvas()
+ # enbale fullscreen
+ _screen.set_fullscreen(True)
+
+
+def _cb_view_return(widget, toolbar):
+ # DEBUG
+ logger.debug('[toolbar] _cb_fullscreen - name: %s' % toolbar.name)
+ # remove return button
+ toolbar._remove_button('view_return')
+ # add fullscreen button
+ toolbar._add_button('view_fullscreen')
+ # get current screen
+ _screen = toolbar.activity.get_canvas()
+ # disable fullscreen
+ _screen.set_fullscreen(False)
BUTTONS = {
- 'add' : ['list-add', _cb_add],
- 'open' : ['media', _cb_open],
- 'play' : ['player_play', _cb_play],
+ 'add' : ['list-add', _cb_add],
+ 'open' : ['media', _cb_open],
+ 'play' : ['player_play', _cb_play],
+ 'view_fullscreen' : ['view-fullscreen', _cb_view_fullscreen],
+ 'view_return' : ['view-return', _cb_view_return],
}
TOOLBARS = {
- 'graphic' : ['add',],
- 'sound' : ['add', 'play',],
- 'story' : ['open', 'play',],
+ 'graphic' : ['add',],
+ 'sound' : ['add', 'play',],
+ 'story' : ['view_fullscreen',], # 'open', 'play',
}
TITLES = {
@@ -69,8 +97,10 @@ TITLES = {
'story' : {
'toolbar': _('Story'),
'buttons': {
- 'open': _('Open Story'),
- 'play': _('Play Story'),
+ # 'open': _('Open Story'),
+ # 'play': _('Play Story'),
+ 'view_fullscreen': _('Fullscreen'),
+ 'view_return': _('Default Screen'),
}
},
}
@@ -85,14 +115,17 @@ class Toolbar(gtk.Toolbar):
self.activity = activity
# keep the name
self.set_name(name)
+ # init widget dict
+ self._button_dict = dict()
# add buttons
for _b in TOOLBARS[self.name]:
+ # add button
self._add_button(_b)
# add to parent
_toolbox = self.activity.get_toolbox()
_toolbox.add_toolbar(TITLES[self.name]['toolbar'], self)
# connect focus event
- self.connect('focus', self._on_focus)
+ # self.connect('focus', self._on_focus)
# show
self.show()
@@ -121,10 +154,25 @@ class Toolbar(gtk.Toolbar):
# do connect
_buton.connect('clicked', _cb, self)
# add to the toolbar
- self.insert(_buton, -1)
+ self.add(_buton)
# show it
_buton.show()
+ # update the button dict
+ self._button_dict[button_id] = _buton
# ??
else:
# DEBUG
logger.debug('[toolbar] _add_button - unknown: %s' % button_id)
+
+ def _remove_button(self, button_id):
+ # little check
+ if button_id in self._button_dict:
+ # get button
+ _buton = self._button_dict.pop(button_id)
+ # do remove
+ self.remove(_buton)
+ # ??
+ else:
+ # DEBUG
+ logger.debug('[toolbar] _remove_button - unknown: %s' % button_id)
+