many emptyfications

This commit is contained in:
Julien Veyssier 2013-03-15 12:43:51 +01:00
commit f6e2f0a657
13 changed files with 51 additions and 46 deletions

View file

@ -21,7 +21,7 @@ from PyQt4.QtGui import QFrame
from weboob.applications.qcineoob.ui.minitorrent_ui import Ui_MiniTorrent
from weboob.applications.weboorrents.weboorrents import sizeof_fmt
from weboob.capabilities.base import NotAvailable
from weboob.capabilities.base import empty
class MiniTorrent(QFrame):
def __init__(self, weboob, backend, torrent, parent=None):
@ -34,9 +34,9 @@ class MiniTorrent(QFrame):
self.backend = backend
self.torrent = torrent
self.ui.nameLabel.setText(torrent.name)
if torrent.seeders != NotAvailable and torrent.leechers != NotAvailable:
if not empty(torrent.seeders) and not empty(torrent.leechers):
self.ui.seedLeechLabel.setText('%s/%s'%(torrent.seeders,torrent.leechers))
if torrent.size != NotAvailable:
if not empty(torrent.size):
self.ui.sizeLabel.setText(u'%s'%sizeof_fmt(torrent.size))
self.ui.backendLabel.setText(backend.name)