[qcineoob] add 'view' and 'view in new tab' buttons for all search results

This commit is contained in:
Julien Veyssier 2014-11-23 18:42:19 +01:00 committed by Romain Bignon
commit b99576e9dd
8 changed files with 166 additions and 2 deletions

View file

@ -20,7 +20,7 @@
import urllib
from PyQt4.QtGui import QFrame, QImage, QPixmap, QApplication
from PyQt4.QtCore import Qt
from PyQt4.QtCore import Qt, SIGNAL
from weboob.applications.qcineoob.ui.miniperson_ui import Ui_MiniPerson
from weboob.capabilities.base import empty, NotAvailable
@ -46,6 +46,9 @@ class MiniPerson(QFrame):
self.ui.shortDescLabel.hide()
self.ui.backendLabel.setText(backend.name)
self.connect(self.ui.newTabButton, SIGNAL("clicked()"), self.newTabPressed)
self.connect(self.ui.viewButton, SIGNAL("clicked()"), self.viewPressed)
if self.parent.parent.ui.showTCheck.isChecked():
self.gotThumbnail()
@ -57,6 +60,18 @@ class MiniPerson(QFrame):
img = QImage.fromData(data)
self.ui.imageLabel.setPixmap(QPixmap.fromImage(img).scaledToHeight(100,Qt.SmoothTransformation))
def viewPressed(self):
QApplication.setOverrideCursor(Qt.WaitCursor)
person = self.backend.get_person(self.person.id)
if person:
self.parent.doAction(u'Details of person "%s"' %
person.name, self.parent.displayPerson, [person, self.backend])
def newTabPressed(self):
person = self.backend.get_person(self.person.id)
self.parent.parent.newTab(u'Details of person "%s"' %
person.name, self.backend, person=person)
def enterEvent(self, event):
self.setFrameShadow(self.Sunken)
QFrame.enterEvent(self, event)