diff options
author | Walter Bender <walter@walter-laptop.(none)> | 2010-02-06 13:20:18 (GMT) |
---|---|---|
committer | Walter Bender <walter@walter-laptop.(none)> | 2010-02-06 13:20:18 (GMT) |
commit | b1ad07cd7e9c28270a7beb7d2d5e6edade179cb9 (patch) | |
tree | 15e594fa30b0b8c79dc75cb5104284e044701aef /tawindow.py | |
parent | 6a3eecfae933b26f447c1bdc05d46c57cc9d9523 (diff) |
cleaned up status code
Diffstat (limited to 'tawindow.py')
-rw-r--r-- | tawindow.py | 47 |
1 files changed, 12 insertions, 35 deletions
diff --git a/tawindow.py b/tawindow.py index ca378e2..75ffafd 100644 --- a/tawindow.py +++ b/tawindow.py @@ -1517,13 +1517,13 @@ class TurtleArtWindow(): f = float(n) if f > 1000000: n = 1 - self.lc.showlabel("#overflowerror") + self.showlabel("#overflowerror") elif f < -1000000: n = -1 - self.lc.showlabel("#overflowerror") + self.showlabel("#overflowerror") except ValueError: n = 0 - self.lc.showlabel("#notanumber") + self.showlabel("#notanumber") else: n = 0 self.selected_blk.spr.set_label(n) @@ -1885,39 +1885,16 @@ class TurtleArtWindow(): 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': + def showlabel(self, shp, label=''): + print "shp: %s, label: %s" % (shp, label) + if shp == 'syntaxerror' and label != '': + shp = label[1:] + label = '' + elif shp[0] == '#': + shp = shp[1:] + label = '' + if shp=='notanumber': 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) |