diff options
author | mkaay <mkaay@mkaay.de> | 2010-10-08 14:37:49 +0200 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2010-10-08 14:37:49 +0200 |
commit | 74c7c19e69a5eadc2c1feca7608011de11c02418 (patch) | |
tree | d12a2dd4af97c0e07b0417fa6cfa2986d0005d86 /pyLoadGui.py | |
parent | closed #82 (diff) | |
download | pyload-74c7c19e69a5eadc2c1feca7608011de11c02418.tar.xz |
closed #144
Diffstat (limited to 'pyLoadGui.py')
-rwxr-xr-x | pyLoadGui.py | 20 |
1 files changed, 16 insertions, 4 deletions
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 |