From 6a3eecfae933b26f447c1bdc05d46c57cc9d9523 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Sat, 06 Feb 2010 02:47:48 +0000 Subject: unhighlight on run --- diff --git a/talogo.py b/talogo.py index a0ac0e8..a2b680b 100644 --- a/talogo.py +++ b/talogo.py @@ -36,7 +36,7 @@ except: pass from taconstants import PRIMITIVES, PALETTES, PALETTE_NAMES, STATUS_LAYER,\ - TEMPLATES, BOX_STYLE + BOX_STYLE from tagplay import play_audio, play_movie_from_file, stop_media from tajail import myfunc, myfunc_import from tautils import get_pixbuf_from_journal, movie_media_type,\ @@ -77,6 +77,20 @@ def careful_divide(x,y): except: return 0 +def taequal(x, y): + try: + return float(x)==float(y) + except: + if type(x) == str or type(x) == unicode: + xx = ord(x[0]) + else: + xx = x + if type(y) == str or type(y) == unicode: + yy = ord(y[0]) + else: + yy = y + return xx==yy + def taless(x, y): try: return float(x)>> block %s: (%d: %s)" % (name, self.bi, b.name) - return - - def unhighlight(self, name): - if self.tw.step_time == 0: - return - """ Everything below is related to multimedia commands @@ -1119,9 +928,7 @@ class LogoCode: # title, one image, and description def show_template1x1(self, title, media): - print "entering tp1x1 %d" % (self.bi) - self.bi += 1 - w,h,xo,yo,dx,dy = calc_position(self.tw, 't1x1') + w,h,xo,yo,dx,dy = self.tw.calc_position('t1x1') x = -(self.tw.canvas.width/2)+xo y = self.tw.canvas.height/2 self.tw.canvas.setxy(x, y) @@ -1150,9 +957,7 @@ class LogoCode: # title, two images (horizontal), two descriptions def show_template2x1(self, title, media1, media2): - print "entering tp2x1 %d" % (self.bi) - self.bi += 1 - w,h,xo,yo,dx,dy = calc_position(self.tw, 't2x1') + w,h,xo,yo,dx,dy = self.tw.calc_position('t2x1') x = -(self.tw.canvas.width/2)+xo y = self.tw.canvas.height/2 self.tw.canvas.setxy(x, y) @@ -1187,7 +992,7 @@ class LogoCode: # title and varible number of bullets def show_bullets(self, title, sarray): - w,h,xo,yo,dx,dy = calc_position(self.tw, 'bullet') + w,h,xo,yo,dx,dy = self.tw.calc_position('bullet') x = -(self.tw.canvas.width/2)+xo y = self.tw.canvas.height/2 self.tw.canvas.setxy(x, y) @@ -1209,9 +1014,7 @@ class LogoCode: # title, two images (vertical), two desciptions def show_template1x2(self, title, media1, media2): - print "entering tp1x2 %d" % (self.bi) - self.bi += 1 - w,h,xo,yo,dx,dy = calc_position(self.tw, 't1x2') + w,h,xo,yo,dx,dy = self.tw.calc_position('t1x2') x = -(self.tw.canvas.width/2)+xo y = self.tw.canvas.height/2 self.tw.canvas.setxy(x, y) @@ -1246,9 +1049,7 @@ class LogoCode: # title and four images def show_template2x2(self, title, media1, media2, media3, media4): - print "entering tp2x2 %d" % (self.bi) - self.bi += 1 - w,h,xo,yo,dx,dy = calc_position(self.tw, 't2x2') + w,h,xo,yo,dx,dy = self.tw.calc_position('t2x2') x = -(self.tw.canvas.width/2)+xo y = self.tw.canvas.height/2 self.tw.canvas.setxy(x, y) @@ -1282,9 +1083,7 @@ class LogoCode: # title, one media object def show_template1x1a(self, title, media1): - print "entering tp1x1a %d" % (self.bi) - self.bi += 1 - w,h,xo,yo,dx,dy = calc_position(self.tw, 't1x1a') + w,h,xo,yo,dx,dy = self.tw.calc_position('t1x1a') x = -(self.tw.canvas.width/2)+xo y = self.tw.canvas.height/2 self.tw.canvas.setxy(x, y) @@ -1331,8 +1130,6 @@ class LogoCode: self.show_description(media, x, y, w, h) def set_scale(self, x): - self.highlighter("set") - self.bi += 1 self.scale = x # need to fix export logo to map show to write @@ -1375,9 +1172,7 @@ class LogoCode: play_audio(self, audio[6:]) def write(self, string, fsize): - self.highlighter("write") # convert from Turtle coordinates to screen coordinates x = self.tw.canvas.width/2+int(self.tw.canvas.xcor) y = self.tw.canvas.height/2-int(self.tw.canvas.ycor) self.tw.canvas.draw_text(string,x,y-15,int(fsize),self.tw.canvas.width) - self.unhighlight("write") diff --git a/tawindow.py b/tawindow.py index 9c57355..ca378e2 100644 --- a/tawindow.py +++ b/tawindow.py @@ -1884,3 +1884,50 @@ class TurtleArtWindow(): return False else: return True + + def showlabel(self, label, str=''): + if label=='#nostack': + shp = 'nostack' + label='' + elif label=='#noinput': + shp = 'noinput' + label='' + elif label=='#emptyheap': + shp = 'emptyheap' + label='' + elif label=='#emptybox': + shp = 'emptybox' + label='' + elif label=='#nomedia': + shp = 'nomedia' + label='' + elif label=='#nocode': + shp = 'nocode' + label='' + elif label=='#syntaxerror': + shp = 'syntaxerror' + label='' + elif label=='#overflowerror': + shp = 'overflowerror' + label='' + elif label=='#notanumber': + shp = 'overflowerror' + label='' + elif label=='#trace': + shp = 'info' + label = str + else: + shp = 'status' + self.status_spr.set_shape(self.status_shapes[shp]) + self.status_spr.set_label(label) + self.status_spr.set_layer(STATUS_LAYER) + + def calc_position(self, t): + w,h,x,y,dx,dy = TEMPLATES[t] + x *= self.canvas.width + y *= self.canvas.height + w *= (self.canvas.width-x) + h *= (self.canvas.height-y) + dx *= w + dy *= h + return(w,h,x,y,dx,dy) -- cgit v0.9.1