LPCManager.py
changeset 58 96741ddb78c0
parent 57 4b838bdedc16
child 59 bdea62c1f32f
--- a/LPCManager.py	Thu Oct 03 22:59:38 2013 +0200
+++ b/LPCManager.py	Thu Feb 27 23:50:45 2014 +0100
@@ -9,7 +9,10 @@
 import __builtin__
 from types import TupleType, StringType, UnicodeType
 
-CWD = os.path.split(os.path.realpath(__file__))[0]
+_lpcmanager_path = os.path.split(__file__)[0]
+_dist_folder = os.path.split(sys.path[0])[0]
+_beremiz_folder = os.path.join(_dist_folder, "beremiz")
+sys.path.append(_beremiz_folder)
 
 def Bpath(*args):
     return os.path.join(CWD,*args)
@@ -47,35 +50,22 @@
         else:
             arch = "MC8"
 
-    if os.path.exists("LPC_DEBUG"):
-        __builtin__.__dict__["BMZ_DBG"] = True
-    else :
-        __builtin__.__dict__["BMZ_DBG"] = False
-
-app = wx.PySimpleApp(redirect=BMZ_DBG)
-app.SetAppName('beremiz')
-wx.InitAllImageHandlers()
-
-_base_folder = os.path.split(sys.path[0])[0]
-sys.path.append(os.path.join(_base_folder, "beremiz"))
-
-from util.TranslationCatalogs import AddCatalog
-AddCatalog(os.path.join(CWD, "locale"))
-
-if __name__ == '__main__':
-    # Import module for internationalization
-    import gettext
-    
-    #__builtin__.__dict__['_'] = wx.GetTranslation
-    __builtin__.__dict__['_'] = lambda x: x
-
-_base_path = os.path.split(__file__)[0]
+    __builtin__.__dict__["BMZ_DBG"] = os.path.exists("LPC_DEBUG")
+
+    app = wx.PySimpleApp(redirect=BMZ_DBG)
+    app.SetAppName('beremiz')
+    wx.InitAllImageHandlers()
+
+    from util.misc import InstallLocalRessources
+    InstallLocalRessources(_beremiz_folder)
+
+_lpcmanager_path = os.path.split(__file__)[0]
 import features
 from POULibrary import POULibrary
 
 class PLCLibrary(POULibrary):
     def GetLibraryPath(self):
-        return os.path.join(_base_path, "pous.xml")
+        return os.path.join(_lpcmanager_path, "pous.xml")
 
 features.libraries=[
     ('Native', 'NativeLib.NativeLibrary'),
@@ -88,10 +78,10 @@
 
 import targets
 from LPCtarget import LPC_target 
-targets.targets["LPC"] = {"xsd": os.path.join(_base_path, "LPCtarget", "XSD"),
+targets.targets["LPC"] = {"xsd": os.path.join(_lpcmanager_path, "LPCtarget", "XSD"),
                           "class": lambda: LPC_target,
-                          "code": os.path.join(_base_path,"LPCtarget","plc_LPC_main.c")} 
-targets.toolchains["makefile"] = os.path.join(_base_path, "LPCtarget", "XSD_toolchain_makefile")
+                          "code": os.path.join(_lpcmanager_path,"LPCtarget","plc_LPC_main.c")} 
+targets.toolchains["makefile"] = os.path.join(_lpcmanager_path, "LPCtarget", "XSD_toolchain_makefile")
 
 from Beremiz import *
 from ProjectController import ProjectController