Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TurtleArt/tapalette.py11
-rw-r--r--TurtleArt/tawindow.py11
-rw-r--r--samples/math-galton-path.ta117
-rw-r--r--samples/media-music.ta2
4 files changed, 77 insertions, 64 deletions
diff --git a/TurtleArt/tapalette.py b/TurtleArt/tapalette.py
index ad96103..2af8ff1 100644
--- a/TurtleArt/tapalette.py
+++ b/TurtleArt/tapalette.py
@@ -22,6 +22,7 @@
help_palettes = {}
help_windows = {}
palette_names = []
+palette_init_on_start = []
palette_blocks = []
block_colors = []
expandable_blocks = []
@@ -125,7 +126,7 @@ class Palette():
self._help_box = help_palettes[self._name]
self._help = 'deja vu'
- def add_palette(self, position=None):
+ def add_palette(self, position=None, init_on_start=False):
if self._name is None:
debug_output('You must specify a name for your palette')
return
@@ -143,6 +144,9 @@ class Palette():
palette_names.insert(i, self._name)
palette_blocks.insert(i, [])
block_colors.insert(i, self._colors)
+ if init_on_start:
+ if not self._name in palette_init_on_start:
+ palette_init_on_start.append(self._name)
else:
return
@@ -211,7 +215,8 @@ class Palette():
block.add_block()
-def make_palette(palette_name, colors=None, help_string=None, position=None):
+def make_palette(palette_name, colors=None, help_string=None, position=None,
+ init_on_start=False):
""" Palette helper function """
if colors is None:
palette = Palette(palette_name)
@@ -219,7 +224,7 @@ def make_palette(palette_name, colors=None, help_string=None, position=None):
palette = Palette(palette_name, colors)
if help_string is not None:
palette.set_help(help_string)
- palette.add_palette(position)
+ palette.add_palette(position, init_on_start=init_on_start)
return palette
diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py
index c555261..067f5a4 100644
--- a/TurtleArt/tawindow.py
+++ b/TurtleArt/tawindow.py
@@ -55,7 +55,7 @@ from taconstants import HORIZONTAL_PALETTE, VERTICAL_PALETTE, BLOCK_SCALE, \
from tapalette import palette_names, palette_blocks, expandable_blocks, \
block_names, content_blocks, default_values, special_names, block_styles, \
help_strings, hidden_proto_blocks, string_or_number_args, \
- make_palette, palette_name_to_index
+ make_palette, palette_name_to_index, palette_init_on_start
from talogo import LogoCode, primitive_dictionary, logoerror
from tacanvas import TurtleGraphics
from tablock import Blocks, Block
@@ -266,8 +266,13 @@ class TurtleArtWindow():
if self.interactive_mode:
self._setup_misc()
- self.show_toolbar_palette(0, False)
-
+ for name in palette_init_on_start:
+ debug_output('initing palette %s' % (name), self.running_sugar)
+ self.show_toolbar_palette(palette_names.index(name),
+ init_only=False, regenerate=True,
+ show=False)
+ self.show_toolbar_palette(0, init_only=False, regenerate=True,
+ show=True)
self.saved_pictures = []
self.block_operation = ''
diff --git a/samples/math-galton-path.ta b/samples/math-galton-path.ta
index b3f1567..1a70651 100644
--- a/samples/math-galton-path.ta
+++ b/samples/math-galton-path.ta
@@ -1,57 +1,60 @@
-[[0, ["start", 1.5], 64, 216, [null, 27]],
-[1, ["setxy2", 0], 792, 245, [4, 2, 3, 11]],
-[2, ["number", 0], 845, 245, [1, null]],
-[3, "toppos", 845, 277, [1, null]],
-[4, "penup", 792, 213, [22, 1]],
-[5, "repeat", 792, 340, [11, 6, 8, 7]],
-[6, ["number", 70], 836, 340, [5, null]],
-[7, ["vspace", 80], 792, 399, [5, 41]],
-[8, ["setxy2", 60], 846, 385, [5, 16, 14, null]],
-[9, ["number", -0.5], 1022, 449, [23, null]],
-[10, ["number", -10], 940, 539, [14, null]],
-[11, "pendown", 792, 308, [1, 5]],
-[12, "setpensize", 64, 280, [27, 13, 28]],
-[13, ["number", 1], 159, 280, [12, null]],
-[14, ["plus2", 0], 899, 507, [8, 15, 10]],
-[15, "ycor", 940, 507, [14, null]],
-[16, ["plus2", 0], 899, 385, [8, 17, 24]],
-[17, "xcor", 940, 385, [16, null]],
-[18, ["random", 0], 1022, 481, [23, 19, 20, null]],
-[19, ["number", 0], 1098, 481, [18, null]],
-[20, ["number", 1], 1098, 513, [18, null]],
-[21, "stack1", 118, 509, [26, null]],
-[22, "hat1", 792, 181, [null, 4]],
-[23, ["plus2", 0], 981, 449, [24, 9, 18]],
-[24, ["product2", 0], 940, 417, [16, 25, 23]],
-[25, ["number", 20], 981, 417, [24, null]],
-[26, "forever", 64, 495, [32, 21, null]],
-[27, "clean", 64, 248, [0, 12]],
-[28, "storeinbox1", 64, 312, [12, 29, 30]],
-[29, ["number", -400], 174, 312, [28, null]],
-[30, "repeat", 64, 344, [28, 31, 33, 32]],
-[31, ["number", 80], 108, 344, [30, null]],
-[32, ["vspace", 40], 64, 403, [30, 26]],
-[33, ["storein", 0], 118, 389, [30, 35, 34, 36]],
-[34, ["number", 0], 180, 421, [33, null]],
-[35, "box1", 180, 389, [33, null]],
-[36, "storeinbox1", 118, 452, [33, 39, null]],
-[37, ["number", 10], 269, 484, [39, null]],
-[38, "box1", 269, 452, [39, null]],
-[39, ["plus2", 0], 228, 452, [36, 38, 37]],
-[40, ["storein", 0], 485, 196, [42, 50, 45, 48]],
-[41, "stack2", 792, 551, [7, null]],
-[42, "hat2", 485, 164, [null, 40]],
-[43, "box", 588, 228, [45, 51, null]],
-[44, "ycor", 237, 0, [null, null]],
-[45, ["plus2", 0], 547, 228, [40, 43, 46]],
-[46, ["number", 1], 588, 260, [45, null]],
-[47, "forward", 485, 323, [53, 49, 55]],
-[48, ["vspace", 0], 485, 259, [40, 53]],
-[49, "box", 549, 323, [47, 52, null]],
-[50, "xcor", 547, 196, [40, null]],
-[51, "xcor", 635, 228, [43, null]],
-[52, "xcor", 596, 323, [49, null]],
-[53, "setpensize", 485, 291, [48, 54, 47]],
-[54, ["number", 18], 580, 291, [53, null]],
-[55, "setpensize", 485, 355, [47, 56, null]],
-[56, ["number", 1], 580, 355, [55, null]]] \ No newline at end of file
+[[0, ["start", 1.5], 21, 19, [null, 27]],
+[1, ["setxy2", 0], 483, 76, [4, 2, 3, 11]],
+[2, ["number", 0], 529, 76, [1, null]],
+[3, "toppos", 529, 108, [1, null]],
+[4, "penup", 483, 44, [22, 1]],
+[5, "repeat", 483, 171, [11, 6, 8, 7]],
+[6, ["number", 70], 523, 171, [5, null]],
+[7, ["vspace", 80], 483, 230, [5, 35]],
+[8, ["setxy2", 80], 533, 216, [5, 16, 14, null]],
+[9, ["number", -0.5], 702, 280, [23, null]],
+[10, ["number", -10], 620, 400, [14, null]],
+[11, "pendown", 483, 139, [1, 5]],
+[12, "setpensize", 21, 83, [27, 13, 52]],
+[13, ["number", 1], 103, 83, [12, null]],
+[14, ["plus2", 0], 579, 368, [8, 15, 10]],
+[15, "ycor", 620, 368, [14, null]],
+[16, ["plus2", 0], 579, 216, [8, 17, 24]],
+[17, "xcor", 620, 216, [16, null]],
+[18, ["random", 0], 702, 312, [23, 19, 20, null]],
+[19, ["number", 0], 777, 312, [18, null]],
+[20, ["number", 1], 777, 344, [18, null]],
+[21, "stack1", 98, 437, [26, null]],
+[22, "hat1", 483, 12, [null, 4]],
+[23, ["plus2", 0], 661, 280, [24, 9, 18]],
+[24, ["product2", 0], 620, 248, [16, 25, 23]],
+[25, ["number", 20], 661, 248, [24, null]],
+[26, "forever", 21, 423, [53, 21, null]],
+[27, "clean", 21, 51, [0, 12]],
+[28, ["number", -400], 67, 147, [50, null]],
+[29, "repeat", 21, 210, [50, 30, 32, 31]],
+[30, ["number", 80], 61, 210, [29, null]],
+[31, ["vspace", 60], 21, 269, [29, 53]],
+[32, ["storein", 0], 71, 255, [29, 55, 33, 56]],
+[33, ["number", 0], 148, 287, [32, null]],
+[34, ["storein", 0], 231, 47, [36, 43, 38, 41]],
+[35, "stack2", 483, 382, [7, null]],
+[36, "hat2", 231, 15, [null, 34]],
+[37, "box", 349, 79, [38, 44, null]],
+[38, ["plus2", 0], 308, 79, [34, 37, 39]],
+[39, ["number", 1], 349, 111, [38, null]],
+[40, "forward", 231, 174, [46, 42, 48]],
+[41, ["vspace", 0], 231, 110, [34, 46]],
+[42, "box", 294, 174, [40, 45, null]],
+[43, "xcor", 308, 47, [34, null]],
+[44, "xcor", 394, 79, [37, null]],
+[45, "xcor", 339, 174, [42, null]],
+[46, "setpensize", 231, 142, [41, 47, 40]],
+[47, ["number", 18], 313, 142, [46, null]],
+[48, "setpensize", 231, 206, [40, 49, null]],
+[49, ["number", 1], 313, 206, [48, null]],
+[50, ["setxy2", 0], 21, 147, [52, 28, 51, 29]],
+[51, ["number", 0], 67, 179, [50, null]],
+[52, "penup", 21, 115, [12, 50]],
+[53, "pendown", 21, 391, [31, 26]],
+[54, ["number", 10], 158, 350, [59, null]],
+[55, "xcor", 148, 255, [32, null]],
+[56, ["setxy2", 20], 71, 318, [32, 59, 57, null]],
+[57, ["number", 0], 117, 380, [56, null]],
+[58, "xcor", 158, 318, [59, null]],
+[59, ["plus2", 0], 117, 318, [56, 58, 54]]]
diff --git a/samples/media-music.ta b/samples/media-music.ta
index cfcdc6b..13d952c 100644
--- a/samples/media-music.ta
+++ b/samples/media-music.ta
@@ -59,7 +59,7 @@
[58, ["number", 0.33], 171, 670, [57, null]],
[59, "chr", 314, 312, [55, 54]],
[60, "chr", 873, 144, [24, 26]],
-[61, ["number", 1.06], 259, 270, [64, null]],
+[61, ["number", 1.059463094], 259, 270, [64, null]],
[62, "comment", 61, 186, [74, 63, 66]],
[63, ["string", "2^^(1/12) is factor between half-steps"], 144, 186, [62, null]],
[64, ["myfunc2arg", 0], 179, 228, [66, 65, 61, 55, null]],