Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflorent <florent.pigout@gmail.com>2011-02-01 10:43:58 (GMT)
committer florent <florent.pigout@gmail.com>2011-02-01 10:43:58 (GMT)
commit32c1dae13fc1d56419369437f83a3fc3e27d7695 (patch)
tree6b3c3ea4bc4fe6bf9e2877343436dc1cc69272c5
parentc76c5f15285291fc5d4bbcb9fa13f43f29737b50 (diff)
small toolbar management udpate
-rw-r--r--activity.py15
-rw-r--r--activity/activity-atoidepoc.svg14
-rw-r--r--atoidepoc/ui/toolbar.py72
-rw-r--r--icons/blank0
4 files changed, 69 insertions, 32 deletions
diff --git a/activity.py b/activity.py
index d281fb3..7aee0ef 100644
--- a/activity.py
+++ b/activity.py
@@ -11,10 +11,7 @@ from atoidepoc import ui
# get application logger
logger = logging.getLogger('atoidepoc')
-
-# some logging
-logger.info('0 - activity start ...')
-logger.debug('0 - activity start ...')
+logger.setLevel(logging.DEBUG)
class AToiDePocActivity(activity.Activity):
@@ -28,9 +25,9 @@ class AToiDePocActivity(activity.Activity):
# show
_toolbox.show()
# init toolbars
- ui.Toolbar(_toolbox, name='default')
- # self.set_canvas(self._web_view)
- # _toolbox.set_current_toolbar(1)
+ for _t in ['story', 'graphic', 'sound']:
+ ui.Toolbar(_toolbox, name=_t)
+ # set default tab
+ _toolbox.set_current_toolbar(1)
# some logging
- logger.info('1 - activity start ...')
- logger.debug('1 - activity start ...')
+ logger.debug('[activity] - started ...')
diff --git a/activity/activity-atoidepoc.svg b/activity/activity-atoidepoc.svg
index 3f0b931..bdfad6f 100644
--- a/activity/activity-atoidepoc.svg
+++ b/activity/activity-atoidepoc.svg
@@ -14,9 +14,9 @@
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.47 r22583"
- sodipodi:docname="python-logo-inkscape-mono.svg"
- width="114"
- height="114"
+ sodipodi:docname="activity-atoidepoc.svg"
+ width="55"
+ height="55"
inkscape:output_extension="org.inkscape.output.svg.inkscape">
<metadata
id="metadata371">
@@ -41,9 +41,9 @@
bordercolor="#666666"
pagecolor="#ffffff"
id="base"
- inkscape:zoom="2.1461642"
- inkscape:cx="250.73166"
- inkscape:cy="66.577855"
+ inkscape:zoom="4.2923284"
+ inkscape:cx="63.342591"
+ inkscape:cy="51.710699"
inkscape:window-x="168"
inkscape:window-y="24"
inkscape:current-layer="svg2"
@@ -219,7 +219,7 @@
</defs>
<g
id="g2847"
- transform="translate(-4.5913706,-5.7860522)">
+ transform="matrix(0.46766264,0,0,0.46766264,-1.1078811,-1.5517981)">
<path
id="path1948"
d="m 60.510156,6.3979729 c -4.583653,0.021298 -8.960939,0.4122177 -12.8125,1.09375 C 36.35144,9.4962267 34.291407,13.691825 34.291406,21.429223 l 0,10.21875 26.8125,0 0,3.40625 -26.8125,0 -10.0625,0 c -7.792459,0 -14.6157592,4.683717 -16.7500002,13.59375 -2.46182,10.212966 -2.5710151,16.586023 0,27.25 1.9059283,7.937852 6.4575432,13.593748 14.2500002,13.59375 l 9.21875,0 0,-12.25 c 0,-8.849902 7.657144,-16.656248 16.75,-16.65625 l 26.78125,0 c 7.454951,0 13.406253,-6.138164 13.40625,-13.625 l 0,-25.53125 c 0,-7.266339 -6.12998,-12.7247775 -13.40625,-13.9375001 -4.605987,-0.7667253 -9.385097,-1.1150483 -13.96875,-1.09375 z m -14.5,8.2187501 c 2.769547,0 5.03125,2.298646 5.03125,5.125 -2e-6,2.816336 -2.261703,5.09375 -5.03125,5.09375 -2.779476,-1e-6 -5.03125,-2.277415 -5.03125,-5.09375 -1e-6,-2.826353 2.251774,-5.125 5.03125,-5.125 z"
diff --git a/atoidepoc/ui/toolbar.py b/atoidepoc/ui/toolbar.py
index 96f70f0..f7e729c 100644
--- a/atoidepoc/ui/toolbar.py
+++ b/atoidepoc/ui/toolbar.py
@@ -1,5 +1,6 @@
# python import
+import logging
from gettext import gettext as _
# gtk import
@@ -8,46 +9,85 @@ import gtk
# sugar import
from sugar.graphics.toolbutton import ToolButton
-def _cb(widget, data=None):
- pass
+# get application logger
+logger = logging.getLogger('atoidepoc')
+
+def _cb_add(widget, toolbar):
+ logger.debug('[toolbar] _cb_add - name: %s' % toolbar.name)
+
+def _cb_open(widget, toolbar):
+ logger.debug('[toolbar] _cb_open - name: %s' % toolbar.name)
+
+def _cb_play(widget, toolbar):
+ logger.debug('[toolbar] _cb_play - name: %s' % toolbar.name)
BUTTONS = {
- 'computer': ['computer', 'Computer', _cb]
+ 'add' : ['list-add', _cb_add],
+ 'open' : ['media', _cb_open],
+ 'play' : ['player_play', _cb_play],
}
TOOLBARS = {
- 'default': [
- 'computer'
- ]
+ 'graphic' : ['add'],
+ 'sound' : ['add'],
+ 'story' : ['open', 'play', ],
}
TITLES = {
- 'default': _('Default')
+ 'graphic' : {
+ 'toolbar': _('Graphic'),
+ 'buttons': {
+ 'add': _('Add Graphic'),
+ }
+ },
+ 'sound' : {
+ 'toolbar': _('Sound'),
+ 'buttons': {
+ 'add': _('Add Sound'),
+ }
+ },
+ 'story' : {
+ 'toolbar': _('Story'),
+ 'buttons': {
+ 'open': _('Open Story'),
+ 'play': _('Play Story'),
+ }
+ },
}
class Toolbar(gtk.Toolbar):
- def __init__(self, toolbox, name='default'):
+ def __init__(self, toolbox, name='player'):
# init parent
gtk.Toolbar.__init__(self)
+ # keep the name
+ self.set_name(name)
# add buttons
- for _b in TOOLBARS[name]:
+ for _b in TOOLBARS[self.name]:
self._add_button(_b)
# add to parent
- toolbox.add_toolbar(TITLES[name], self)
+ toolbox.add_toolbar(TITLES[self.name]['toolbar'], self)
# show
self.show()
def _add_button(self, button_id):
- # ...
+ # little check
if button_id in BUTTONS:
- _icon, _tooltip, _cb = BUTTONS[button_id]
- # ...
+ # get button icon and cb
+ _icon, _cb = BUTTONS[button_id]
+ # get tooltip
+ _tooltip = TITLES[self.name]['buttons'][button_id]
+ # set icon
_buton = ToolButton(_icon)
+ # set tooltip
_buton.set_tooltip(_tooltip)
- _buton.connect('clicked', _cb)
+ # do connect
+ _buton.connect('clicked', _cb, self)
+ # add to the toolbar
self.insert(_buton, -1)
+ # show it
_buton.show()
- # ...
+ # ??
else:
- pass
+ # DEBUG
+ logger.debug('[toolbar] _add_button - unknown: %s' % button_id)
diff --git a/icons/blank b/icons/blank
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/icons/blank