[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.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)

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)

View file

@ -18,6 +18,7 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
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)

View file

@ -18,6 +18,7 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
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)

View file

@ -126,6 +126,32 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="newTabButton">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>View in new tab</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="viewButton">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>View</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>

View file

@ -126,6 +126,32 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="newTabButton">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>View in new tab</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="viewButton">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>View</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>

View file

@ -123,6 +123,32 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="newTabButton">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>View in new tab</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="viewButton">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>View</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>

View file

@ -140,6 +140,32 @@
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="newTabButton">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>View in new tab</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="viewButton">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>View</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>