[qcookboob] search by id
This commit is contained in:
parent
763164d880
commit
303172a816
2 changed files with 36 additions and 3 deletions
|
|
@ -55,6 +55,7 @@ class MainWindow(QtMainWindow):
|
|||
self.ui.backButton.hide()
|
||||
|
||||
self.connect(self.ui.searchEdit, SIGNAL("returnPressed()"), self.search)
|
||||
self.connect(self.ui.idEdit, SIGNAL("returnPressed()"), self.searchId)
|
||||
|
||||
self.connect(self.ui.actionBackends, SIGNAL("triggered()"), self.backendsConfig)
|
||||
self.connect(self.ui.actionQuit, SIGNAL("triggered()"), self.close)
|
||||
|
|
@ -190,6 +191,24 @@ class MainWindow(QtMainWindow):
|
|||
self.current_info_widget = wrecipe
|
||||
QApplication.restoreOverrideCursor()
|
||||
|
||||
def searchId(self):
|
||||
QApplication.setOverrideCursor(Qt.WaitCursor)
|
||||
id = unicode(self.ui.idEdit.text())
|
||||
if '@' in id:
|
||||
backend_name = id.split('@')[1]
|
||||
id = id.split('@')[0]
|
||||
else:
|
||||
backend_name = None
|
||||
fail = True
|
||||
for backend in self.weboob.iter_backends():
|
||||
if (backend_name != None and backend.name == backend_name) or backend_name == None:
|
||||
recipe = backend.get_recipe(id)
|
||||
if recipe:
|
||||
fail = False
|
||||
self.doAction('Details of recipe "%s"' %
|
||||
recipe.title, self.displayRecipe, [recipe, backend])
|
||||
QApplication.restoreOverrideCursor()
|
||||
|
||||
def closeEvent(self, ev):
|
||||
self.config.set('settings', 'backend', str(self.ui.backendEdit.itemData(
|
||||
self.ui.backendEdit.currentIndex()).toString()))
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>708</width>
|
||||
<height>292</height>
|
||||
<height>261</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2"/>
|
||||
|
|
@ -161,8 +161,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>96</width>
|
||||
<height>26</height>
|
||||
<width>63</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8"/>
|
||||
|
|
@ -173,6 +173,20 @@
|
|||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>search by ID:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="idEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue