| 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 LOME entry |
|---|
| 20 | # Launch LOME |
|---|
| 21 | import sys,os,logging,logging.config,traceback |
|---|
| 22 | sys.path.append(os.path.join(sys.path[0],'common')) |
|---|
| 23 | sys.path.append(os.path.join(sys.path[0],'common','misabstractlayer')) |
|---|
| 24 | sys.path.append(os.path.join(sys.path[0],'lome')) |
|---|
| 25 | from PyQt4.QtGui import * |
|---|
| 26 | from lomewnd import * |
|---|
| 27 | from debug import * |
|---|
| 28 | from constants import * |
|---|
| 29 | |
|---|
| 30 | logging.config.fileConfig('logging.conf') |
|---|
| 31 | |
|---|
| 32 | if __name__ == "__main__": |
|---|
| 33 | #try: |
|---|
| 34 | # pathname = dirname( __file__ ) |
|---|
| 35 | #except: |
|---|
| 36 | # pathname = dirname( sys.argv[0] ) |
|---|
| 37 | pathname = os.path.abspath(dirname( sys.argv[0] )) |
|---|
| 38 | app = QtGui.QApplication(sys.argv) |
|---|
| 39 | |
|---|
| 40 | #- Load traduction |
|---|
| 41 | locale = QLocale.system().name(); |
|---|
| 42 | |
|---|
| 43 | #-Debug |
|---|
| 44 | #locale = "fr_FR" |
|---|
| 45 | #locale = "hr_HR" |
|---|
| 46 | |
|---|
| 47 | translator = QTranslator() |
|---|
| 48 | translator.load(QString("lome_"+locale), QString(os.path.join(pathname, "i18n"))) |
|---|
| 49 | app.installTranslator(translator); |
|---|
| 50 | |
|---|
| 51 | cst_init( app ) |
|---|
| 52 | |
|---|
| 53 | try: |
|---|
| 54 | window = LomeWnd(pathname) |
|---|
| 55 | window.show() |
|---|
| 56 | sys.exit(app.exec_()) |
|---|
| 57 | except SystemExit: |
|---|
| 58 | pass |
|---|
| 59 | except: |
|---|
| 60 | exceptionType, exceptionValue, exceptionTraceback = sys.exc_info() |
|---|
| 61 | msg_a = traceback.format_exception(exceptionType, exceptionValue, exceptionTraceback) |
|---|
| 62 | msg = "" |
|---|
| 63 | for m in msg_a: |
|---|
| 64 | msg += m |
|---|
| 65 | logging.getLogger('[ERROR]').debug(msg) |
|---|