Esempio n. 1
0
    def displayBudgetProjection(self):
        total_num_of_torrents = len(self.projection)
        if total_num_of_torrents == 0 or self.next_superBlock == 0:
            return

        # header
        ## blocks to next superBlock (== minutes)
        blocks_to_SB = self.next_superBlock - self.main_wnd.caller.rpcLastBlock

        self.ui.nextSuperBlock_label.setText("<b>%s</b>" % str(self.next_superBlock))
        timeToNextSB = "<em style='color: blue'>%s</em>" % sec_to_time(60 * blocks_to_SB)
        self.ui.timeToNextSB_label.setText(timeToNextSB)
        total = self.projection[-1].get('Total_Allotted')
        total_label = "<em style='color: purple'>%s QMC</em>" % str(total)
        self.ui.allottedBudget_label.setText(total_label)
        self.ui.remainingBudget_label.setText("%s QMC" % str(round(43200.0 - total, 8)))
        self.ui.passingTorrents_label.setText("<b style='color: purple'>%s</b>" % str(len(self.projection)))

        def item(value):
            item = QTableWidgetItem(str(value))
            item.setTextAlignment(Qt.AlignCenter)
            return item

        self.ui.torrents_lst.setRowCount(total_num_of_torrents)
        for row, prop in enumerate(self.projection):
            self.ui.torrents_lst.setItem(row, 0, item(self.projection[row].get('Name')))
            self.ui.torrents_lst.setItem(row, 1, item(self.projection[row].get('Allotted')))
            self.ui.torrents_lst.setItem(row, 2, item(self.projection[row].get('Votes')))
            self.ui.torrents_lst.setItem(row, 3, item(self.projection[row].get('Total_Allotted')))
Esempio n. 2
0
 def setupUi(self, MnStatusDlg):
     MnStatusDlg.setModal(True)
     layout = QVBoxLayout(MnStatusDlg)
     layout.setContentsMargins(10, 15, 10, 10)
     name = QLabel("<b><i>%s</i></b>" % self.mnAlias)
     name.setAlignment(Qt.AlignCenter)
     layout.addWidget(name)
     body = QFormLayout()
     body.setLabelAlignment(Qt.AlignRight)
     body.setVerticalSpacing(20)
     body.setContentsMargins(25, 10, 25, 30)
     body.addRow(QLabel("<b>Address</b>"), QLabel(self.statusData['addr']))
     body.addRow(QLabel("<b>Tx Hash: idx</b>"), QLabel(self.statusData['txhash']+": "+str(self.statusData['outidx'])))
     body.addRow(QLabel("<b>Network</b>"), QLabel(self.statusData['network']))
     body.addRow(QLabel("<b>Version</b>"), QLabel(str(self.statusData['version'])))
     body.addRow(QLabel("<b>Rank</b>"), QLabel(str(self.statusData['rank'])))
     body.addRow(QLabel("<b>Queue Position</b>"), QLabel(str(self.statusData['queue_pos'])))
     body.addRow(QLabel("<b>Active Time</b>"), QLabel(sec_to_time(self.statusData['activetime'])))
     body.addRow(QLabel("<b>Last Seen</b>"), QLabel(time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(self.statusData['lastseen']))))
     body.addRow(QLabel("<b>Last Paid</b>"), QLabel(time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(self.statusData['lastpaid']))))
     layout.addLayout(body)
     self.okButton = QPushButton('OK')
     self.okButton.clicked.connect(self.accept)
     layout.addWidget(self.okButton)
     sh = layout.sizeHint()
     self.setFixedSize(sh)