Creating a hollow shell of a UI
[gc-dialer] / src / dialcentral.py
index 19191a8..8f3fe12 100755 (executable)
@@ -1,31 +1,45 @@
-#!/usr/bin/python
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+Copyright (C) 2007 Christoph Würstle
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 2 as
+published by the Free Software Foundation.
+"""
+
 
 import os
 import sys
 import logging
 
 
-_moduleLogger = logging.getLogger("dialcentral")
-sys.path.insert(0,"/opt/dialcentral/lib")
+_moduleLogger = logging.getLogger(__name__)
+sys.path.append("/opt/dialcentral/lib")
 
 
 import constants
-import dc_glade
-
-
-try:
-       os.makedirs(constants._data_path_)
-except OSError, e:
-       if e.errno != 17:
-               raise
-
-logging.basicConfig(level=logging.DEBUG, filename=constants._user_logpath_)
-_moduleLogger.info("Dialcentral %s-%s" % (constants.__version__, constants.__build__))
-_moduleLogger.info("OS: %s" % (os.uname()[0], ))
-_moduleLogger.info("Kernel: %s (%s) for %s" % os.uname()[2:])
-_moduleLogger.info("Hostname: %s" % os.uname()[1])
-
-try:
-       dc_glade.run_dialpad()
-finally:
-       logging.shutdown()
+import dialcentral_qt
+
+
+if __name__ == "__main__":
+       try:
+               os.makedirs(constants._data_path_)
+       except OSError, e:
+               if e.errno != 17:
+                       raise
+
+       try:
+               os.makedirs(constants._cache_path_)
+       except OSError, e:
+               if e.errno != 17:
+                       raise
+
+       logFormat = '(%(asctime)s) %(levelname)-5s %(threadName)s.%(name)s: %(message)s'
+       logging.basicConfig(level=logging.DEBUG, filename=constants._user_logpath_, format=logFormat)
+       _moduleLogger.info("%s %s-%s" % (constants.__app_name__, constants.__version__, constants.__build__))
+       _moduleLogger.info("OS: %s" % (os.uname()[0], ))
+       _moduleLogger.info("Kernel: %s (%s) for %s" % os.uname()[2:])
+       _moduleLogger.info("Hostname: %s" % os.uname()[1])
+
+       dialcentral_qt.run()