diff options
| -rw-r--r-- | module/gui/Queue.py | 2 | ||||
| -rwxr-xr-x | pyLoadGui.py | 20 | 
2 files changed, 18 insertions, 4 deletions
| diff --git a/module/gui/Queue.py b/module/gui/Queue.py index 9225df58f..1bfd23af1 100644 --- a/module/gui/Queue.py +++ b/module/gui/Queue.py @@ -65,6 +65,8 @@ class QueueModel(CollectorModel):      def update(self):          locker = QMutexLocker(self.mutex)          downloading = self.connector.getDownloadQueue() +        if downloading is None: +            return          for p, pack in enumerate(self._data):              for d in downloading:                  child = pack.getChild(d["id"]) diff --git a/pyLoadGui.py b/pyLoadGui.py index 994e1dfb3..752a20409 100755 --- a/pyLoadGui.py +++ b/pyLoadGui.py @@ -92,7 +92,7 @@ class main(QObject):          self.serverStatus = {"pause":True, "speed":0, "freespace":0}          self.core = None # pyLoadCore if started - +        self.connectionLost = False          if True: # when used if first, minimizing not working correctly..              self.tray = TrayIcon() @@ -118,7 +118,7 @@ class main(QObject):              self.init()              return          self.connector.start() -        self.connect(self.connector, SIGNAL("connectionLost"), sys.exit) +        self.connect(self.connector, SIGNAL("connectionLost"), self.slotConnectionLost)          sleep(1)          self.restoreMainWindow()          self.mainWindow.show() @@ -139,7 +139,7 @@ class main(QObject):          """          self.tray.showAction.setDisabled(True)          self.disconnect(self.clipboard, SIGNAL('dataChanged()'), self.slotClipboardChange) -        self.disconnect(self.connector, SIGNAL("connectionLost"), sys.exit) +        self.disconnect(self.connector, SIGNAL("connectionLost"), self.slotConnectionLost)          self.mainloop.stop()          self.connector.stop()          self.mainWindow.saveWindow() @@ -275,7 +275,10 @@ class main(QObject):          """              refresh server status and overall speed in the status bar          """ -        self.serverStatus.update(self.connector.getServerStatus()) +        s = self.connector.getServerStatus() +        if s is None: +            return +        self.serverStatus.update(s)          if self.serverStatus["pause"]:              self.serverStatus["status"] = _("paused")          else: @@ -638,6 +641,8 @@ class main(QObject):      def pullEvents(self):          events = self.connector.getEvents() +        if events is None: +            return          for event in events:              if event[0] == "account":                  self.mainWindow.emit(SIGNAL("reloadAccounts"), False) @@ -677,6 +682,13 @@ class main(QObject):                      break                  sleep(0.5) +    def slotConnectionLost(self): +        if not self.connectionLost: +            self.connectionLost = True +            m = QMessageBox(QMessageBox.Critical, _("Connection lost"), _("Lost connection to the core!"), QMessageBox.Ok) +            m.exec_() +            self.slotQuit() +          class Loop():          def __init__(self, parent):              self.parent = parent | 
