[qcineoob] add current action description info

This commit is contained in:
Julien Veyssier 2013-03-12 16:35:16 +01:00
commit 33981a8fdb
5 changed files with 29 additions and 14 deletions

View file

@ -76,16 +76,18 @@ class MainWindow(QtMainWindow):
else:
self.ui.searchEdit.setEnabled(True)
def doAction(self, fun, args):
def doAction(self, description, fun, args):
self.ui.currentActionLabel.setText(description)
if self.history['last_action'] != None:
self.history['action_list'].append(self.history['last_action'])
self.ui.backButton.setDisabled(False)
self.history['last_action'] = {'function':fun,'args':args}
self.history['last_action'] = {'function':fun,'args':args,'description':description}
return fun(*args)
def doBack(self):
if len(self.history['action_list']) > 0:
todo = self.history['action_list'].pop()
self.ui.currentActionLabel.setText(todo['description'])
self.history['last_action'] = todo
if len(self.history['action_list']) == 0:
self.ui.backButton.setDisabled(True)
@ -117,7 +119,7 @@ class MainWindow(QtMainWindow):
pattern = unicode(self.ui.searchEdit.text())
if not pattern:
return
self.doAction(self.searchMovieAction,[pattern])
self.doAction(u'Search movie results for "%s"'%pattern,self.searchMovieAction,[pattern])
def searchMovieAction(self,pattern):
self.ui.stackedWidget.setCurrentWidget(self.ui.movie_list_page)
@ -157,7 +159,7 @@ class MainWindow(QtMainWindow):
pattern = unicode(self.ui.searchEdit.text())
if not pattern:
return
self.doAction(self.searchPersonAction,[pattern])
self.doAction(u'Search person results for "%s"'%pattern,self.searchPersonAction,[pattern])
def searchPersonAction(self,pattern):
self.ui.stackedWidget.setCurrentWidget(self.ui.person_list_page)

View file

@ -61,4 +61,4 @@ class MiniMovie(QFrame):
movie = self.backend.get_movie(self.movie.id)
if movie:
self.parent.doAction(self.parent.displayMovie,[movie])
self.parent.doAction('Details of movie "%s"'%movie.original_title,self.parent.displayMovie,[movie])

View file

@ -61,4 +61,4 @@ class MiniPerson(QFrame):
person = self.backend.get_person(self.person.id)
if person:
self.parent.doAction(self.parent.displayPerson,[person])
self.parent.doAction(u'Details of person "%s"'%person.name,self.parent.displayPerson,[person])

View file

@ -59,7 +59,10 @@ class Movie(QFrame):
def casting(self):
role = None
tosearch = self.ui.castingCombo.currentText()
role_desc = ''
if tosearch != 'all':
role = tosearch[:-1]
self.parent.doAction(self.parent.castingAction,[self.movie.id,role])
role_desc = ' as %s'%role
self.parent.doAction('Casting%s of movie "%s"'%(role_desc,self.movie.original_title),
self.parent.castingAction,[self.movie.id,role])

View file

@ -73,6 +73,16 @@
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="currentActionLabel">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="stackedWidget">
<widget class="QWidget" name="movie_list_page">
@ -88,7 +98,7 @@
<x>0</x>
<y>0</y>
<width>660</width>
<height>313</height>
<height>292</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2"/>
@ -109,8 +119,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>63</width>
<height>18</height>
<width>96</width>
<height>26</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8"/>
@ -131,8 +141,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>63</width>
<height>18</height>
<width>96</width>
<height>26</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5"/>
@ -153,8 +163,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>63</width>
<height>18</height>
<width>96</width>
<height>26</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4"/>