diff options
Diffstat (limited to 'TurtleArt')
-rw-r--r-- | TurtleArt/tabasics.py | 60 | ||||
-rw-r--r-- | TurtleArt/talogo.py | 1 | ||||
-rw-r--r-- | TurtleArt/tautils.py | 11 |
3 files changed, 39 insertions, 33 deletions
diff --git a/TurtleArt/tabasics.py b/TurtleArt/tabasics.py index c88dfd9..e8d9378 100644 --- a/TurtleArt/tabasics.py +++ b/TurtleArt/tabasics.py @@ -330,36 +330,6 @@ in place of a number block)'), define_logo_function('tapensize', 'to tapensize\routput first round \ pensize\rend\r') - palette.add_block('startfill', - style='basic-style-extended-vertical', - label=_('start fill'), - prim_name='startfill', - help_string=_('starts filled polygon (used with end \ -fill block)')) - self.tw.lc.def_prim('startfill', 0, - lambda self: self.tw.canvas.start_fill()) - - palette.add_block('stopfill', - style='basic-style-extended-vertical', - label=_('end fill'), - prim_name='stopfill', - help_string=_('completes filled polygon (used with \ -start fill block)')) - self.tw.lc.def_prim('stopfill', 0, - lambda self: self.tw.canvas.stop_fill()) - - def _color_palette(self): - """ The basic Turtle Art color palette """ - - if self.tw.hw == XO30: - palette = make_palette('pen', - colors=["#00FFFF", "#00A0A0"], - help_string=_('Palette of pen colors')) - else: - palette = make_palette('colors', - colors=["#00FFFF", "#00A0A0"], - help_string=_('Palette of pen colors')) - palette.add_block('setcolor', style='basic-style-1arg', label=_('set color'), @@ -423,6 +393,36 @@ used in place of a number block)'), prim_name='gray') self.tw.lc.def_prim('gray', 0, lambda self: self.tw.canvas.gray) + palette.add_block('startfill', + style='basic-style-extended-vertical', + label=_('start fill'), + prim_name='startfill', + help_string=_('starts filled polygon (used with end \ +fill block)')) + self.tw.lc.def_prim('startfill', 0, + lambda self: self.tw.canvas.start_fill()) + + palette.add_block('stopfill', + style='basic-style-extended-vertical', + label=_('end fill'), + prim_name='stopfill', + help_string=_('completes filled polygon (used with \ +start fill block)')) + self.tw.lc.def_prim('stopfill', 0, + lambda self: self.tw.canvas.stop_fill()) + + def _color_palette(self): + """ The basic Turtle Art color palette """ + + if self.tw.hw == XO30: + palette = make_palette('pen', + colors=["#00FFFF", "#00A0A0"], + help_string=_('Palette of pen colors')) + else: + palette = make_palette('colors', + colors=["#00FFFF", "#00A0A0"], + help_string=_('Palette of pen colors')) + self._make_constant(palette, 'red', _('red'), CONSTANTS['red']) self._make_constant(palette, 'orange', _('orange'), CONSTANTS['orange']) diff --git a/TurtleArt/talogo.py b/TurtleArt/talogo.py index e935ea3..3b55281 100644 --- a/TurtleArt/talogo.py +++ b/TurtleArt/talogo.py @@ -150,7 +150,6 @@ class LogoCode: def stop_logo(self): """ Stop logo is called from the Stop button on the toolbar """ - self.tw.step_time = 0 self.step = _just_stop() for plugin in self.tw._plugins: plugin.stop() diff --git a/TurtleArt/tautils.py b/TurtleArt/tautils.py index 40c39e9..d60884e 100644 --- a/TurtleArt/tautils.py +++ b/TurtleArt/tautils.py @@ -235,8 +235,15 @@ def data_from_file(ta_file): def data_from_string(text): ''' JSON load data from a string. ''' - return json_load(text.replace(']],\n', ']], ')) - + if type(text) == str: + return json_load(text.replace(']],\n', ']], ')) + else: + print type(text), text + if hasattr('replace', text): + return json_load(text.replace(']],\n', ']], ')) + else: + print 'type error in data_from_string' + return '' def data_to_file(data, ta_file): ''' Write data to a file. ''' |