Web · Wiki · Activities · Blog · Lists · Chat · Meeting · Bugs · Git · Translate · Archive · People · Donate

Commit 18ddba47083044f35d10d19cdfd155ea21df1047

fixed Logo export bug
  
1919#THE SOFTWARE.
2020
2121IGNORE = ["hideblocks", "showblocks", "fullscreen", "polar", "cartesian",
22 "sandwichbottom"]
22 "sandwichbottom", "id"]
2323
2424import math
2525from tautils import walk_stack
4040make \"b (:b * :s) \r\
4141] [ \
4242make \"s (:s * 0.9) \r\
43make \"r (:r + ((100-:r) * :s)) \r\
44make \"g (:g + ((100-:g) * :s)) \r\
45make \"b (:b + ((100-:b) * :s)) \r\
43make \"r (:r + ((99-:r) * :s)) \r\
44make \"g (:g + ((99-:g) * :s)) \r\
45make \"b (:b + ((99-:b) * :s)) \r\
4646] \
4747setpalette :i (list :r :g :b) \r\
4848end \r\
7878end \r\
7979\
8080make \"colors [ \
81100 0 0 100 5 0 100 10 0 100 15 0 100 20 0 \
82100 25 0 100 30 0 100 35 0 100 40 0 100 45 0 \
83100 50 0 100 55 0 100 60 0 100 65 0 100 70 0 \
84100 75 0 100 80 0 100 85 0 100 90 0 100 95 0 \
85100 100 0 90 100 0 80 100 0 70 100 0 60 100 0 \
8650 100 0 40 100 0 30 100 0 20 100 0 10 100 0 \
870 100 0 0 100 5 0 100 10 0 100 15 0 100 20 0 \
88100 25 0 100 30 0 100 35 0 100 40 0 100 45 \
890 100 50 0 100 55 0 100 60 0 100 65 0 100 70 \
900 100 75 0 100 80 0 100 85 0 100 90 0 100 95 \
910 100 100 0 95 100 0 90 100 0 85 100 0 80 100 \
920 75 100 0 70 100 0 65 100 0 60 100 0 55 100 \
930 50 100 0 45 100 0 40 100 0 35 100 0 30 100 \
940 25 100 0 20 100 0 15 100 0 10 100 0 5 100 \
950 0 100 5 0 100 10 0 100 15 0 100 20 0 100 25 \
960 100 30 0 100 35 0 100 40 0 100 45 0 100 \
9750 0 100 55 0 100 60 0 100 65 0 100 70 0 100 \
9875 0 100 80 0 100 85 0 100 90 0 100 95 0 100 \
99100 0 100 100 0 90 100 0 80 100 0 70 100 0 60 \
100100 0 50 100 0 40 100 0 30 100 0 20 100 0 10] \r\
101make \"shade 50 \r\
8199 0 0 99 5 0 99 10 0 99 15 0 99 20 0 \
8299 25 0 99 30 0 99 35 0 99 40 0 99 45 0 \
8399 50 0 99 55 0 99 60 0 99 65 0 99 70 0 \
8499 75 0 99 80 0 99 85 0 99 90 0 99 95 0 \
8599 99 0 90 99 0 80 99 0 70 99 0 60 99 0 \
8650 99 0 40 99 0 30 99 0 20 99 0 10 99 0 \
87 0 99 0 0 99 5 0 99 10 0 99 15 0 99 20 \
88 0 99 25 0 99 30 0 99 35 0 99 40 0 99 45 \
89 0 99 50 0 99 55 0 99 60 0 99 65 0 99 70 \
90 0 99 75 0 99 80 0 99 85 0 99 90 0 99 95 \
91 0 99 99 0 95 99 0 90 99 0 85 99 0 80 99 \
92 0 75 99 0 70 99 0 65 99 0 60 99 0 55 99 \
93 0 50 99 0 45 99 0 40 99 0 35 99 0 30 99 \
94 0 25 99 0 20 99 0 15 99 0 10 99 0 5 99 \
95 0 0 99 5 0 99 10 0 99 15 0 99 20 0 99 \
9625 0 99 30 0 99 35 0 99 40 0 99 45 0 99 \
9750 0 99 55 0 99 60 0 99 65 0 99 70 0 99 \
9875 0 99 80 0 99 85 0 99 90 0 99 95 0 99 \
9999 0 99 99 0 90 99 0 80 99 0 70 99 0 60 \
10099 0 50 99 0 40 99 0 30 99 0 20 99 0 10] \r\
101make \"shade 50 \r\
102102tasetshade :shade \r"
103103
104104 bs = tw.just_blocks()
112112 setcolor = False
113113 setxy = False
114114 pensize = False
115 setpensize = False
115116 arc = False
116117 heap = False
117118 write = False
118119 minus = False
120 division = False
119121 image = False
120122
121123 """
242242 elif d == "pensize":
243243 pensize = True
244244 this_stack += "tapensize"
245 elif d == "setpensize":
246 setpensize = True
247 this_stack += "tasetpensize"
245248 elif d == "arc":
246249 arc = True
247250 this_stack += "taarc"
289289 this_stack += "label"
290290 show = 1
291291 elif d == "minus2":
292 this_stack == "taminus"
292 this_stack += "taminus"
293293 minus = True
294 elif d == "division":
295 this_stack += "quotient"
296 elif d == "lpos":
297 this_stack += str(-tw.canvas.width/(tw.coord_scale*2))
298 elif d == "rpos":
299 this_stack += str(tw.canvas.width/(tw.coord_scale*2))
300 elif d == "bpos":
301 this_stack += str(-tw.canvas.height/(tw.coord_scale*2))
302 elif d == "tpos":
303 this_stack += str(tw.canvas.height/(tw.coord_scale*2))
294304 elif d in IGNORE:
295305 this_stack += " "
296306 elif show == 1 and d[0:2] == "#s":
330330 "tasetshade :shade\rsetbackground :color\rend\r" + code
331331 if setcolor: # Load the Turtle Art color palette.
332332 code = color_processing + code
333 if setpensize: # Set int of pensize
334 code = "to tasetpensize :a\rsetpensize round :a\rend\r" + code
333335 if pensize: # Return only the first argument.
334336 code = "to tapensize\routput first round pensize\rend\r" + code
335337 if setxy: # Swap and round arguments
turtleart.py
(17 / 0)
  
3131
3232from tawindow import TurtleArtWindow
3333from taexporthtml import save_html
34from taexportlogo import save_logo
3435
3536def makepath(path):
3637 """ Make a path if it doesn't previously exist """
9292 menu.append(menu_items)
9393 menu_items.connect("activate", self._do_save_html_cb)
9494 menu_items.show()
95 menu_items = gtk.MenuItem(_("Save as Logo"))
96 menu.append(menu_items)
97 menu_items.connect("activate", self._do_save_logo_cb)
98 menu_items.show()
9599
96100 activity_menu = gtk.MenuItem(_("File"))
97101 activity_menu.show()
249249 f.write(html)
250250 f.close()
251251 self.tw.saved_pictures = []
252
253 def _do_save_logo_cb(self, widget):
254 """ Callback for save project to Logo. """
255 logocode = save_logo(self.tw)
256 if len(logocode) == 0:
257 return
258 save_type = '.lg'
259 filename, self.tw.load_save_folder = get_save_name(save_type,
260 self.tw.load_save_folder, 'logosession')
261 f = file(filename, "w")
262 f.write(logocode)
263 f.close()
252264
253265 def _do_resize_cb(self, widget, factor):
254266 """ Callback to resize blocks. """