Open main menu
Home
Random
Log in
Settings
About Sugar Labs
Disclaimers
Sugar Labs
Search
Changes
← Older edit
Newer edit →
Activity Team/Compatibility Tips
(view source)
Revision as of 18:40, 14 March 2011
152 bytes removed
,
18:40, 14 March 2011
→Sugar toolbar version
Line 76:
Line 76:
Sugar toolbars changed in Sucrose v0.86. You can detect which version you are running by checking for an ImportError:
Sugar toolbars changed in Sucrose v0.86. You can detect which version you are running by checking for an ImportError:
−
try: # 0.86 toolbar widgets
+
try:
# 0.86 toolbar widgets
−
from sugar.bundle.activitybundle import ActivityBundle
+
from sugar.activity.widgets import ActivityToolbarButton
,
StopButton
−
from sugar.activity.widgets import ActivityToolbarButton
+
from sugar.graphics.toolbarbox import ToolbarBox
,
ToolbarButton
−
from sugar.activity.widgets import
StopButton
+
has_toolbarbox
= True
−
from sugar.graphics.toolbarbox import ToolbarBox
−
from sugar.graphics.toolbarbox import
ToolbarButton
−
_new_sugar_system
= True
except ImportError:
except ImportError:
−
_new_sugar_system
= False
+
has_toolbarbox
= False
+
Use the flag to determine whether to create old-style or new toolbars:
Use the flag to determine whether to create old-style or new toolbars:
−
if
_new_sugar_system
:
+
if
has_toolbarbox
:
# Use 0.86+ toolbar design
# Use 0.86+ toolbar design
toolbar_box = ToolbarBox()
toolbar_box = ToolbarBox()
Walter
Bureaucrats
,
Administrators
10,579
edits