Пример #1
0
    def __init__(self, weboob, backend, torrent, parent=None):
        super(MiniTorrent, self).__init__(parent)
        self.parent = parent
        self.ui = Ui_MiniTorrent()
        self.ui.setupUi(self)

        self.weboob = weboob
        self.backend = backend
        self.torrent = torrent
        self.ui.nameLabel.setText(torrent.name)
        if not empty(torrent.seeders) and not empty(torrent.leechers):
            self.ui.seedLeechLabel.setText('%s/%s' %
                                           (torrent.seeders, torrent.leechers))
        if not empty(torrent.size):
            self.ui.sizeLabel.setText(u'%s' % sizeof_fmt(torrent.size))
        self.ui.backendButton.setText(backend.name)
        minfo = self.weboob.repositories.get_module_info(backend.NAME)
        icon_path = self.weboob.repositories.get_module_icon_path(minfo)
        if icon_path:
            pixmap = QPixmapCache.find(icon_path)
            if not pixmap:
                pixmap = QPixmap(QImage(icon_path))
            self.ui.backendButton.setIcon(QIcon(pixmap))

        self.ui.newTabButton.clicked.connect(self.newTabPressed)
        self.ui.viewButton.clicked.connect(self.viewPressed)
Пример #2
0
    def __init__(self, weboob, backend, torrent, parent=None):
        super(MiniTorrent, self).__init__(parent)
        self.parent = parent
        self.ui = Ui_MiniTorrent()
        self.ui.setupUi(self)

        self.weboob = weboob
        self.backend = backend
        self.torrent = torrent
        self.ui.nameLabel.setText(torrent.name)
        if not empty(torrent.seeders) and not empty(torrent.leechers):
            self.ui.seedLeechLabel.setText('%s/%s' % (torrent.seeders, torrent.leechers))
        if not empty(torrent.size):
            self.ui.sizeLabel.setText(u'%s' % sizeof_fmt(torrent.size))
        self.ui.backendButton.setText(backend.name)
        minfo = self.weboob.repositories.get_module_info(backend.NAME)
        icon_path = self.weboob.repositories.get_module_icon_path(minfo)
        if icon_path:
            pixmap = QPixmapCache.find(icon_path)
            if not pixmap:
                pixmap = QPixmap(QImage(icon_path))
            self.ui.backendButton.setIcon(QIcon(pixmap))

        self.ui.newTabButton.clicked.connect(self.newTabPressed)
        self.ui.viewButton.clicked.connect(self.viewPressed)
Пример #3
0
    def __init__(self, weboob, backend, torrent, parent=None):
        QFrame.__init__(self, parent)
        self.parent = parent
        self.ui = Ui_MiniTorrent()
        self.ui.setupUi(self)

        self.weboob = weboob
        self.backend = backend
        self.torrent = torrent
        self.ui.nameLabel.setText(torrent.name)
        if not empty(torrent.seeders) and not empty(torrent.leechers):
            self.ui.seedLeechLabel.setText('%s/%s' % (torrent.seeders, torrent.leechers))
        if not empty(torrent.size):
            self.ui.sizeLabel.setText(u'%s' % sizeof_fmt(torrent.size))
        self.ui.backendLabel.setText(backend.name)
Пример #4
0
    def __init__(self, weboob, backend, torrent, parent=None):
        QFrame.__init__(self, parent)
        self.parent = parent
        self.ui = Ui_MiniTorrent()
        self.ui.setupUi(self)

        self.weboob = weboob
        self.backend = backend
        self.torrent = torrent
        self.ui.nameLabel.setText(torrent.name)
        if not empty(torrent.seeders) and not empty(torrent.leechers):
            self.ui.seedLeechLabel.setText('%s/%s' % (torrent.seeders, torrent.leechers))
        if not empty(torrent.size):
            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)
