Making an assert a bit more helpful
[gonvert] / src / gonvert_qt.py
index 02b64c9..561c737 100755 (executable)
@@ -6,17 +6,18 @@
 
 from __future__ import with_statement
 
-import sys
 import os
 import math
 import simplejson
 import logging
+import logging.handlers
 
-from PyQt4 import QtGui
-from PyQt4 import QtCore
+import util.qt_compat as qt_compat
+QtCore = qt_compat.QtCore
+QtGui = qt_compat.import_module("QtGui")
 
 import constants
-import maeqt
+from util import qui_utils
 from util import misc as misc_utils
 import unit_data
 
@@ -24,9 +25,6 @@ import unit_data
 _moduleLogger = logging.getLogger(__name__)
 
 
-IS_MAEMO = True
-
-
 def split_number(number):
        if number == 0.0:
                # Optimize the startup case
@@ -186,13 +184,15 @@ class Gonvert(object):
                return self._mainWindow
 
        def search_units(self):
-               jumpWindow = QuickJump(None, self)
+               import windows
+               jumpWindow = windows.QuickJump(None, self)
                jumpWindow.window.destroyed.connect(self._on_jump_close)
                self._jumpWindow = jumpWindow
                return self._jumpWindow
 
        def show_recent(self):
-               recentWindow = Recent(None, self)
+               import windows
+               recentWindow = windows.Recent(None, self)
                recentWindow.window.destroyed.connect(self._on_recent_close)
                self._recentWindow = recentWindow
                return self._recentWindow
@@ -275,7 +275,7 @@ class Gonvert(object):
 
                self._showFavoritesAction.setChecked(settings.get("showFavorites", True))
 
-               self._condensedAction.setChecked(settings.get("useQuick", self._condensedAction.isChecked()))
+               self._condensedAction.setChecked(settings.get("useQuick", True))
 
        def save_settings(self):
                if self._sortByNameAction.isChecked():
@@ -415,201 +415,6 @@ class Gonvert(object):
                self._close_windows()
 
 
