From b99576e9ddb40926bb58b235b3284160202658fc Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Sun, 23 Nov 2014 18:42:19 +0100 Subject: [PATCH] [qcineoob] add 'view' and 'view in new tab' buttons for all search results --- weboob/applications/qcineoob/minimovie.py | 17 +++++++++++- weboob/applications/qcineoob/miniperson.py | 17 +++++++++++- weboob/applications/qcineoob/minisubtitle.py | 15 +++++++++++ weboob/applications/qcineoob/minitorrent.py | 15 +++++++++++ weboob/applications/qcineoob/ui/minimovie.ui | 26 +++++++++++++++++++ weboob/applications/qcineoob/ui/miniperson.ui | 26 +++++++++++++++++++ .../applications/qcineoob/ui/minisubtitle.ui | 26 +++++++++++++++++++ .../applications/qcineoob/ui/minitorrent.ui | 26 +++++++++++++++++++ 8 files changed, 166 insertions(+), 2 deletions(-) diff --git a/weboob/applications/qcineoob/minimovie.py b/weboob/applications/qcineoob/minimovie.py index cef3897b..d2c70ad0 100644 --- a/weboob/applications/qcineoob/minimovie.py +++ b/weboob/applications/qcineoob/minimovie.py @@ -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.minimovie_ui import Ui_MiniMovie from weboob.capabilities.base import empty, NotAvailable @@ -40,6 +40,9 @@ class MiniMovie(QFrame): self.ui.shortDescLabel.setText(movie.short_description) 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() @@ -51,6 +54,18 @@ class MiniMovie(QFrame): img = QImage.fromData(data) self.ui.imageLabel.setPixmap(QPixmap.fromImage(img).scaledToHeight(100,Qt.SmoothTransformation)) + def viewPressed(self): + QApplication.setOverrideCursor(Qt.WaitCursor) + movie = self.backend.get_movie(self.movie.id) + if movie: + self.parent.doAction('Details of movie "%s"' % + movie.original_title, self.parent.displayMovie, [movie, self.backend]) + + def newTabPressed(self): + movie = self.backend.get_movie(self.movie.id) + self.parent.parent.newTab(u'Details of movie "%s"' % + movie.original_title, self.backend, movie=movie) + def enterEvent(self, event): self.setFrameShadow(self.Sunken) QFrame.enterEvent(self, event) diff --git a/weboob/applications/qcineoob/miniperson.py b/weboob/applications/qcineoob/miniperson.py index 298e3ab2..c3a6dbf5 100644 --- a/weboob/applications/qcineoob/miniperson.py +++ b/weboob/applications/qcineoob/miniperson.py @@ -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) diff --git a/weboob/applications/qcineoob/minisubtitle.py b/weboob/applications/qcineoob/minisubtitle.py index 4c93bbec..d3e3a023 100644 --- a/weboob/applications/qcineoob/minisubtitle.py +++ b/weboob/applications/qcineoob/minisubtitle.py @@ -18,6 +18,7 @@ # along with weboob. If not, see . from PyQt4.QtGui import QFrame +from PyQt4.QtCore import Qt, SIGNAL from weboob.applications.qcineoob.ui.minisubtitle_ui import Ui_MiniSubtitle from weboob.capabilities.base import empty @@ -38,6 +39,20 @@ class MiniSubtitle(QFrame): self.ui.nbcdLabel.setText(u'%s' % subtitle.nb_cd) self.ui.backendLabel.setText(backend.name) + self.connect(self.ui.newTabButton, SIGNAL("clicked()"), self.newTabPressed) + self.connect(self.ui.viewButton, SIGNAL("clicked()"), self.viewPressed) + + def viewPressed(self): + subtitle = self.backend.get_subtitle(self.subtitle.id) + if subtitle: + self.parent.doAction('Details of subtitle "%s"' % + subtitle.name, self.parent.displaySubtitle, [subtitle, self.backend]) + + def newTabPressed(self): + subtitle = self.backend.get_subtitle(self.subtitle.id) + self.parent.parent.newTab(u'Details of subtitle "%s"' % + subtitle.name, self.backend, subtitle=subtitle) + def enterEvent(self, event): self.setFrameShadow(self.Sunken) QFrame.enterEvent(self, event) diff --git a/weboob/applications/qcineoob/minitorrent.py b/weboob/applications/qcineoob/minitorrent.py index 10d1c548..5bd11317 100644 --- a/weboob/applications/qcineoob/minitorrent.py +++ b/weboob/applications/qcineoob/minitorrent.py @@ -18,6 +18,7 @@ # along with weboob. If not, see . from PyQt4.QtGui import QFrame +from PyQt4.QtCore import Qt, SIGNAL from weboob.applications.qcineoob.ui.minitorrent_ui import Ui_MiniTorrent from weboob.applications.weboorrents.weboorrents import sizeof_fmt @@ -41,6 +42,20 @@ class MiniTorrent(QFrame): self.ui.sizeLabel.setText(u'%s' % sizeof_fmt(torrent.size)) self.ui.backendLabel.setText(backend.name) + self.connect(self.ui.newTabButton, SIGNAL("clicked()"), self.newTabPressed) + self.connect(self.ui.viewButton, SIGNAL("clicked()"), self.viewPressed) + + def viewPressed(self): + torrent = self.backend.get_torrent(self.torrent.id) + if torrent: + self.parent.doAction('Details of torrent "%s"' % + torrent.name, self.parent.displayTorrent, [torrent, self.backend]) + + def newTabPressed(self): + torrent = self.backend.get_torrent(self.torrent.id) + self.parent.parent.newTab(u'Details of torrent "%s"' % + torrent.name, self.backend, torrent=torrent) + def enterEvent(self, event): self.setFrameShadow(self.Sunken) QFrame.enterEvent(self, event) diff --git a/weboob/applications/qcineoob/ui/minimovie.ui b/weboob/applications/qcineoob/ui/minimovie.ui index 1da01c50..c8e969fb 100644 --- a/weboob/applications/qcineoob/ui/minimovie.ui +++ b/weboob/applications/qcineoob/ui/minimovie.ui @@ -126,6 +126,32 @@ + + + + + 16777215 + 20 + + + + View in new tab + + + + + + + + 16777215 + 20 + + + + View + + + diff --git a/weboob/applications/qcineoob/ui/miniperson.ui b/weboob/applications/qcineoob/ui/miniperson.ui index e9e1aa51..7a5dd462 100644 --- a/weboob/applications/qcineoob/ui/miniperson.ui +++ b/weboob/applications/qcineoob/ui/miniperson.ui @@ -126,6 +126,32 @@ + + + + + 16777215 + 20 + + + + View in new tab + + + + + + + + 16777215 + 20 + + + + View + + + diff --git a/weboob/applications/qcineoob/ui/minisubtitle.ui b/weboob/applications/qcineoob/ui/minisubtitle.ui index 52e77ec2..f23c45d7 100644 --- a/weboob/applications/qcineoob/ui/minisubtitle.ui +++ b/weboob/applications/qcineoob/ui/minisubtitle.ui @@ -123,6 +123,32 @@ + + + + + 16777215 + 20 + + + + View in new tab + + + + + + + + 16777215 + 20 + + + + View + + + diff --git a/weboob/applications/qcineoob/ui/minitorrent.ui b/weboob/applications/qcineoob/ui/minitorrent.ui index 90de8821..b0bc67b9 100644 --- a/weboob/applications/qcineoob/ui/minitorrent.ui +++ b/weboob/applications/qcineoob/ui/minitorrent.ui @@ -140,6 +140,32 @@ + + + + + 16777215 + 20 + + + + View in new tab + + + + + + + + 16777215 + 20 + + + + View + + +