Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TurtleArt/taconstants.py6
-rwxr-xr-xTurtleArt/tasprite_factory.py9
-rw-r--r--TurtleArt/tautils.py9
3 files changed, 17 insertions, 7 deletions
diff --git a/TurtleArt/taconstants.py b/TurtleArt/taconstants.py
index 6724ddb..7ad4aa1 100644
--- a/TurtleArt/taconstants.py
+++ b/TurtleArt/taconstants.py
@@ -173,6 +173,12 @@ HORIZONTAL_PALETTE = 0
VERTICAL_PALETTE = 1
BLACK = -9999
WHITE = -9998
+HIT_HIDE = 248
+HIT_SHOW = 240
+HIT_RED = "#F80000"
+HIT_GREEN = "#00F000"
+HIDE_WHITE = "#F8F8F8"
+SHOW_WHITE = "#F0F0F0"
#
# Block-style definitions
diff --git a/TurtleArt/tasprite_factory.py b/TurtleArt/tasprite_factory.py
index 7b4fa4f..8a8213b 100755
--- a/TurtleArt/tasprite_factory.py
+++ b/TurtleArt/tasprite_factory.py
@@ -26,6 +26,7 @@ import gtk
import os
from gettext import gettext as _
+from taconstants import HIT_RED, HIT_GREEN, HIDE_WHITE, SHOW_WHITE
class SVG:
def __init__(self):
self._x = 0
@@ -835,7 +836,7 @@ class SVG:
def _hide_dot(self, noscale=False):
_saved_fill, _saved_stroke = self._fill, self._stroke
- self._fill, self._stroke = "#FF0000", "#FF0000"
+ self._fill, self._stroke = HIT_RED, HIT_RED
svg = "</g>/n<g>/n"
if noscale:
scale = 2.0
@@ -844,7 +845,7 @@ class SVG:
scale2 = scale/2
svg += self._circle(self._dot_radius*scale2, self._hide_x*scale,
self._hide_y*scale)
- self._fill, self._stroke = "#FFFFFF", "#FFFFFF"
+ self._fill, self._stroke = HIDE_WHITE, HIDE_WHITE
svg += self._rect(10*scale2, 2*scale2, self._hide_x*scale-5*scale2,
self._hide_y*scale-scale+scale2)
self._fill, self._stroke = _saved_fill, _saved_stroke
@@ -852,7 +853,7 @@ class SVG:
def _show_dot(self, noscale=False):
_saved_fill, _saved_stroke = self._fill, self._stroke
- self._fill, self._stroke = "#00FE00", "#00FE00"
+ self._fill, self._stroke = HIT_GREEN, HIT_GREEN
svg = "</g>/n<g>/n"
if noscale:
scale = 2.0
@@ -861,7 +862,7 @@ class SVG:
scale2 = scale/2
svg += self._circle(self._dot_radius*scale2, self._show_x*scale,
self._show_y*scale)
- self._fill, self._stroke = "#FEFEFE", "#FEFEFE"
+ self._fill, self._stroke = SHOW_WHITE, SHOW_WHITE
svg += self._rect(10*scale2, 2*scale2, self._show_x*scale-5*scale2,
self._show_y*scale-scale+scale2)
svg += self._rect(2*scale2, 10*scale2, self._show_x*scale-scale+scale2,
diff --git a/TurtleArt/tautils.py b/TurtleArt/tautils.py
index 9813a30..1466946 100644
--- a/TurtleArt/tautils.py
+++ b/TurtleArt/tautils.py
@@ -36,7 +36,8 @@ except (ImportError, AttributeError):
except:
OLD_SUGAR_SYSTEM = True
from taconstants import STRING_OR_NUMBER_ARGS, HIDE_LAYER, CONTENT_ARGS, \
- COLLAPSIBLE, BLOCK_LAYER, CONTENT_BLOCKS
+ COLLAPSIBLE, BLOCK_LAYER, CONTENT_BLOCKS, HIT_HIDE, \
+ HIT_SHOW
from StringIO import StringIO
import os.path
from gettext import gettext as _
@@ -507,7 +508,8 @@ def collapsible(blk):
def hide_button_hit(spr, x, y):
""" Did the sprite's hide (contract) button get hit? """
_red, _green, _blue, _alpha = spr.get_pixel((x, y))
- if (_red == 255 and _green == 0) or _green == 255:
+ print _red, _green, _blue
+ if _red == HIT_HIDE:
return True
else:
return False
@@ -515,7 +517,8 @@ def hide_button_hit(spr, x, y):
def show_button_hit(spr, x, y):
""" Did the sprite's show (expand) button get hit? """
_red, _green, _blue, _alpha = spr.get_pixel((x, y))
- if _green == 254:
+ print _red, _green, _blue
+ if _green == HIT_SHOW:
return True
else:
return False