From afd866456a91c91449ea62d39bc3341b63685f35 Mon Sep 17 00:00:00 2001 From: calvin Date: Wed, 18 Feb 2009 23:17:57 +0000 Subject: [PATCH] Activate cancel button in progress dialog git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3969 e7d03fd6-7b0d-0410-9947-9c21f3af8025 --- TODO.txt | 2 ++ linkcheck/gui/__init__.py | 38 ++++++++++++++++---------------------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/TODO.txt b/TODO.txt index e2a060bf..79b1c65b 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,2 +1,4 @@ - [GUI] Store checked links in urldata list; display in a QTreeWidget; columns result (as icon), URL, name; doubleclick opens property popup + signal "foo(PyQt_PyObject)" +- [GUI] Progressbar cancel button diff --git a/linkcheck/gui/__init__.py b/linkcheck/gui/__init__.py index 94b22363..ed20092f 100644 --- a/linkcheck/gui/__init__.py +++ b/linkcheck/gui/__init__.py @@ -61,12 +61,17 @@ class LinkCheckerMain (QtGui.QMainWindow, Ui_MainWindow): self.connect(self.checker, QtCore.SIGNAL("terminated()"), self.set_status_idle) self.connect(self.checker, QtCore.SIGNAL("add_message(QString)"), self.add_message) self.connect(self.checker, QtCore.SIGNAL("status(QString)"), self.progress.status) - self.connect(self.controlButton, QtCore.SIGNAL("clicked()"), self.start_stop) + self.connect(self.controlButton, QtCore.SIGNAL("clicked()"), self.start) self.connect(self.optionsButton, QtCore.SIGNAL("clicked()"), self.options.exec_) + self.connect(self.progress.cancelButton, QtCore.SIGNAL("clicked()"), self.stop) self.connect(self.actionQuit, QtCore.SIGNAL("triggered()"), self.close) self.connect(self.actionAbout, QtCore.SIGNAL("triggered()"), self.about) self.connect(self.actionHelp, QtCore.SIGNAL("triggered()"), self.showDocumentation) self.status = Status.idle + #self.controlButton.setText(_("Start")) + #icon = QtGui.QIcon() + #icon.addPixmap(QtGui.QPixmap(":/icons/start.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + #self.controlButton.setIcon(icon) def get_status (self): return self._status @@ -76,27 +81,16 @@ class LinkCheckerMain (QtGui.QMainWindow, Ui_MainWindow): if status == Status.idle: self.progress.reset() self.progress.hide() - self.controlButton.setText(_("Start")) - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(":/icons/start.png"),QtGui.QIcon.Normal,QtGui.QIcon.Off) - self.controlButton.setIcon(icon) self.aggregate = None self.controlButton.setEnabled(True) self.optionsButton.setEnabled(True) self.set_statusbar(_("Ready.")) elif status == Status.checking: - self.controlButton.setText(_("Stop")) - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(":/icons/stop.png"),QtGui.QIcon.Normal,QtGui.QIcon.Off) - self.controlButton.setIcon(icon) - self.controlButton.setEnabled(True) + self.controlButton.setEnabled(False) self.optionsButton.setEnabled(False) elif status == Status.stopping: - self.controlButton.setText(_("Start")) - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(":/icons/start.png"),QtGui.QIcon.Normal,QtGui.QIcon.Off) - self.controlButton.setIcon(icon) self.controlButton.setEnabled(False) + self.optionsButton.setEnabled(False) self.set_statusbar(_("Stopping.")) status = property(get_status, set_status) @@ -137,12 +131,16 @@ for broken links.

Version 2 or later.

""") % d) - def start_stop (self): - """Start a new check or stop an active check.""" + def start (self): + """Start a new check.""" if self.status == Status.idle: self.check() - elif self.status == Status.checking: - self.stop() + + def stop (self): + """Stop an active check.""" + if self.status == Status.checking: + director.abort(self.aggregate) + self.status = Status.stopping def check (self): """Check given URL.""" @@ -176,10 +174,6 @@ Version 2 or later.

self.checker.check(self.aggregate) self.status = Status.checking - def stop (self): - director.abort(self.aggregate) - self.status = Status.stopping - def get_config (self): """Return check configuration.""" config = configuration.Configuration()