Bug with entering a text
[gc-dialer] / src / dialcentral_qt.py
index c45b10d..bb377c4 100755 (executable)
@@ -23,6 +23,30 @@ import session
 _moduleLogger = logging.getLogger(__name__)
 
 
+class LedWrapper(object):
+
+       def __init__(self):
+               self._ledHandler = None
+               self._init = False
+
+       def off(self):
+               self._lazy_init()
+               if self._ledHandler is not None:
+                       self._ledHandler.off()
+
+       def _lazy_init(self):
+               if self._init:
+                       return
+               self._init = True
+               try:
+                       import led_handler
+                       self._ledHandler = led_handler.LedHandler()
+               except Exception, e:
+                       _moduleLogger.exception('Unable to initialize LED Handling: "%s"' % str(e))
+                       self._ledHandler = None
+
+
+
 class Dialcentral(object):
 
        _DATA_PATHS = [
@@ -37,6 +61,7 @@ class Dialcentral(object):
                self._hiddenUnits = {}
                self._clipboard = QtGui.QApplication.clipboard()
                self._dataPath = None
+               self._ledHandler = LedWrapper()
                self.notifyOnMissed = False
                self.notifyOnVoicemail = False
                self.notifyOnSms = False
@@ -106,10 +131,10 @@ class Dialcentral(object):
                isFullscreen = False
                tabIndex = 0
                try:
-                       blobs = (
+                       blobs = [
                                config.get(constants.__pretty_app_name__, "bin_blob_%i" % i)
                                for i in xrange(len(self._mainWindow.get_default_credentials()))
-                       )
+                       ]
                        isFullscreen = config.getboolean(constants.__pretty_app_name__, "fullscreen")
                        tabIndex = config.getint(constants.__pretty_app_name__, "tab")
                except ConfigParser.NoOptionError, e:
@@ -217,6 +242,10 @@ class Dialcentral(object):
        def alarmHandler(self):
                return self._alarmHandler
 
+       @property
+       def ledHandler(self):
+               return self._ledHandler
+
        def _walk_children(self):
                if self._mainWindow is not None:
                        return (self._mainWindow, )
@@ -644,7 +673,7 @@ class MainWindow(object):
                        self._session.get_callback_numbers(), self._session.get_callback_number()
                )
                self._accountDialog.accountNumber = self._session.get_account_number()
-               response = self._accountDialog.run()
+               response = self._accountDialog.run(self.window)
                if response == QtGui.QDialog.Accepted:
                        if self._accountDialog.doClear:
                                self._session.logout_and_clear()
@@ -747,7 +776,7 @@ class MainWindow(object):
                        if self._aboutDialog is None:
                                import dialogs
                                self._aboutDialog = dialogs.AboutDialog(self._app)
-                       response = self._aboutDialog.run()
+                       response = self._aboutDialog.run(self.window)
 
        @QtCore.pyqtSlot()
        @QtCore.pyqtSlot(bool)