-class QuickJump(object):
-
-       MINIMAL_ENTRY = 3
-
-       def __init__(self, parent, app):
-               self._app = app
-
-               self._searchLabel = QtGui.QLabel("Search:")
-               self._searchEntry = QtGui.QLineEdit("")
-               self._searchEntry.textEdited.connect(self._on_search_edited)
-
-               self._entryLayout = QtGui.QHBoxLayout()
-               self._entryLayout.addWidget(self._searchLabel)
-               self._entryLayout.addWidget(self._searchEntry)
-
-               self._resultsBox = QtGui.QTreeWidget()
-               self._resultsBox.setHeaderLabels(["Categories", "Units"])
-               self._resultsBox.setHeaderHidden(True)
-               if not IS_MAEMO:
-                       self._resultsBox.setAlternatingRowColors(True)
-               self._resultsBox.itemClicked.connect(self._on_result_clicked)
-
-               self._layout = QtGui.QVBoxLayout()
-               self._layout.addLayout(self._entryLayout)
-               self._layout.addWidget(self._resultsBox)
-
-               centralWidget = QtGui.QWidget()
-               centralWidget.setLayout(self._layout)
-
-               self._window = QtGui.QMainWindow(parent)
-               self._window.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)
-               maeqt.set_autorient(self._window, True)
-               maeqt.set_stackable(self._window, True)
-               self._window.setWindowTitle("%s - Quick Jump" % constants.__pretty_app_name__)
-               self._window.setWindowIcon(QtGui.QIcon(self._app.appIconPath))
-               self._window.setCentralWidget(centralWidget)
-
-               self._closeWindowAction = QtGui.QAction(None)
-               self._closeWindowAction.setText("Close")
-               self._closeWindowAction.setShortcut(QtGui.QKeySequence("CTRL+w"))
-               self._closeWindowAction.triggered.connect(self._on_close_window)
-
-               if IS_MAEMO:
-                       self._window.addAction(self._closeWindowAction)
-                       self._window.addAction(self._app.quitAction)
-                       self._window.addAction(self._app.fullscreenAction)
-               else:
-                       fileMenu = self._window.menuBar().addMenu("&Units")
-                       fileMenu.addAction(self._closeWindowAction)
-                       fileMenu.addAction(self._app.quitAction)
-
-                       viewMenu = self._window.menuBar().addMenu("&View")
-                       viewMenu.addAction(self._app.fullscreenAction)
-
-               self._window.addAction(self._app.logAction)
-
-               self.set_fullscreen(self._app.fullscreenAction.isChecked())
-               self._window.show()
-
-       @property
-       def window(self):
-               return self._window
-
-       def show(self):
-               self._window.show()
-
-       def hide(self):
-               self._window.hide()
-
-       def close(self):
-               self._window.close()
-
-       def set_fullscreen(self, isFullscreen):
-               if isFullscreen:
-                       self._window.showFullScreen()
-               else:
-                       self._window.showNormal()
-
-       @misc_utils.log_exception(_moduleLogger)
-       def _on_close_window(self, checked = True):
-               self.close()
-
-       @misc_utils.log_exception(_moduleLogger)
-       def _on_result_clicked(self, item, columnIndex):
-               categoryName = unicode(item.text(0))
-               unitName = unicode(item.text(1))
-               catWindow = self._app.request_category()
-               unitsWindow = catWindow.select_category(categoryName)
-               unitsWindow.select_unit(unitName)
-               self.close()
-
-       @misc_utils.log_exception(_moduleLogger)
-       def _on_search_edited(self, *args):
-               userInput = self._searchEntry.text()
-               if len(userInput) <  self.MINIMAL_ENTRY:
-                       return
-
-               self._resultsBox.clear()
-               lowerInput = str(userInput).lower()
-               for catIndex, category in enumerate(unit_data.UNIT_CATEGORIES):
-                       units = unit_data.get_units(category)
-                       for unitIndex, unit in enumerate(units):
-                               loweredUnit = unit.lower()
-                               if lowerInput in loweredUnit:
-                                       twi = QtGui.QTreeWidgetItem(self._resultsBox)
-                                       twi.setText(0, category)
-                                       twi.setText(1, unit)
-
-
-class Recent(object):
-
-       def __init__(self, parent, app):
-               self._app = app
-
-               self._resultsBox = QtGui.QTreeWidget()
-               self._resultsBox.setHeaderLabels(["Categories", "Units"])
-               self._resultsBox.setHeaderHidden(True)
-               if not IS_MAEMO:
-                       self._resultsBox.setAlternatingRowColors(True)
-               self._resultsBox.itemClicked.connect(self._on_result_clicked)
-
-               self._layout = QtGui.QVBoxLayout()
-               self._layout.addWidget(self._resultsBox)
-
-               centralWidget = QtGui.QWidget()
-               centralWidget.setLayout(self._layout)
-
-               self._window = QtGui.QMainWindow(parent)
-               self._window.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)
-               maeqt.set_autorient(self._window, True)
-               maeqt.set_stackable(self._window, True)
-               self._window.setWindowTitle("%s - Recent" % constants.__pretty_app_name__)
-               self._window.setWindowIcon(QtGui.QIcon(self._app.appIconPath))
-               self._window.setCentralWidget(centralWidget)
-
-               for cat, unit in self._app.get_recent():
-                       twi = QtGui.QTreeWidgetItem(self._resultsBox)
-                       twi.setText(0, cat)
-                       twi.setText(1, unit)
-
-               self._closeWindowAction = QtGui.QAction(None)
-               self._closeWindowAction.setText("Close")
-               self._closeWindowAction.setShortcut(QtGui.QKeySequence("CTRL+w"))
-               self._closeWindowAction.triggered.connect(self._on_close_window)
-
-               if IS_MAEMO:
-                       self._window.addAction(self._closeWindowAction)
-                       self._window.addAction(self._app.quitAction)
-                       self._window.addAction(self._app.fullscreenAction)
-               else:
-                       fileMenu = self._window.menuBar().addMenu("&Units")
-                       fileMenu.addAction(self._closeWindowAction)
-                       fileMenu.addAction(self._app.quitAction)
-
-                       viewMenu = self._window.menuBar().addMenu("&View")
-                       viewMenu.addAction(self._app.fullscreenAction)
-
-               self._window.addAction(self._app.logAction)
-
-               self.set_fullscreen(self._app.fullscreenAction.isChecked())
-               self._window.show()
-
-       @property
-       def window(self):
-               return self._window
-
-       def show(self):
-               self._window.show()
-
-       def hide(self):
-               self._window.hide()
-
-       def close(self):
-               self._window.close()
-
-       def set_fullscreen(self, isFullscreen):
-               if isFullscreen:
-                       self._window.showFullScreen()
-               else:
-                       self._window.showNormal()
-
-       @misc_utils.log_exception(_moduleLogger)
-       def _on_close_window(self, checked = True):
-               self.close()
-
-       @misc_utils.log_exception(_moduleLogger)
-       def _on_result_clicked(self, item, columnIndex):
-               categoryName = unicode(item.text(0))
-               unitName = unicode(item.text(1))
-               catWindow = self._app.request_category()
-               unitsWindow = catWindow.select_category(categoryName)
-               unitsWindow.select_unit(unitName)
-               self.close()
-
-
 class QuickConvert(object):
 
        def __init__(self, parent, app):
