From 2e318550e82fd206c7487565632af52ae27696e5 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Fri, 18 Jan 2013 13:46:59 +0000 Subject: use _ for color constant values --- (limited to 'TurtleArt') diff --git a/TurtleArt/tablock.py b/TurtleArt/tablock.py index c4c9110..0c8c249 100644 --- a/TurtleArt/tablock.py +++ b/TurtleArt/tablock.py @@ -506,10 +506,10 @@ class Block: else: self._set_labels(i, str(v)) elif self.type == 'block' and self.name in CONSTANTS: - if self.name in COLORDICT: - v = COLORDICT[self.name][0] + if CONSTANTS[self.name] in COLORDICT: + v = COLORDICT[CONSTANTS[self.name]][0] if v is None: - v = COLORDICT[self.name][1] + v = COLORDICT[CONSTANTS[self.name]][1] else: v = CONSTANTS[self.name] self._set_labels(0, block_names[self.name][0] + ' = ' + str(v)) diff --git a/TurtleArt/tacanvas.py b/TurtleArt/tacanvas.py index d7ef452..1272b6b 100644 --- a/TurtleArt/tacanvas.py +++ b/TurtleArt/tacanvas.py @@ -435,7 +435,7 @@ class TurtleGraphics: ''' Set the pen color ''' # Special case for color blocks - if c in CONSTANTS: + if c in COLORDICT: self.setshade(COLORDICT[c][1], share) self.setgray(COLORDICT[c][2], share) if COLORDICT[c][0] is not None: @@ -516,15 +516,15 @@ class TurtleGraphics: oldc, olds, oldg = self.color, self.shade, self.gray # Special case for color blocks - if c in CONSTANTS: + if c in COLORDICT: if COLORDICT[c][0] is None: s = COLORDICT[c][1] c = self.color else: c = COLORDICT[c][0] - if s in CONSTANTS: + if s in COLORDICT: s = COLORDICT[s][1] - if g in CONSTANTS: + if g in COLORDICT: g = COLORDICT[g][2] self.setcolor(c, False) diff --git a/TurtleArt/taconstants.py b/TurtleArt/taconstants.py index 5b6c326..1fb979a 100644 --- a/TurtleArt/taconstants.py +++ b/TurtleArt/taconstants.py @@ -80,17 +80,17 @@ UNKNOWN = 'unknown' CONSTANTS = {'leftpos': None, 'toppos': None, 'rightpos': None, 'bottompos': None, 'width': None, 'height': None, - 'black': 'black', 'white': 'white', 'red': 'red', - 'orange': 'orange', 'yellow': 'yellow', 'green': 'green', - 'cyan': 'cyan', 'blue': 'blue', 'purple': 'purple', + 'black': '_black', 'white': '_white', 'red': '_red', + 'orange': '_orange', 'yellow': '_yellow', 'green': '_green', + 'cyan': '_cyan', 'blue': '_blue', 'purple': '_purple', 'titlex': None, 'titley': None, 'leftx': None, 'topy': None, 'rightx': None, 'bottomy': None} -COLORDICT = {'black': [None, 0, 0], 'white': [None, 100, 0], - 'red': [0, 50, 100], 'orange': [10, 50, 100], - 'yellow': [20, 50, 100], 'green': [40, 50, 100], - 'cyan': [50, 50, 100], 'blue': [70, 50, 100], - 'purple': [90, 50, 100]} +COLORDICT = {'_black': [None, 0, 0], '_white': [None, 100, 0], + '_red': [0, 50, 100], '_orange': [10, 50, 100], + '_yellow': [20, 50, 100], '_green': [40, 50, 100], + '_cyan': [50, 50, 100], '_blue': [70, 50, 100], + '_purple': [90, 50, 100]} # Blocks that are expandable -- cgit v0.9.1