source: trunk/lotatc_client.py @ 2290

Revision 2288, 3.1 KB checked in by dart, 4 months ago (diff)

Fix pyinstaller (working for client)

Line 
1# -*- coding: utf-8 -*-
2# vim: ts=4:sw=4
3#    This file is part of LOME.
4#
5#    LOME is free software: you can redistribute it and/or modify
6#    it under the terms of the GNU General Public License as published by
7#    the Free Software Foundation, either version 3 of the License, or
8#    (at your option) any later version.
9#
10#    LOME is distributed in the hope that it will be useful,
11#    but WITHOUT ANY WARRANTY; without even the implied warranty of
12#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13#    GNU General Public License for more details.
14#
15#    You should have received a copy of the GNU General Public License
16#    along with LOME.  If not, see <http://www.gnu.org/licenses/>.
17#
18
19# @ Main lotatc entry
20# Launch lotatc
21import sys,os,logging, traceback
22sys.path.append(os.path.join(sys.path[0],'common'))
23sys.path.append(os.path.join(sys.path[0],'common', 'misabstractlayer'))
24sys.path.append(os.path.join(sys.path[0],'common', 'drawobjects'))
25sys.path.append(os.path.join(sys.path[0],'common', 'lodb'))
26sys.path.append(os.path.join(sys.path[0],'common', 'mesh'))
27sys.path.append(os.path.join(sys.path[0],'common', 'miztools'))
28sys.path.append(os.path.join(sys.path[0],'lotatc_client'))
29sys.path.append(os.path.join(sys.path[0],'lotatc_client', 'ilsview'))
30sys.path.append(os.path.join(sys.path[0],'lotatc_server'))
31
32from PyQt4.QtGui import *
33from lotatcwnd import *
34from debug import *
35from constants import *
36from miztools.mizfile import MizFile
37
38try: 
39    import logging.config
40    logging.config.fileConfig('logging.conf')
41except:
42    # Set logging config
43    logging.basicConfig(level=logging.WARNING, format='%(name)s: %(message)s'
44            ,filename='lotatc_client.log', filemode='w'
45            )
46
47#--- LOGGING PREFERENCES
48#logging.getLogger('').setLevel(logging.WARNING)
49#logging.getLogger('[RadarClient]').setLevel(logging.WARNING)
50#logging.getLogger('[LotatcClient]').setLevel(logging.WARNING)
51
52if __name__ == "__main__":
53    #- Install logger
54    #try:
55    #    pathname = dirname( __file__ )
56    #except:
57    #    pathname = dirname( sys.argv[0] )
58    if hasattr(sys, 'frozen'):
59        g_pathname = os.path.dirname(sys.executable)
60    elif __file__:
61        g_pathname = os.path.dirname(__file__)
62
63    g_pathname = os.path.abspath(g_pathname )
64    app = QtGui.QApplication(sys.argv)
65
66    #- Load traduction
67    locale = QLocale.system().name();
68
69    MizFile.workpath = g_pathname
70    #-Debug
71    #locale = "fr_FR"
72    #locale = "en_US"
73   
74    translator = QTranslator()
75    translator.load(QString("lome_"+locale), QString(os.path.join(g_pathname, "i18n")))
76    app.installTranslator(translator);
77   
78    cst_init( app )
79
80    try:
81        window = LotatcWnd(g_pathname)
82
83        window.show()
84        sys.exit(app.exec_())   
85    except SystemExit:
86        pass
87    except:
88        exceptionType, exceptionValue, exceptionTraceback = sys.exc_info()
89        msg_a = traceback.format_exception(exceptionType, exceptionValue, exceptionTraceback)
90        msg = ""
91        for m in msg_a:
92            msg += m
93        print msg
94        logging.getLogger('[ERROR]').debug(msg)
Note: See TracBrowser for help on using the repository browser.