@@ -621,12 +426,12 @@ class QuickConvert(object):
                self._favoritesWindow = None
 
                self._inputUnitValue = QtGui.QLineEdit()
-               maeqt.mark_numbers_preferred(self._inputUnitValue)
+               qui_utils.mark_numbers_preferred(self._inputUnitValue)
                self._inputUnitValue.textEdited.connect(self._on_value_edited)
                self._inputUnitSymbol = QtGui.QLabel()
 
                self._outputUnitValue = QtGui.QLineEdit()
-               maeqt.mark_numbers_preferred(self._outputUnitValue)
+               qui_utils.mark_numbers_preferred(self._outputUnitValue)
                self._outputUnitValue.textEdited.connect(self._on_output_value_edited)
                self._outputUnitSymbol = QtGui.QLabel()
 
@@ -639,7 +444,8 @@ class QuickConvert(object):
                self._categoryView = QtGui.QTreeWidget()
                self._categoryView.setHeaderLabels(["Categories"])
                self._categoryView.setHeaderHidden(False)
-               if not IS_MAEMO:
+               self._categoryView.setRootIsDecorated(False)
+               if not constants.IS_MAEMO:
                        self._categoryView.setAlternatingRowColors(True)
                self._categoryView.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
                self._categoryView.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
@@ -653,7 +459,8 @@ class QuickConvert(object):
                self._inputView.setHeaderLabels(["From", "Name"])
                self._inputView.setHeaderHidden(False)
                self._inputView.header().hideSection(1)
-               if not IS_MAEMO:
+               self._inputView.setRootIsDecorated(False)
+               if not constants.IS_MAEMO:
                        self._inputView.setAlternatingRowColors(True)
                self._inputView.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
                self._inputView.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
@@ -664,7 +471,8 @@ class QuickConvert(object):
                self._outputView.setHeaderLabels(["To", "Name"])
                self._outputView.setHeaderHidden(False)
                self._outputView.header().hideSection(1)
-               if not IS_MAEMO:
+               self._outputView.setRootIsDecorated(False)
+               if not constants.IS_MAEMO:
                        self._outputView.setAlternatingRowColors(True)
                self._outputView.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
                self._outputView.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
@@ -686,8 +494,7 @@ class QuickConvert(object):
 
                self._window = QtGui.QMainWindow(parent)
                self._window.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)
-               maeqt.set_autorient(self._window, True)
-               maeqt.set_stackable(self._window, True)
+               qui_utils.set_stackable(self._window, True)
                self._window.setWindowTitle("%s - Quick Convert" % (constants.__pretty_app_name__, ))
                self._window.setWindowIcon(QtGui.QIcon(app.appIconPath))
                self._window.setCentralWidget(centralWidget)
@@ -708,7 +515,7 @@ class QuickConvert(object):
                self._closeWindowAction.setShortcut(QtGui.QKeySequence("CTRL+w"))
                self._closeWindowAction.triggered.connect(self._on_close_window)
 
-               if IS_MAEMO:
+               if constants.IS_MAEMO:
                        self._window.addAction(self._closeWindowAction)
                        self._window.addAction(self._app.quitAction)
                        self._window.addAction(self._app.fullscreenAction)
