From 66141a5c93988908fa17e6ab5a9126177c52b8e8 Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Sat, 16 Mar 2013 12:31:21 +0100 Subject: [PATCH] [qcookboob] operationnal --- weboob/applications/qcookboob/minirecipe.py | 2 +- weboob/applications/qcookboob/recipe.py | 56 +-- .../applications/qcookboob/ui/main_window.ui | 43 +- weboob/applications/qcookboob/ui/recipe.ui | 383 ++++++------------ 4 files changed, 163 insertions(+), 321 deletions(-) diff --git a/weboob/applications/qcookboob/minirecipe.py b/weboob/applications/qcookboob/minirecipe.py index e53ed3c9..ba93bfcd 100644 --- a/weboob/applications/qcookboob/minirecipe.py +++ b/weboob/applications/qcookboob/minirecipe.py @@ -63,4 +63,4 @@ class MiniRecipe(QFrame): recipe = self.backend.get_recipe(self.recipe.id) if recipe: self.parent.doAction('Details of recipe "%s"' % - recipe.title, self.parent.displayMovie, [recipe, self.backend]) + recipe.title, self.parent.displayRecipe, [recipe, self.backend]) diff --git a/weboob/applications/qcookboob/recipe.py b/weboob/applications/qcookboob/recipe.py index 4254e061..809cacf9 100644 --- a/weboob/applications/qcookboob/recipe.py +++ b/weboob/applications/qcookboob/recipe.py @@ -32,50 +32,50 @@ class Recipe(QFrame): self.parent = parent self.ui = Ui_Recipe() self.ui.setupUi(self) - langs = LANGUAGE_CONV.keys() - langs.sort() - for lang in langs: - self.ui.langCombo.addItem(lang) self.recipe = recipe self.backend = backend - self.ui.titleLabel.setText(recipe.original_title) - self.ui.durationLabel.setText(unicode(recipe.duration)) self.gotThumbnail() self.ui.idEdit.setText(u'%s@%s' % (recipe.id, backend.name)) - if not empty(recipe.other_titles): - self.ui.otherTitlesPlain.setPlainText('\n'.join(recipe.other_titles)) + if not empty(recipe.title): + self.ui.titleLabel.setText(recipe.title) + if not empty(recipe.nb_person): + self.ui.nbPersonLabel.setText('%s'%recipe.nb_person) else: - self.ui.otherTitlesPlain.parent().hide() - if not empty(recipe.release_date): - self.ui.releaseDateLabel.setText(recipe.release_date.strftime('%Y-%m-%d')) + self.ui.nbPersonLabel.parent().hide() + if not empty(recipe.preparation_time): + self.ui.prepTimeLabel.setText('%s min' % recipe.preparation_time) else: - self.ui.releaseDateLabel.parent().hide() - if not empty(recipe.duration): - self.ui.durationLabel.setText('%s min' % recipe.duration) + self.ui.prepTimeLabel.parent().hide() + if not empty(recipe.cooking_time): + self.ui.cookingTimeLabel.setText('%s min' % recipe.cooking_time) else: - self.ui.durationLabel.parent().hide() - if not empty(recipe.pitch): - self.ui.pitchPlain.setPlainText('%s' % recipe.pitch) + self.ui.cookingTimeLabel.parent().hide() + if not empty(recipe.ingredients): + txt = u'' + for ing in recipe.ingredients: + txt += '* %s\n' % ing + self.ui.ingredientsPlain.setPlainText('%s' % txt) else: - self.ui.pitchPlain.parent().hide() - if not empty(recipe.country): - self.ui.countryLabel.setText('%s' % recipe.country) + self.ui.ingredientsPlain.parent().hide() + if not empty(recipe.instructions): + self.ui.instructionsPlain.setPlainText('%s' % recipe.instructions) else: - self.ui.countryLabel.parent().hide() - if not empty(recipe.note): - self.ui.noteLabel.setText('%s' % recipe.note) + self.ui.instructionsPlain.parent().hide() + if not empty(recipe.comments): + txt = u'' + for com in recipe.comments: + txt += '* %s\n' % com + self.ui.commentsPlain.setPlainText('%s' % txt) else: - self.ui.noteLabel.parent().hide() - for role in ROLE_LIST: - self.ui.castingCombo.addItem('%ss' % role) + self.ui.commentsPlain.parent().hide() self.ui.verticalLayout.setAlignment(Qt.AlignTop) self.ui.verticalLayout_2.setAlignment(Qt.AlignTop) def gotThumbnail(self): - if not empty(self.recipe.thumbnail_url): - data = urllib.urlopen(self.recipe.thumbnail_url).read() + if not empty(self.recipe.picture_url): + data = urllib.urlopen(self.recipe.picture_url).read() img = QImage.fromData(data) self.ui.imageLabel.setPixmap(QPixmap.fromImage(img)) diff --git a/weboob/applications/qcookboob/ui/main_window.ui b/weboob/applications/qcookboob/ui/main_window.ui index dcf213df..05f3f013 100644 --- a/weboob/applications/qcookboob/ui/main_window.ui +++ b/weboob/applications/qcookboob/ui/main_window.ui @@ -43,45 +43,6 @@ - - - - - movie - - - - - person - - - - - torrent - - - - - subtitle - - - - - - - - - 8 - - - - language - - - - - - @@ -200,8 +161,8 @@ 0 0 - 63 - 18 + 96 + 26 diff --git a/weboob/applications/qcookboob/ui/recipe.ui b/weboob/applications/qcookboob/ui/recipe.ui index 2891fd96..44fb14c1 100644 --- a/weboob/applications/qcookboob/ui/recipe.ui +++ b/weboob/applications/qcookboob/ui/recipe.ui @@ -54,93 +54,6 @@ - - - - QFrame::NoFrame - - - QFrame::Raised - - - - 0 - - - 0 - - - - - view casting - - - - - - - - all - - - - - - - - - - - QFrame::NoFrame - - - QFrame::Raised - - - - 0 - - - 0 - - - - - search torrents - - - - - - - - - - QFrame::NoFrame - - - QFrame::Raised - - - - 0 - - - 0 - - - - - search subtitles - - - - - - - - - @@ -232,6 +145,134 @@ + + + + + 16777215 + 35 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Number of people: + + + + + + + + + + + + + + + + + + 16777215 + 35 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Preparation time: + + + + + + + + + + + + + + + + + + 16777215 + 35 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Cook time: + + + + + + + + + + + + + + + + + + 16777215 + 200 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Ingredients: + + + + + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + @@ -262,12 +303,12 @@ - Other titles: + Instructions: - + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse @@ -276,166 +317,6 @@ - - - - - 16777215 - 35 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - Duration: - - - - - - - - - - - - - - - - - - 16777215 - 35 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - Release date: - - - - - - - - - - - - - - - - - - 16777215 - 200 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - Pitch: - - - - - - - Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - - - 16777215 - 35 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - Country: - - - - - - - - - - - - - - - - - - 16777215 - 35 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - Note: - - - - - - - - - - - - - @@ -454,12 +335,12 @@ - All release dates: + Comments: - + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse