From ee166d9f100dcadd620aaba885216b26caf346bc Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Wed, 23 Feb 2011 17:57:36 +0000 Subject: setting correct default paths --- diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py index eef9805..6111a07 100644 --- a/TurtleArt/tawindow.py +++ b/TurtleArt/tawindow.py @@ -92,8 +92,9 @@ if GST_AVAILABLE: class TurtleArtWindow(): """ TurtleArt Window class abstraction """ timeout_tag = [0] - _INSTALL_PATH = '/usr/share/turtleart' - _ALTERNATE_INSTALL_PATH = '/usr/local/share/turtleart' + _INSTALL_PATH = '/usr/share/sugar/activities/TurtleArt.activity' + _ALTERNATE_INSTALL_PATH = \ + '/usr/local/share/sugar/activities/TurtleArt.activity' _PLUGIN_SUBPATH = 'plugins' def __init__(self, win, path, parent=None, mycolors=None, mynick=None): @@ -274,11 +275,6 @@ class TurtleArtWindow(): if os.path.exists(path): return path path = os.path.expanduser(os.path.join('~', 'Activities', - 'TurtleBlocks.activity', - self._PLUGIN_SUBPATH)) - if os.path.exists(path): - return path - path = os.path.expanduser(os.path.join('~', 'Activities', 'TurtleArt.activity', self._PLUGIN_SUBPATH)) if os.path.exists(path): diff --git a/turtleart.py b/turtleart.py index d9a205b..8fdfa9a 100755 --- a/turtleart.py +++ b/turtleart.py @@ -45,7 +45,10 @@ sys.argv[1:] = [] # Execution of import gst cannot see '--help' or '-h' import gettext -gettext.bindtextdomain('org.laptop.TurtleArtActivity', 'locale') +# Commenting out bindtextdomain so that GNOME can find the installed .mo files, +# but it will not find the .mo files in the local locale directory when running +# from a git repository or the unzipped .xo file. +# gettext.bindtextdomain('org.laptop.TurtleArtActivity', 'locale') gettext.textdomain('org.laptop.TurtleArtActivity') _ = gettext.gettext @@ -66,8 +69,9 @@ class TurtleMain(): \tturtleart.py project.ta \tturtleart.py --output_png project.ta \tturtleart.py -o project""" - _INSTALL_PATH = '/usr/share/turtleart' - _ALTERNATE_INSTALL_PATH = '/usr/local/share/turtleart' + _INSTALL_PATH = '/usr/share/sugar/activities/TurtleArt.activity' + _ALTERNATE_INSTALL_PATH = \ + '/usr/local/share/sugar/activities/TurtleArt.activity' _ICON_SUBPATH = 'images/turtle.png' _GNOME_PLUGIN_SUBPATH = 'gnome_plugins' @@ -101,11 +105,6 @@ class TurtleMain(): if os.path.exists(path): return path path = os.path.expanduser(os.path.join('~', 'Activities', - 'TurtleBlocks.activity', - self._GNOME_PLUGIN_SUBPATH)) - if os.path.exists(path): - return path - path = os.path.expanduser(os.path.join('~', 'Activities', 'TurtleArt.activity', self._GNOME_PLUGIN_SUBPATH)) if os.path.exists(path): @@ -196,7 +195,13 @@ class TurtleMain(): def _init_vars(self): """ If we are invoked to start a project from Gnome, we should make sure our current directory is TA's source dir. """ - os.chdir(os.path.dirname(__file__)) + dirname = os.path.dirname(__file__) + if dirname == '': + dirname = '.' + try: + os.chdir(dirname) + except OSError: + print ("Couldn't chdir to %s" % (dirname)) self.ta_file = None self.output_png = False -- cgit v0.9.1