Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2011-07-26 16:24:53 (GMT)
committer Walter Bender <walter.bender@gmail.com>2011-07-26 16:24:53 (GMT)
commitae91c9c6f47a00c5c37a92a035e09649f502af3c (patch)
tree07beb6f88e5b7dd80efc4ae7ce7c00098ced180f
parent361c3302e5545e691f3a3e7d6111b2dcf1ef8025 (diff)
move block skins to plugins directory
-rw-r--r--TurtleArt/taconstants.py1
-rw-r--r--TurtleArt/tawindow.py11
-rw-r--r--plugins/camera_sensor/camera_sensor.py4
-rw-r--r--plugins/turtle_blocks_extras/turtle_blocks_extras.py4
4 files changed, 15 insertions, 5 deletions
diff --git a/TurtleArt/taconstants.py b/TurtleArt/taconstants.py
index 80d505c..e40b3ca 100644
--- a/TurtleArt/taconstants.py
+++ b/TurtleArt/taconstants.py
@@ -131,6 +131,7 @@ PREFIX_DICTIONARY = {'journal': '#smedia_', 'description': '#sdescr_',
#
# Status blocks
#
+SKIN_PATHS = ['images']
MEDIA_SHAPES = []
diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py
index 07d7488..692fb4e 100644
--- a/TurtleArt/tawindow.py
+++ b/TurtleArt/tawindow.py
@@ -53,7 +53,7 @@ except ImportError:
from taconstants import HORIZONTAL_PALETTE, VERTICAL_PALETTE, BLOCK_SCALE, \
MEDIA_SHAPES, STATUS_SHAPES, OVERLAY_SHAPES, STRING_OR_NUMBER_ARGS, \
TOOLBAR_SHAPES, TAB_LAYER, RETURN, OVERLAY_LAYER, CATEGORY_LAYER, \
- BLOCKS_WITH_SKIN, ICON_SIZE, PALETTE_SCALE, PALETTE_WIDTH, \
+ BLOCKS_WITH_SKIN, ICON_SIZE, PALETTE_SCALE, PALETTE_WIDTH, SKIN_PATHS, \
MACROS, TOP_LAYER, BLOCK_LAYER, OLD_NAMES, DEFAULT_TURTLE, TURTLE_LAYER, \
CURSOR, EXPANDABLE, COLLAPSIBLE, DEAD_DICTS, DEAD_KEYS, NO_IMPORT, \
TEMPLATES, PYTHON_SKIN, PALETTE_HEIGHT, STATUS_LAYER, OLD_DOCK, \
@@ -365,8 +365,13 @@ class TurtleArtWindow():
filename = 'file' + name[7:]
else:
filename = name
- self.media_shapes[name] = svg_str_to_pixbuf(svg_from_file(
- "%s/images/%s.svg" % (self.path, filename)))
+ # Try both images/ and plugins/*/images/
+ for path in SKIN_PATHS:
+ if os.path.exists(os.path.join(self.path, path,
+ filename + '.svg')):
+ self.media_shapes[name] = svg_str_to_pixbuf(svg_from_file(
+ os.path.join(self.path, path, filename + '.svg')))
+ break
for i, name in enumerate(STATUS_SHAPES):
self.status_shapes[name] = svg_str_to_pixbuf(svg_from_file(
diff --git a/plugins/camera_sensor/camera_sensor.py b/plugins/camera_sensor/camera_sensor.py
index 66ff23c..32a394d 100644
--- a/plugins/camera_sensor/camera_sensor.py
+++ b/plugins/camera_sensor/camera_sensor.py
@@ -30,7 +30,7 @@ from plugins.plugin import Plugin
from TurtleArt.tapalette import make_palette
from TurtleArt.talogo import media_blocks_dictionary, primitive_dictionary
from TurtleArt.tautils import get_path, debug_output
-from TurtleArt.taconstants import MEDIA_SHAPES, NO_IMPORT
+from TurtleArt.taconstants import MEDIA_SHAPES, NO_IMPORT, SKIN_PATHS
class Camera_sensor(Plugin):
@@ -60,6 +60,8 @@ class Camera_sensor(Plugin):
primitive_dictionary['read_camera'] = self.prim_read_camera
media_blocks_dictionary['camera'] = self.prim_take_picture
+ SKIN_PATHS.append('plugins/camera_sensor/images')
+
if self._status:
palette.add_block('luminance',
style='box-style',
diff --git a/plugins/turtle_blocks_extras/turtle_blocks_extras.py b/plugins/turtle_blocks_extras/turtle_blocks_extras.py
index d628975..865fb13 100644
--- a/plugins/turtle_blocks_extras/turtle_blocks_extras.py
+++ b/plugins/turtle_blocks_extras/turtle_blocks_extras.py
@@ -30,7 +30,7 @@ from TurtleArt.tapalette import make_palette, define_logo_function
from TurtleArt.talogo import primitive_dictionary, logoerror, \
media_blocks_dictionary
from TurtleArt.taconstants import DEFAULT_SCALE, ICON_SIZE, CONSTANTS, \
- MEDIA_SHAPES
+ MEDIA_SHAPES, SKIN_PATHS
from TurtleArt.tautils import convert, round_int, debug_output
from TurtleArt.tajail import myfunc, myfunc_import
@@ -72,6 +72,8 @@ class Turtle_blocks_extras(Plugin):
self.tw = parent
def setup(self):
+ SKIN_PATHS.append('plugins/turtle_blocks_extras/images')
+
self.heap = self.tw.lc.heap
self.keyboard = self.tw.lc.keyboard
self.title_height = int((self.tw.canvas.height / 20) * self.tw.scale)