diff --git a/weboob/applications/qcookboob/main_window.py b/weboob/applications/qcookboob/main_window.py
index d2bb00df..baa9c263 100644
--- a/weboob/applications/qcookboob/main_window.py
+++ b/weboob/applications/qcookboob/main_window.py
@@ -34,13 +34,14 @@ from .recipe import Recipe
class MainWindow(QtMainWindow):
- def __init__(self, config, weboob, parent=None):
+ def __init__(self, config, weboob, app, parent=None):
QtMainWindow.__init__(self, parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.config = config
self.weboob = weboob
+ self.app = app
self.minis = []
self.current_info_widget = None
@@ -57,6 +58,9 @@ class MainWindow(QtMainWindow):
self.connect(self.ui.searchEdit, SIGNAL("returnPressed()"), self.search)
self.connect(self.ui.idEdit, SIGNAL("returnPressed()"), self.searchId)
+ count = self.config.get('settings', 'maxresultsnumber')
+ self.ui.countSpin.setValue(int(count))
+
self.connect(self.ui.actionBackends, SIGNAL("triggered()"), self.backendsConfig)
self.connect(self.ui.actionQuit, SIGNAL("triggered()"), self.close)
@@ -111,6 +115,13 @@ class MainWindow(QtMainWindow):
qc.setCaseSensitivity(Qt.CaseInsensitive)
self.ui.searchEdit.setCompleter(qc)
+ def getCount(self):
+ num = self.ui.countSpin.value()
+ if num == 0:
+ return None
+ else:
+ return num
+
def doAction(self, description, fun, args):
''' Call fun with args as arguments
and save it in the action history
@@ -168,7 +179,7 @@ class MainWindow(QtMainWindow):
backend_name = str(self.ui.backendEdit.itemData(self.ui.backendEdit.currentIndex()).toString())
self.process = QtDo(self.weboob, self.addRecipe)
- self.process.do('iter_recipes', pattern, backends=backend_name, caps=ICapRecipe)
+ self.process.do(self.app._do_complete, self.getCount(), ('title'), 'iter_recipes', pattern, backends=backend_name, caps=ICapRecipe)
def addRecipe(self, backend, recipe):
if not backend:
@@ -210,6 +221,7 @@ class MainWindow(QtMainWindow):
self.config.set('settings', 'backend', str(self.ui.backendEdit.itemData(
self.ui.backendEdit.currentIndex()).toString()))
self.saveSearchHistory()
+ self.config.set('settings', 'maxresultsnumber', self.ui.countSpin.value())
self.config.save()
ev.accept()
diff --git a/weboob/applications/qcookboob/qcookboob.py b/weboob/applications/qcookboob/qcookboob.py
index 5cab168f..c8179e60 100644
--- a/weboob/applications/qcookboob/qcookboob.py
+++ b/weboob/applications/qcookboob/qcookboob.py
@@ -32,6 +32,7 @@ class QCookboob(QtApplication):
SHORT_DESCRIPTION = "search recipes"
CAPS = ICapRecipe
CONFIG = {'settings': {'backend': '',
+ 'maxresultsnumber': '10'
}
}
@@ -39,6 +40,6 @@ class QCookboob(QtApplication):
self.load_backends([ICapRecipe])
self.load_config()
- self.main_window = MainWindow(self.config, self.weboob)
+ self.main_window = MainWindow(self.config, self.weboob, self)
self.main_window.show()
return self.weboob.loop()
diff --git a/weboob/applications/qcookboob/ui/main_window.ui b/weboob/applications/qcookboob/ui/main_window.ui
index 7c3a69da..48287b26 100644
--- a/weboob/applications/qcookboob/ui/main_window.ui
+++ b/weboob/applications/qcookboob/ui/main_window.ui
@@ -46,6 +46,23 @@
-
+ -
+
+
+ <html><head/><body><p>Maximum results by backend</p><p>0 = no limit</p></body></html>
+
+
+ max results
+
+
+
+ -
+
+
+ <html><head/><body><p>Maximum results by backend</p><p>0 = no limit</p></body></html>
+
+
+
@@ -161,8 +178,8 @@
0
0
- 63
- 18
+ 96
+ 26