[qcookboob] integration of stop feature

This commit is contained in:
Julien Veyssier 2013-03-18 16:01:12 +01:00 committed by Florent
commit c04ca3f3b3
2 changed files with 23 additions and 0 deletions

View file

@ -54,6 +54,8 @@ class MainWindow(QtMainWindow):
self.action_history = {'last_action': None, 'action_list': []}
self.connect(self.ui.backButton, SIGNAL("clicked()"), self.doBack)
self.ui.backButton.hide()
self.connect(self.ui.stopButton, SIGNAL("clicked()"), self.stopProcess)
self.ui.stopButton.hide()
self.connect(self.ui.searchEdit, SIGNAL("returnPressed()"), self.search)
self.connect(self.ui.idEdit, SIGNAL("returnPressed()"), self.searchId)
@ -122,6 +124,9 @@ class MainWindow(QtMainWindow):
else:
return num
def stopProcess(self):
self.process.process.finish_event.set()
def doAction(self, description, fun, args):
''' Call fun with args as arguments
and save it in the action history
@ -180,12 +185,14 @@ class MainWindow(QtMainWindow):
self.process = QtDo(self.weboob, self.addRecipe)
self.process.do(self.app._do_complete, self.getCount(), ('title'), 'iter_recipes', pattern, backends=backend_name, caps=ICapRecipe)
self.ui.stopButton.show()
def addRecipe(self, backend, recipe):
if not backend:
self.ui.searchEdit.setEnabled(True)
QApplication.restoreOverrideCursor()
self.process = None
self.ui.stopButton.hide()
return
minirecipe = MiniRecipe(self.weboob, backend, recipe, self)
self.ui.list_content.layout().addWidget(minirecipe)

View file

@ -43,6 +43,22 @@
<item>
<widget class="QLineEdit" name="searchEdit"/>
</item>
<item>
<widget class="QPushButton" name="stopButton">
<property name="maximumSize">
<size>
<width>35</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:pad, x1:1, y1:1, x2:1, y2:1, stop:0 rgba(255, 0, 0, 255), stop:0.479904 rgba(255, 0, 0, 255), stop:0.522685 rgba(255, 255, 255, 255), stop:1 rgba(255, 255, 255, 255));</string>
</property>
<property name="text">
<string>stop</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="backendEdit"/>
</item>