Пример #5
0
    def __init__(self, torrent, backend, parent=None):
        QFrame.__init__(self, parent)
        self.parent = parent
        self.backend = backend
        self.ui = Ui_Torrent()
        self.ui.setupUi(self)

        self.connect(self.ui.downloadButton, SIGNAL("clicked()"),
                     self.download)

        self.torrent = torrent
        self.ui.idEdit.setText(u'%s@%s' % (torrent.id, backend.name))
        self.ui.nameLabel.setText(u'%s' % torrent.name)
        if not empty(torrent.url):
            self.ui.urlEdit.setText(u'%s' % torrent.url)
        else:
            self.ui.urlFrame.hide()
            self.ui.downloadButton.setDisabled(True)
            if not empty(torrent.magnet):
                self.ui.downloadButton.setText(
                    u'Download not available\nbut magnet link provided')
                self.ui.downloadButton.setToolTip(u'Use the magnet link')
        if not empty(torrent.description):
            self.ui.descriptionPlain.setText(u'%s' % torrent.description)
        else:
            self.ui.descriptionPlain.parent().hide()
        if not empty(torrent.files):
            files = u''
            for f in torrent.files:
                files += '%s\n' % f
            self.ui.filesPlain.setText(u'%s' % files)
        else:
            self.ui.filesPlain.parent().hide()
        if not empty(torrent.magnet):
            self.ui.magnetEdit.setText(u'%s' % torrent.magnet)
        else:
            self.ui.magnetFrame.hide()
        if not empty(torrent.seeders) and not empty(torrent.leechers):
            self.ui.seedLeechLabel.setText(u'%s/%s' %
                                           (torrent.seeders, torrent.leechers))
        if not empty(torrent.size):
            self.ui.sizeLabel.setText(u'%s' % sizeof_fmt(torrent.size))

        self.ui.verticalLayout.setAlignment(Qt.AlignTop)
Пример #6
0
    def __init__(self, weboob, backend, torrent, parent=None):
        super(MiniTorrent, self).__init__(parent)
        self.parent = parent
        self.ui = Ui_MiniTorrent()
        self.ui.setupUi(self)

        self.weboob = weboob
        self.backend = backend
        self.torrent = torrent
        self.ui.nameLabel.setText(torrent.name)
        if not empty(torrent.seeders) and not empty(torrent.leechers):
            self.ui.seedLeechLabel.setText('%s/%s' %
                                           (torrent.seeders, torrent.leechers))
        if not empty(torrent.size):
            self.ui.sizeLabel.setText(u'%s' % sizeof_fmt(torrent.size))
        self.ui.backendLabel.setText(backend.name)

        self.ui.newTabButton.clicked.connect(self.newTabPressed)
        self.ui.viewButton.clicked.connect(self.viewPressed)
Пример #7
0
    def __init__(self, torrent, backend, parent=None):
        super(Torrent, self).__init__(parent)
        self.parent = parent
        self.backend = backend
        self.ui = Ui_Torrent()
        self.ui.setupUi(self)

        self.ui.downloadButton.clicked.connect(self.download)

        self.torrent = torrent
        self.ui.idEdit.setText(u'%s@%s' % (torrent.id, backend.name))
        self.ui.nameLabel.setText(u'%s' % torrent.name)
        if not empty(torrent.url):
            self.ui.urlEdit.setText(u'%s' % torrent.url)
        else:
            self.ui.urlFrame.hide()
            self.ui.downloadButton.setDisabled(True)
            if not empty(torrent.magnet):
                self.ui.downloadButton.setText(u'Download not available\nbut magnet link provided')
                self.ui.downloadButton.setToolTip(u'Use the magnet link')
        if not empty(torrent.description):
            self.ui.descriptionPlain.setText(u'%s' % torrent.description)
        else:
            self.ui.descriptionPlain.parent().hide()
        if not empty(torrent.files):
            files = u''
            for f in torrent.files:
                files += '%s\n' % f
            self.ui.filesPlain.setText(u'%s' % files)
        else:
            self.ui.filesPlain.parent().hide()
        if not empty(torrent.magnet):
            self.ui.magnetEdit.setText(u'%s' % torrent.magnet)
        else:
            self.ui.magnetFrame.hide()
        if not empty(torrent.seeders) and not empty(torrent.leechers):
            self.ui.seedLeechLabel.setText(u'%s/%s' % (torrent.seeders, torrent.leechers))
        if not empty(torrent.size):
            self.ui.sizeLabel.setText(u'%s' % sizeof_fmt(torrent.size))

        self.ui.verticalLayout.setAlignment(Qt.AlignTop)