From 2795a9fb968316334321484d3a984d97d281a5b3 Mon Sep 17 00:00:00 2001 From: paulojamorim Date: Fri, 5 Mar 2010 01:01:58 +0000 Subject: [PATCH] ADD: Click in the inv3 file and open project --- invesalius/i18n.py | 12 +++++------- invesalius/invesalius.py | 19 ++++++++++++++++--- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/invesalius/i18n.py b/invesalius/i18n.py index feed177..98d5622 100644 --- a/invesalius/i18n.py +++ b/invesalius/i18n.py @@ -28,8 +28,6 @@ import sys import utils as utl -LANGUAGE_DIR = os.path.abspath(os.path.join('..','locale')) - def GetLocales(): """Return a dictionary which defines supported languages""" d = utl.TwoWaysDictionary ({'zh_TW': u'中文', @@ -41,18 +39,18 @@ def GetLocales(): 'it_IT':'Italiano', 'de_DE': 'Deutsch'}) return d - + def GetLocaleOS(): """Return language of the operating system.""" if sys.platform == 'darwin': locale.setlocale(locale.LC_ALL, "") return locale.getlocale()[0] - + return locale.getdefaultlocale()[0] - + def InstallLanguage(language): - - lang = gettext.translation('invesalius', LANGUAGE_DIR,\ + language_dir = os.path.abspath(os.path.join('..','locale')) + lang = gettext.translation('invesalius', language_dir,\ languages=[language], codeset='utf8') # Using unicode lang.install(unicode=1) diff --git a/invesalius/invesalius.py b/invesalius/invesalius.py index 2817785..ffd8536 100755 --- a/invesalius/invesalius.py +++ b/invesalius/invesalius.py @@ -18,11 +18,15 @@ # detalhes. #------------------------------------------------------------------------- + import multiprocessing import optparse as op import os import sys +if sys.platform == 'win32': + import _winreg + import wx import wx.lib.pubsub as ps @@ -79,7 +83,7 @@ class SplashScreen(wx.SplashScreen): _ = i18n.InstallLanguage(lang) # If no language is set into session file, show dialog so - # user can select language + # user can select language else: dialog = lang_dlg.LanguageDialog() @@ -115,12 +119,12 @@ class SplashScreen(wx.SplashScreen): bmp = wx.Image(path).ConvertToBitmap() - style = wx.SPLASH_TIMEOUT | wx.SPLASH_CENTRE_ON_SCREEN + style = wx.SPLASH_TIMEOUT | wx.SPLASH_CENTRE_ON_SCREEN wx.SplashScreen.__init__(self, bitmap=bmp, splashStyle=style, milliseconds=1500, - id=-1, + id=-1, parent=None) self.Bind(wx.EVT_CLOSE, self.OnClose) @@ -224,6 +228,15 @@ if __name__ == '__main__': if hasattr(sys,"frozen") and sys.frozen == "windows_exe": multiprocessing.freeze_support() + #Click in the .inv3 file support + root = _winreg.HKEY_CLASSES_ROOT + key = "InVesalius 3.0\InstallationDir" + hKey = _winreg.OpenKey (root, key, 0, _winreg.KEY_READ) + value, type_ = _winreg.QueryValueEx (hKey, "") + path = os.path.join(value,'dist') + + os.chdir(path) + # Create raycasting presets' folder, if it doens't exist dirpath = os.path.join(os.path.expanduser('~'), ".invesalius", -- libgit2 0.21.2