diff options
author | mkaay <mkaay@mkaay.de> | 2010-09-02 18:55:34 +0200 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2010-09-02 18:55:34 +0200 |
commit | ef049ef51d2e32290af0eb14ece03ef981b4783d (patch) | |
tree | 3e41695f4114e640545ac648f6a9907df789f48f | |
parent | db fixes (diff) | |
download | pyload-ef049ef51d2e32290af0eb14ece03ef981b4783d.tar.xz |
gui: minimize to tray, eta
-rw-r--r-- | module/gui/MainWindow.py | 6 | ||||
-rw-r--r-- | module/gui/Queue.py | 16 | ||||
-rwxr-xr-x | pyLoadGui.py | 9 |
3 files changed, 20 insertions, 11 deletions
diff --git a/module/gui/MainWindow.py b/module/gui/MainWindow.py index 0c8953595..21227bdf5 100644 --- a/module/gui/MainWindow.py +++ b/module/gui/MainWindow.py @@ -113,7 +113,6 @@ class MainWindow(QMainWindow): #signals.. self.connect(self.mactions["manager"], SIGNAL("triggered()"), self.slotShowConnector) - self.connect(self.mactions["exit"], SIGNAL("triggered()"), self.close) self.connect(self.tabs["queue"]["view"], SIGNAL('customContextMenuRequested(const QPoint &)'), self.slotQueueContextMenu) self.connect(self.tabs["collector"]["package_view"], SIGNAL('customContextMenuRequested(const QPoint &)'), self.slotCollectorContextMenu) @@ -346,8 +345,9 @@ class MainWindow(QMainWindow): let me first save my state """ self.saveWindow() - event.accept() - self.emit(SIGNAL("quit")) + event.ignore() + self.hide() + self.emit(SIGNAL("hidden")) def restoreWindow(self, state, geo): """ diff --git a/module/gui/Queue.py b/module/gui/Queue.py index 988f532d7..42e92c61a 100644 --- a/module/gui/Queue.py +++ b/module/gui/Queue.py @@ -26,7 +26,7 @@ from module.gui.Collector import CollectorModel, Package, Link, CollectorView, s class QueueModel(CollectorModel): def __init__(self, view, connector): CollectorModel.__init__(self, view, connector) - self.cols = 5 + self.cols = 6 self.wait_dict = {} self.updater = self.QueueUpdater(self.interval) @@ -84,6 +84,8 @@ class QueueModel(CollectorModel): elif section == 3: return QVariant(_("Priority")) elif section == 4: + return QVariant(_("ETA")) + elif section == 5: return QVariant(_("Progress")) return QVariant() @@ -190,6 +192,11 @@ class QueueModel(CollectorModel): item = index.internalPointer() if isinstance(item, Package): return QVariant(item.data["priority"]) + elif index.column() == 4: + item = index.internalPointer() + if isinstance(item, Link): + if item.data["downloading"]: + return QVariant(item.data["downloading"]["format_eta"]) elif role == Qt.EditRole: if index.column() == 0: return QVariant(index.internalPointer().data["name"]) @@ -209,12 +216,13 @@ class QueueView(CollectorView): self.setColumnWidth(1, 100) self.setColumnWidth(2, 150) self.setColumnWidth(3, 50) - self.setColumnWidth(4, 100) + self.setColumnWidth(4, 50) + self.setColumnWidth(5, 100) self.setEditTriggers(QAbstractItemView.NoEditTriggers) self.delegate = QueueProgressBarDelegate(self, self.model()) - self.setItemDelegateForColumn(4, self.delegate) + self.setItemDelegateForColumn(5, self.delegate) class QueueProgressBarDelegate(QItemDelegate): def __init__(self, parent, queue): @@ -224,7 +232,7 @@ class QueueProgressBarDelegate(QItemDelegate): def paint(self, painter, option, index): if not index.isValid(): return - if index.column() == 4: + if index.column() == 5: item = index.internalPointer() w = self.queue.getWaitingProgress(item) wait = None diff --git a/pyLoadGui.py b/pyLoadGui.py index d968528c7..dd83cbdcd 100755 --- a/pyLoadGui.py +++ b/pyLoadGui.py @@ -168,6 +168,7 @@ class main(QObject): self.connect(self.mainWindow, SIGNAL("reloadAccounts"), self.slotReloadAccounts) self.connect(self.mainWindow, SIGNAL("quit"), self.quit) + self.connect(self.mainWindow.mactions["exit"], SIGNAL("triggered()"), self.quit) self.connect(self.mainWindow.captchaDock, SIGNAL("done"), self.slotCaptchaDone) def slotShowConnector(self): @@ -554,7 +555,7 @@ class main(QObject): """ if self.checkClipboard: text = self.clipboard.text() - pattern = re.compile(r"(http|https)://[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?/.*)?") + pattern = re.compile(r"(http|https|ftp)://[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?/.*)?") matches = pattern.finditer(text) for match in matches: self.slotAddLinks([str(match.group(0))]) @@ -659,14 +660,14 @@ class TrayIcon(QSystemTrayIcon): self.contextMenu.addAction(self.exitAction) self.setContextMenu(self.contextMenu) - self.connect(self, SIGNAL("activated(QSystemTrayIcon::ActivationReason)"), self.doubleClicked) + self.connect(self, SIGNAL("activated(QSystemTrayIcon::ActivationReason)"), self.clicked) def mainWindowHidden(self): self.showAction.setChecked(False) - def doubleClicked(self, reason): + def clicked(self, reason): if self.showAction.isEnabled(): - if reason == QSystemTrayIcon.DoubleClick: + if reason == QSystemTrayIcon.Trigger: self.showAction.toggle() class Notification(QObject): |