Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TurtleArt/taexportpython.py7
-rw-r--r--pyexported/window_setup.py12
2 files changed, 13 insertions, 6 deletions
diff --git a/TurtleArt/taexportpython.py b/TurtleArt/taexportpython.py
index 1ed1ac5..64b2aaf 100644
--- a/TurtleArt/taexportpython.py
+++ b/TurtleArt/taexportpython.py
@@ -39,6 +39,13 @@ from tawindow import plugins_in_use
_SETUP_CODE_START = """\
#!/usr/bin/env python
+import os, sys
+if os.path.exists('../TurtleBlocks.activity'):
+ sys.path.append('../TurtleBlocks.activity')
+else:
+ print 'This code require the TurtleBlocks activity to be installed.'
+ exit(1)
+
from time import *
from random import uniform
from math import *
diff --git a/pyexported/window_setup.py b/pyexported/window_setup.py
index 45c7ba4..537022a 100644
--- a/pyexported/window_setup.py
+++ b/pyexported/window_setup.py
@@ -6,8 +6,10 @@ pygtk.require('2.0')
import gtk
import gobject
+from gettext import gettext as _
+
import os
-from sys import argv
+import sys
from TurtleArt.tablock import Media
from TurtleArt.taconstants import CONSTANTS
@@ -15,11 +17,10 @@ from TurtleArt.tatype import *
from TurtleArt.tawindow import TurtleArtWindow
+# search sys.path for a dir containing TurtleArt/tawindow.py
# path to the toplevel directory of the TA installation
_TA_INSTALLATION_PATH = None
-# search the PYTHONPATH for a dir containing TurtleArt/tawindow.py
-PYTHONPATH = os.environ["PYTHONPATH"]
-for path in PYTHONPATH.split(":"):
+for path in sys.path:
try:
entries = os.listdir(path)
except OSError:
@@ -113,7 +114,6 @@ class DummyTurtleMain(object):
exit()
-
def get_tw():
""" Create a GTK window and instantiate a DummyTurtleMain instance. Return
the TurtleArtWindow object that holds the turtles and the canvas.
@@ -121,7 +121,7 @@ def get_tw():
# copied from turtleblocks.TurtleMain._setup_gtk()
win = gtk.Window(gtk.WINDOW_TOPLEVEL)
- gui = DummyTurtleMain(win=win, name=argv[0])
+ gui = DummyTurtleMain(win=win, name=sys.argv[0])
# TODO re-enable this code (after giving gui the right attributes)
# win.set_default_size(gui.width, gui.height)
# win.move(gui.x, gui.y)