Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt
diff options
context:
space:
mode:
Diffstat (limited to 'TurtleArt')
-rw-r--r--TurtleArt/taconstants.py17
-rw-r--r--TurtleArt/tapalette.py19
-rw-r--r--TurtleArt/tawindow.py41
3 files changed, 34 insertions, 43 deletions
diff --git a/TurtleArt/taconstants.py b/TurtleArt/taconstants.py
index c05cdff..adf5a15 100644
--- a/TurtleArt/taconstants.py
+++ b/TurtleArt/taconstants.py
@@ -188,23 +188,6 @@ TEMPLATES = {'t1x1': (0.5, 0.5, 0.0625, 0.125, 1.05, 0),
'insertimage': (0.333, 0.333)}
#
-# Help messages
-#
-HELP_STRINGS = {
- 'cartesian': _("displays Cartesian coordinates"),
- 'clean': _("clears the screen and reset the turtle"),
- 'debugoff': _("Debug"),
- 'eraseron': _("Clean"),
- 'next': _('displays next palette'),
- 'orientation': _("changes the orientation of the palette of blocks"),
- 'polar': _("displays polar coordinates"),
- 'run-fastoff': _("Run"),
- 'run-slowoff': _("Step"),
- 'savepix': _("saves a picture to the Sugar Journal"),
- 'savesvg': _("saves turtle graphics as an SVG file in the Sugar Journal"),
- 'stopiton': _("Stop turtle")}
-
-#
# 'dead key' Unicode dictionaries
#
diff --git a/TurtleArt/tapalette.py b/TurtleArt/tapalette.py
index ada0040..8d98a2f 100644
--- a/TurtleArt/tapalette.py
+++ b/TurtleArt/tapalette.py
@@ -69,16 +69,23 @@ block_styles = {'basic-style-head': [],
'portfolio-style-2x1': [],
'portfolio-style-1x2': []}
-from taconstants import HELP_STRINGS, EXPANDABLE_STYLE
+from taconstants import EXPANDABLE_STYLE
from tautils import debug_output
+from gettext import gettext as _
+
+help_strings = {
+ 'next': _('displays next palette'),
+ 'orientation': _("changes the orientation of the palette of blocks")
+ }
+
class Palette():
""" a class for defining new palettes """
def __init__(self, name, colors=["#00FF00", "#00A000"], position=None):
self._name = name
- self._special_name = name
+ self._special_name = _(name)
self._colors = colors
self._help = None
@@ -107,9 +114,9 @@ class Palette():
# Special name entry is needed for help hover mechanism
special_names[self._name] = self._special_name
if self._help is not None:
- HELP_STRINGS[self._name] = self._help
+ help_strings[self._name] = self._help
else:
- HELP_STRINGS[self._name] = ''
+ help_strings[self._name] = ''
def set_help(self, help):
self._help = help
@@ -196,9 +203,9 @@ class Block():
debug_output('Ignoring position (%s)' % (str(position)))
if self._help is not None:
- HELP_STRINGS[self._name] = self._help
+ help_strings[self._name] = self._help
else:
- HELP_STRINGS[self._name] = ''
+ help_strings[self._name] = ''
if self._value_block:
value_blocks.append(self._name)
diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py
index 28a8def..0aff62e 100644
--- a/TurtleArt/tawindow.py
+++ b/TurtleArt/tawindow.py
@@ -55,12 +55,13 @@ from taconstants import HORIZONTAL_PALETTE, VERTICAL_PALETTE, BLOCK_SCALE, \
TOOLBAR_SHAPES, TAB_LAYER, RETURN, OVERLAY_LAYER, CATEGORY_LAYER, \
BLOCKS_WITH_SKIN, ICON_SIZE, PALETTE_SCALE, PALETTE_WIDTH, \
MACROS, TOP_LAYER, BLOCK_LAYER, OLD_NAMES, DEFAULT_TURTLE, TURTLE_LAYER, \
- HELP_STRINGS, CURSOR, EXPANDABLE, COLLAPSIBLE, DEAD_DICTS, DEAD_KEYS, \
+ CURSOR, EXPANDABLE, COLLAPSIBLE, DEAD_DICTS, DEAD_KEYS, \
TEMPLATES, PYTHON_SKIN, PALETTE_HEIGHT, STATUS_LAYER, OLD_DOCK, \
EXPANDABLE_ARGS, CONSTANTS, XO1, XO15, UNKNOWN, TITLEXY, \
CONTENT_ARGS
from tapalette import palette_names, palette_blocks, expandable_blocks, \
- block_names, content_blocks, default_values, special_names, block_styles
+ block_names, content_blocks, default_values, special_names, block_styles, \
+ help_strings
from talogo import LogoCode
from tacanvas import TurtleGraphics
from tablock import Blocks, Block
@@ -156,7 +157,7 @@ class TurtleArtWindow():
self.color_mode = '565'
else:
self.color_mode = '888'
- if self.running_sugar and not self.activity.new_sugar_system:
+ if self.running_sugar and not self.activity.has_toolbarbox:
self.orientation = VERTICAL_PALETTE
else:
self.lead = 1.0
@@ -503,7 +504,7 @@ class TurtleArtWindow():
if blk.status != 'collapsed':
blk.spr.set_layer(BLOCK_LAYER)
self.show_palette()
- if self.activity is not None and self.activity.new_sugar_system:
+ if self.activity is not None and self.activity.has_toolbarbox:
self.activity.palette_buttons[0].set_icon(
palette_names[0] + 'on')
self.hide = False
@@ -531,7 +532,7 @@ class TurtleArtWindow():
self._show_toolbar_palette(n)
self.palette_button[self.orientation].set_layer(TAB_LAYER)
self.palette_button[2].set_layer(TAB_LAYER)
- if self.activity is None or not self.activity.new_sugar_system:
+ if self.activity is None or not self.activity.has_toolbarbox:
self.toolbar_spr.set_layer(CATEGORY_LAYER)
self.palette = True
@@ -540,7 +541,7 @@ class TurtleArtWindow():
self._hide_toolbar_palette()
self.palette_button[self.orientation].hide()
self.palette_button[2].hide()
- if self.activity is None or not self.activity.new_sugar_system:
+ if self.activity is None or not self.activity.has_toolbarbox:
self.toolbar_spr.hide()
self.palette = False
@@ -597,7 +598,7 @@ class TurtleArtWindow():
def _show_toolbar_palette(self, n, init_only=False):
""" Show the toolbar palettes, creating them on init_only """
- if (self.activity is None or not self.activity.new_sugar_system) and\
+ if (self.activity is None or not self.activity.has_toolbarbox) and\
self.selectors == []:
# Create the selectors
svg = SVG()
@@ -676,7 +677,7 @@ class TurtleArtWindow():
self.selected_palette = n
self.previous_palette = self.selected_palette
- if self.activity is None or not self.activity.new_sugar_system:
+ if self.activity is None or not self.activity.has_toolbarbox:
self.selected_selector = self.selectors[n]
# Make sure all of the selectors are visible.
self.selectors[n].set_shape(self.selector_shapes[n][1])
@@ -717,7 +718,7 @@ class TurtleArtWindow():
def _hide_toolbar_palette(self):
""" Hide the toolbar palettes """
self._hide_previous_palette()
- if self.activity is None or not self.activity.new_sugar_system:
+ if self.activity is None or not self.activity.has_toolbarbox:
# Hide the selectors
for i in range(len(palette_blocks)):
self.selectors[i].hide()
@@ -735,7 +736,7 @@ class TurtleArtWindow():
self.palettes[self.previous_palette][i].spr.hide()
self.palette_sprs[self.previous_palette][
self.orientation].hide()
- if self.activity is None or not self.activity.new_sugar_system:
+ if self.activity is None or not self.activity.has_toolbarbox:
self.selectors[self.previous_palette].set_shape(
self.selector_shapes[self.previous_palette][0])
elif self.previous_palette is not None and \
@@ -948,7 +949,7 @@ class TurtleArtWindow():
if i == len(palette_names):
i = 0
if self.activity is None or \
- not self.activity.new_sugar_system:
+ not self.activity.has_toolbarbox:
self._select_category(self.selectors[i])
else:
if self.selected_palette is not None:
@@ -1452,20 +1453,20 @@ class TurtleArtWindow():
def _do_show_popup(self, block_name):
""" Fetch the help text and display it. """
if block_name in special_names:
- block_name_s = special_names[block_name]
+ special_block_name = special_names[block_name]
elif block_name in block_names:
- block_name_s = block_names[block_name][0]
+ special_block_name = block_names[block_name][0]
elif block_name in TOOLBAR_SHAPES:
- block_name_s = ''
+ special_block_name = ''
else:
- block_name_s = _(block_name)
- if block_name in HELP_STRINGS:
- if block_name_s == '':
- label = HELP_STRINGS[block_name]
+ special_block_name = _(block_name)
+ if block_name in help_strings:
+ if special_block_name == '':
+ label = help_strings[block_name]
else:
- label = block_name_s + ": " + HELP_STRINGS[block_name]
+ label = special_block_name + ": " + help_strings[block_name]
else:
- label = block_name_s
+ label = special_block_name
if self.running_sugar:
self.activity.hover_help_label.set_text(label)
self.activity.hover_help_label.show()