[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

@ -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)