diff options
author | mkaay <mkaay@mkaay.de> | 2010-02-02 22:15:48 +0100 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2010-02-02 22:15:48 +0100 |
commit | dc97a68f74dc0966b1df9e8f8231d76ecd9f2673 (patch) | |
tree | ba05b6850867bf5033d1fa725a442ba7d325956b /module/gui | |
parent | forgot file (diff) | |
download | pyload-dc97a68f74dc0966b1df9e8f8231d76ecd9f2673.tar.xz |
some gui fixes, i18n update
Diffstat (limited to 'module/gui')
-rw-r--r-- | module/gui/Collector.py | 15 | ||||
-rw-r--r-- | module/gui/Queue.py | 11 | ||||
-rw-r--r-- | module/gui/connector.py | 3 |
3 files changed, 19 insertions, 10 deletions
diff --git a/module/gui/Collector.py b/module/gui/Collector.py index c0754aa42..ebdbd372d 100644 --- a/module/gui/Collector.py +++ b/module/gui/Collector.py @@ -66,12 +66,12 @@ class PackageCollector(QObject): for pack in ItemIterator(self.rootItem): for k, child in enumerate(pack.getChildren()): if child.getFileData()["id"] == event[3]: - pack.takeChild(k) + pack.removeChild(child) break else: for k, pack in enumerate(ItemIterator(self.rootItem)): if pack.getPackData()["id"] == event[3]: - self.rootItem.takeChild(k) + self.rootItem.removeChild(pack) break def insertEvent(self, event): @@ -99,6 +99,8 @@ class PackageCollector(QObject): def updateEvent(self, event): if event[2] == "file": info = self.connector.getLinkInfo(event[3]) + if not info: + return for pack in ItemIterator(self.rootItem): if pack.getPackData()["id"] == info["package"]: child = pack.getChild(event[3]) @@ -145,7 +147,7 @@ class PackageCollector(QObject): def clearAll(self): for k, pack in enumerate(ItemIterator(self.rootItem)): if not pack.getPackData()["id"] == "fixed": - self.rootItem.takeChild(k) + self.rootItem.removeChild(pack) class PackageCollectorPack(QTreeWidgetItem): def __init__(self, collector): @@ -238,7 +240,7 @@ class LinkCollector(QObject): if event[2] == "file": for k, file in enumerate(ItemIterator(self.rootItem)): if file.getFileData()["id"] == event[3]: - self.rootItem.takeChild(k) + self.rootItem.removeChild(file) break def insertEvent(self, event): @@ -251,6 +253,8 @@ class LinkCollector(QObject): def updateEvent(self, event): if event[2] == "file": data = self.connector.getLinkInfo(event[3]) + if not data: + return file = getFile(event[3]) file.setFileData(data) self.addFile(event[3], file) @@ -281,7 +285,8 @@ class LinkCollector(QObject): return None def clearAll(self): - self.rootItem.takeChildren() + for k, file in enumerate(ItemIterator(self.rootItem)): + self.rootItem.removeChild(file) class LinkCollectorFile(QTreeWidgetItem): def __init__(self, collector): diff --git a/module/gui/Queue.py b/module/gui/Queue.py index 9659137ec..bd45e27dc 100644 --- a/module/gui/Queue.py +++ b/module/gui/Queue.py @@ -89,7 +89,6 @@ class Queue(QObject): self.addPack(pack.getPackData()["id"], pack) def fullReload(self): - locker = QMutexLocker(self.mutex) self.clearAll() packs = self.connector.getPackageQueue() for data in packs: @@ -106,6 +105,7 @@ class Queue(QObject): self.addPack(data["id"], pack) def addEvent(self, event): + locker = QMutexLocker(self.mutex) if event[0] == "reload": self.fullReload() elif event[0] == "remove": @@ -120,12 +120,12 @@ class Queue(QObject): for pack in ItemIterator(self.rootItem): for k, child in enumerate(pack.getChildren()): if child.getFileData()["id"] == event[3]: - pack.takeChild(k) + pack.removeChild(child) break else: for k, pack in enumerate(ItemIterator(self.rootItem)): if pack.getPackData()["id"] == event[3]: - self.rootItem.takeChild(k) + self.rootItem.removeChild(pack) break def insertEvent(self, event): @@ -155,6 +155,8 @@ class Queue(QObject): def updateEvent(self, event): if event[2] == "file": info = self.connector.getLinkInfo(event[3]) + if not info: + return for pack in ItemIterator(self.rootItem): if pack.getPackData()["id"] == info["package"]: child = pack.getChild(event[3]) @@ -219,7 +221,8 @@ class Queue(QObject): return None def clearAll(self): - self.rootItem.takeChildren() + for pack in ItemIterator(self.rootItem): + self.rootItem.removeChild(pack) def getWaitingProgress(self, q): locker = QMutexLocker(self.mutex) diff --git a/module/gui/connector.py b/module/gui/connector.py index 3146ecf5b..b6c383956 100644 --- a/module/gui/connector.py +++ b/module/gui/connector.py @@ -131,7 +131,8 @@ class connector(QThread): info["downloading"] = None return info except Exception, e: - self.emit(SIGNAL("proxy_error"), "getLinkInfo", e) + #self.emit(SIGNAL("proxy_error"), "getLinkInfo", e) + return None finally: self.mutex.unlock() |