OSDN Git Service

layer move: strokemap too + cursor & idler tweaks
[mypaint-anime/master.git] / mypaint.py
index 6d45573..9ed8906 100644 (file)
@@ -54,11 +54,12 @@ def get_paths():
     lib_compiled='lib/mypaint/'
 
     # convert sys.argv to a list of unicode objects
+    # (actually convertig sys.argv confuses gtk, thus we add a new variable)
     if sys.platform == 'win32':
-        sys.argv = win32_unicode_argv()
+        sys.argv_unicode = win32_unicode_argv()
     else:
-        sys.argv = [s.decode(sys.getfilesystemencoding()) for s in sys.argv]
-    scriptdir=os.path.dirname(sys.argv[0])
+        sys.argv_unicode = [s.decode(sys.getfilesystemencoding()) for s in sys.argv]
+    scriptdir=os.path.dirname(sys.argv_unicode[0])
 
     # this script is installed as $prefix/bin. We just need $prefix to continue.
     #pwd=os.getcwd() # why????
@@ -73,17 +74,20 @@ def get_paths():
         sys.path.insert(0, libpath)
         sys.path.insert(0, libpath_compiled)
         localepath = join(prefix, 'share/locale')
+        extradata = join(prefix, 'share')
     elif sys.platform == 'win32':
         prefix=None
         # this is py2exe point of view, all executables in root of installdir
         # all path must be normalized to absolute path
-        libpath = os.path.abspath(os.path.dirname(os.path.realpath(sys.argv[0])))
+        libpath = os.path.abspath(os.path.dirname(os.path.realpath(sys.argv_unicode[0])))
         sys.path.insert(0, libpath)
-        localepath = join(libpath,'share/locale')
+        localepath = join(libpath, 'share/locale')
+        extradata = join(libpath, 'share')
     else:
         # we are not installed
         prefix = None
         libpath = u'.'
+        extradata = u'desktop'
         localepath = 'po'
 
     assert isinstance(libpath, unicode)
@@ -93,7 +97,7 @@ def get_paths():
     except ImportError:
         print
         print "We are not correctly installed or compiled!"
-        print 'script: "%s"' % arg0
+        print 'script: "%s"' % sys.argv[0]
         if prefix:
             print 'deduced prefix: "%s"' % prefix
             print 'lib_shared: "%s"' % libpath
@@ -120,7 +124,8 @@ def get_paths():
 
     assert isinstance(datapath, unicode)
     assert isinstance(confpath, unicode)
-    return datapath, confpath, localepath
+    assert isinstance(extradata, unicode)
+    return datapath, extradata, confpath, localepath
 
 def psyco_opt():
     # This helps on slow PCs where the python overhead dominates.
@@ -144,7 +149,7 @@ def psyco_opt():
 if __name__ == '__main__':
     psyco_opt()
 
-    datapath, confpath, localepath = get_paths()
+    datapath, extradata, confpath, localepath = get_paths()
 
     # must be done before importing any translated python modules
     # (to get global strings translated, especially brushsettings.py)
@@ -156,4 +161,4 @@ if __name__ == '__main__':
     gettext.textdomain("mypaint")
 
     from gui import main
-    main.main(datapath, confpath)
+    main.main(datapath, extradata, confpath)