@@ -959,7 +766,8 @@ class QuickConvert(object):
        @misc_utils.log_exception(_moduleLogger)
        def _on_choose_category_favorites(self, obj = None):
                assert self._favoritesWindow is None
-               self._favoritesWindow = FavoritesWindow(
+               import windows
+               self._favoritesWindow = windows.FavoritesWindow(
                        self._window,
                        self._app,
                        unit_data.UNIT_CATEGORIES,
@@ -971,7 +779,8 @@ class QuickConvert(object):
        @misc_utils.log_exception(_moduleLogger)
        def _on_choose_unit_favorites(self, obj = None):
                assert self._favoritesWindow is None
-               self._favoritesWindow = FavoritesWindow(
+               import windows
+               self._favoritesWindow = windows.FavoritesWindow(
                        self._window,
                        self._app,
                        unit_data.get_units(self._categoryName),
@@ -1022,144 +831,13 @@ class QuickConvert(object):
                        for item in self._outputView.selectedItems()
                ]
                if selectedNames:
-                       assert len(selectedNames) == 1
+                       assert len(selectedNames) == 1, selectedNames
                        name = selectedNames[0]
                        self._select_output(name)
                else:
                        pass
 
 
-class FavoritesWindow(object):
-
-       def __init__(self, parent, app, source, hidden):
-               self._app = app
-               self._source = list(source)
-               self._hidden = hidden
-
-               self._categories = QtGui.QTreeWidget()
-               self._categories.setHeaderLabels(["Categories"])
-               self._categories.setHeaderHidden(True)
-               self._categories.setSelectionMode(QtGui.QAbstractItemView.NoSelection)
-               if not IS_MAEMO:
-                       self._categories.setAlternatingRowColors(True)
-               self._childWidgets = []
-               for catName in self._source:
-                       twi = QtGui.QTreeWidgetItem(self._categories)
-                       twi.setText(0, catName)
-                       self._childWidgets.append(twi)
-                       if catName in self._hidden:
-                               twi.setCheckState(0, QtCore.Qt.Unchecked)
-                       else:
-                               twi.setCheckState(0, QtCore.Qt.Checked)
-               self._categories.itemChanged.connect(self._on_item_changed)
-
-               self._allButton = QtGui.QPushButton("All")
-               self._allButton.clicked.connect(self._on_select_all)
-               self._invertButton = QtGui.QPushButton("Invert")
-               self._invertButton.clicked.connect(self._on_invert_selection)
-               self._noneButton = QtGui.QPushButton("None")
-               self._noneButton.clicked.connect(self._on_select_none)
-
-               self._buttonLayout = QtGui.QHBoxLayout()
-               self._buttonLayout.addWidget(self._allButton)
-               self._buttonLayout.addWidget(self._invertButton)
-               self._buttonLayout.addWidget(self._noneButton)
-
-               self._layout = QtGui.QVBoxLayout()
-               self._layout.addWidget(self._categories)
-               self._layout.addLayout(self._buttonLayout)
-
-               centralWidget = QtGui.QWidget()
-               centralWidget.setLayout(self._layout)
-
-               self._window = QtGui.QMainWindow(parent)
-               self._window.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)
-               maeqt.set_autorient(self._window, True)
-               maeqt.set_stackable(self._window, True)
-               self._window.setWindowTitle("%s - Favorites" % constants.__pretty_app_name__)
-               self._window.setWindowIcon(QtGui.QIcon(self._app.appIconPath))
-               self._window.setCentralWidget(centralWidget)
-
-               self._closeWindowAction = QtGui.QAction(None)
-               self._closeWindowAction.setText("Close")
-               self._closeWindowAction.setShortcut(QtGui.QKeySequence("CTRL+w"))
-               self._closeWindowAction.triggered.connect(self._on_close_window)
-
-               if IS_MAEMO:
-                       self._window.addAction(self._closeWindowAction)
-                       self._window.addAction(self._app.quitAction)
-                       self._window.addAction(self._app.fullscreenAction)
-               else:
-                       fileMenu = self._window.menuBar().addMenu("&Units")
-                       fileMenu.addAction(self._closeWindowAction)
-                       fileMenu.addAction(self._app.quitAction)
-
-                       viewMenu = self._window.menuBar().addMenu("&View")
-                       viewMenu.addAction(self._app.fullscreenAction)
-
-               self._window.addAction(self._app.logAction)
-
-               self.set_fullscreen(self._app.fullscreenAction.isChecked())
-               self._window.show()
-
-       @property
-       def window(self):
-               return self._window
-
-       def show(self):
-               self._window.show()
-
-       def hide(self):
-               self._window.hide()
-
-       def close(self):
-               self._window.close()
-
-       def set_fullscreen(self, isFullscreen):
-               if isFullscreen:
-                       self._window.showFullScreen()
-               else:
-                       self._window.showNormal()
-
-       @misc_utils.log_exception(_moduleLogger)
-       def _on_select_all(self, checked = False):
-               for child in self._childWidgets:
-                       child.setCheckState(0, QtCore.Qt.Checked)
-
-       @misc_utils.log_exception(_moduleLogger)
-       def _on_invert_selection(self, checked = False):
-               for child in self._childWidgets:
-                       state = child.checkState(0)
-                       if state == QtCore.Qt.Unchecked:
-                               newState = QtCore.Qt.Checked
-                       elif state == QtCore.Qt.Checked:
-                               newState = QtCore.Qt.Unchecked
-                       else:
-                               raise RuntimeError("Bad check state %r" % state)
-                       child.setCheckState(0, newState)
-
-       @misc_utils.log_exception(_moduleLogger)
-       def _on_select_none(self, checked = False):
-               for child in self._childWidgets:
-                       child.setCheckState(0, QtCore.Qt.Unchecked)
-
-       @misc_utils.log_exception(_moduleLogger)
-       def _on_item_changed(self, item, column):
-               state = item.checkState(column)
-               if state == QtCore.Qt.Unchecked:
-                       name = str(item.text(column))
-                       self._hidden.add(name)
-               elif state == QtCore.Qt.Checked:
-                       name = str(item.text(column))
-                       self._hidden.remove(name)
-               else:
-                       raise RuntimeError("Bad check state %r" % state)
-
-       @misc_utils.log_exception(_moduleLogger)
-       def _on_close_window(self, checked = True):
-               self.close()
-
-
 class CategoryWindow(object):
 
        def __init__(self, parent, app):
@@ -1171,9 +849,10 @@ class CategoryWindow(object):
                self._categories.setHeaderLabels(["Categories"])
                self._categories.itemClicked.connect(self._on_category_clicked)
                self._categories.setHeaderHidden(True)
+               self._categories.setRootIsDecorated(False)
                self._categories.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
                self._categories.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
-               if not IS_MAEMO:
+               if not constants.IS_MAEMO:
                        self._categories.setAlternatingRowColors(True)
                for catName in unit_data.UNIT_CATEGORIES:
                        twi = QtGui.QTreeWidgetItem(self._categories)
@@ -1187,8 +866,7 @@ class CategoryWindow(object):
 
                self._window = QtGui.QMainWindow(parent)
                self._window.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)
-               maeqt.set_autorient(self._window, True)
-               maeqt.set_stackable(self._window, True)
+               qui_utils.set_stackable(self._window, True)
                self._window.setWindowTitle("%s - Categories" % constants.__pretty_app_name__)
                self._window.setWindowIcon(QtGui.QIcon(self._app.appIconPath))
                self._window.setCentralWidget(centralWidget)
@@ -1205,7 +883,7 @@ class CategoryWindow(object):
                self._closeWindowAction.setShortcut(QtGui.QKeySequence("CTRL+w"))
                self._closeWindowAction.triggered.connect(self._on_close_window)
 
-               if IS_MAEMO:
+               if constants.IS_MAEMO:
                        fileMenu = self._window.menuBar().addMenu("&Units")
                        fileMenu.addAction(self._chooseFavoritesAction)
 
@@ -1317,7 +995,8 @@ class CategoryWindow(object):
        @misc_utils.log_exception(_moduleLogger)
        def _on_choose_favorites(self, obj = None):
                assert self._favoritesWindow is None
-               self._favoritesWindow = FavoritesWindow(
+               import windows
+               self._favoritesWindow = windows.FavoritesWindow(
                        self._window,
                        self._app,
                        unit_data.UNIT_CATEGORIES,
@@ -1572,7 +1251,7 @@ class UnitWindow(object):
                self._selectedUnitName = QtGui.QLabel()
                self._selectedUnitValue = QtGui.QLineEdit()
                self._selectedUnitValue.textEdited.connect(self._on_value_edited)
-               maeqt.mark_numbers_preferred(self._selectedUnitValue)
+               qui_utils.mark_numbers_preferred(self._selectedUnitValue)
                self._selectedUnitSymbol = QtGui.QLabel()
                self._updateDelayTimer = QtCore.QTimer()
                self._updateDelayTimer.setInterval(100)
@@ -1589,12 +1268,13 @@ class UnitWindow(object):
                self._unitsView.setModel(self._unitsModel)
                self._unitsView.setUniformRowHeights(True)
                self._unitsView.setSortingEnabled(True)
+               self._unitsView.setRootIsDecorated(False)
                self._unitsView.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
                self._unitsView.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
                self._unitsView.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
                self._unitsView.setHeaderHidden(True)
                self._unitsView.clicked.connect(self._on_unit_clicked)
-               if not IS_MAEMO:
+               if not constants.IS_MAEMO:
                        self._unitsView.setAlternatingRowColors(True)
 
                viewHeader = self._unitsView.header()
@@ -1624,8 +1304,7 @@ class UnitWindow(object):
 
                self._window = QtGui.QMainWindow(parent)
                self._window.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)
-               maeqt.set_autorient(self._window, True)
-               maeqt.set_stackable(self._window, True)
+               qui_utils.set_stackable(self._window, True)
                self._window.setWindowTitle("%s - %s" % (constants.__pretty_app_name__, category))
                self._window.setWindowIcon(QtGui.QIcon(app.appIconPath))
                self._window.setCentralWidget(centralWidget)
@@ -1670,7 +1349,7 @@ class UnitWindow(object):
                self._closeWindowAction.setShortcut(QtGui.QKeySequence("CTRL+w"))
                self._closeWindowAction.triggered.connect(self._on_close_window)
 
-               if IS_MAEMO:
+               if constants.IS_MAEMO:
                        self._window.addAction(self._closeWindowAction)
                        self._window.addAction(self._app.quitAction)
                        self._window.addAction(self._app.fullscreenAction)
@@ -1795,7 +1474,8 @@ class UnitWindow(object):
        @misc_utils.log_exception(_moduleLogger)
        def _on_choose_favorites(self, obj = None):
                assert self._favoritesWindow is None
-               self._favoritesWindow = FavoritesWindow(
+               import windows
+               self._favoritesWindow = windows.FavoritesWindow(
                        self._window,
                        self._app,
                        unit_data.get_units(self._categoryName),
@@ -1873,6 +1553,23 @@ class UnitWindow(object):
 
 
 def run_gonvert():
+       try:
+               os.makedirs(constants._data_path_)
+       except OSError, e:
+               if e.errno != 17:
+                       raise
+
+       logFormat = '(%(relativeCreated)5d) %(levelname)-5s %(threadName)s.%(name)s.%(funcName)s: %(message)s'
+       logging.basicConfig(level=logging.DEBUG, format=logFormat)
+       rotating = logging.handlers.RotatingFileHandler(constants._user_logpath_, maxBytes=512*1024, backupCount=1)
+       rotating.setFormatter(logging.Formatter(logFormat))
+       root = logging.getLogger()
+       root.addHandler(rotating)
+       _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])
+
        app = QtGui.QApplication([])
        handle = Gonvert(app)
        if constants.PROFILE_STARTUP:
@@ -1882,12 +1579,6 @@ def run_gonvert():
 
 
 if __name__ == "__main__":
-       logging.basicConfig(level = logging.DEBUG)
-       try:
-               os.makedirs(constants._data_path_)
-       except OSError, e:
-               if e.errno != 17:
-                       raise
-
+       import sys
        val = run_gonvert()
        sys.exit(val)