PLCOpenEditor.py
changeset 815 e4f24593a758
parent 814 5743cbdff669
child 838 06db7d4edbe6
equal deleted inserted replaced
814:5743cbdff669 815:e4f24593a758
    25 import wx
    25 import wx
    26 import os, sys, platform, time, traceback, getopt
    26 import os, sys, platform, time, traceback, getopt
    27 
    27 
    28 CWD = os.path.split(os.path.realpath(__file__))[0]
    28 CWD = os.path.split(os.path.realpath(__file__))[0]
    29 
    29 
    30 from util.BitmapLibrary import AddBitmapFolder, GetBitmap
       
    31 AddBitmapFolder(os.path.join(CWD, "images"))
       
    32 
       
    33 from docutil import *
       
    34 
       
    35 __version__ = "$Revision: 1.130 $"
    30 __version__ = "$Revision: 1.130 $"
    36 
    31 
    37 if __name__ == '__main__':
    32 if __name__ == '__main__':
    38     # Usage message displayed when help request or when error detected in 
    33     # Usage message displayed when help request or when error detected in 
    39     # command line
    34     # command line
    65     
    60     
    66     # Create wxApp (Need to create App before internationalization because of
    61     # Create wxApp (Need to create App before internationalization because of
    67     # Windows) 
    62     # Windows) 
    68     app = wx.PySimpleApp()
    63     app = wx.PySimpleApp()
    69 
    64 
    70 # Import module for internationalization
    65 from docutil import *
    71 import gettext
    66 
    72 import __builtin__
    67 from util.TranslationCatalogs import AddCatalog, locale
    73 
    68 from util.BitmapLibrary import AddBitmapFolder, GetBitmap
    74 # Get folder containing translation files
    69 
    75 localedir = os.path.join(CWD,"locale")
    70 AddCatalog(os.path.join(CWD, "locale"))
    76 # Get the default language
    71 AddBitmapFolder(os.path.join(CWD, "images"))
    77 langid = wx.LANGUAGE_DEFAULT
       
    78 # Define translation domain (name of translation files)
       
    79 domain = "Beremiz"
       
    80 
       
    81 # Define locale for wx
       
    82 loc = __builtin__.__dict__.get('loc', None)
       
    83 if loc is None:
       
    84     test_loc = wx.Locale(langid)
       
    85     test_loc.AddCatalogLookupPathPrefix(localedir)
       
    86     if test_loc.AddCatalog(domain):
       
    87         loc = wx.Locale(langid)
       
    88     else:
       
    89         loc = wx.Locale(wx.LANGUAGE_ENGLISH)
       
    90     __builtin__.__dict__['loc'] = loc
       
    91 # Define location for searching translation files
       
    92 loc.AddCatalogLookupPathPrefix(localedir)
       
    93 # Define locale domain
       
    94 loc.AddCatalog(domain)
       
    95 
    72 
    96 if __name__ == '__main__':
    73 if __name__ == '__main__':
       
    74     # Import module for internationalization
       
    75     import gettext
       
    76     import __builtin__
       
    77     
       
    78     __builtin__.__dict__['loc'] = locale
    97     __builtin__.__dict__['_'] = wx.GetTranslation
    79     __builtin__.__dict__['_'] = wx.GetTranslation
    98 
    80 
    99 from IDEFrame import IDEFrame, AppendMenu
    81 from IDEFrame import IDEFrame, AppendMenu
   100 from IDEFrame import TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU, PROJECTTREE, POUINSTANCEVARIABLESPANEL, LIBRARYTREE, PAGETITLES
    82 from IDEFrame import TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU, PROJECTTREE, POUINSTANCEVARIABLESPANEL, LIBRARYTREE, PAGETITLES
   101 from IDEFrame import EncodeFileSystemPath, DecodeFileSystemPath
    83 from IDEFrame import EncodeFileSystemPath, DecodeFileSystemPath