def mostrarResultados(self): # cambiar texto campo descripcion self.stepTipsField.setPlainText( "A continuación se muestra una tabla con los resultados de la clasificación realizada por el modelo seleccionado." ) # para ocupar toda la tabla self.tableWidgetshowTest.horizontalHeader().setSectionResizeMode( QtWidgets.QHeaderView.Stretch) # resetear tabla self.tableWidgetshowTest.setRowCount(0) nombre = self.nombreresultadoexcel # mostrar contenido xlsx documento = xlrd.open_workbook(nombre + '.xlsx') df = documento.sheet_by_index(0) self.tableWidgetshowTest.setRowCount((df.nrows) - 1) self.tableWidgetshowTest.setColumnCount(2) for x in range(1, df.nrows): for y in range(2): print('x: ' + df.cell_value(x, y - 1)) item = QTableWidgetItem() nombreArchivo = df.cell_value(x, y - 1).split("/") item.setText(nombreArchivo[len(nombreArchivo) - 1]) self.tableWidgetshowTest.setItem(x - 1, y - 1, item)
def update_customs(self, host_item): """ Update customs QTableWidget with customs of host item :param host_item: Host item :type host_item: alignak_app.items.host.Host """ logger.debug('Open Customs for %s', host_item.name) self.customs_table.clear() self.customs_table.setHorizontalHeaderLabels(self.table_headers) self.customs_table.setRowCount(len(host_item.data['customs'])) row = 0 for custom in host_item.data['customs']: title_item = QTableWidgetItem() title = '' if '_' in custom[:1]: title = custom[1:] title = title.replace('_', ' ').capitalize() title_item.setText(title) title_item.setToolTip(custom) self.customs_table.setItem(row, 0, title_item) data_item = QTableWidgetItem() data_item.setText(str(host_item.data['customs'][custom])) self.customs_table.setItem(row, 1, data_item) row += 1
def impulse_calculate1(self): self.impulse_table.clear() l = self.main_table.columnCount() self.impulse_table.setColumnCount(l) for i in range(l): self.impulse_table.setItem(0, i, QTableWidgetItem('0')) self.impulse_table.setColumnWidth(i, 50) for c in range(self.main_table.columnCount()): it = self.main_table.horizontalHeaderItem(c) item = QTableWidgetItem() self.impulse_table.setHorizontalHeaderItem(c, item) item = self.impulse_table.horizontalHeaderItem(c) item.setText(str(it.text()))
def upload1(self): try: df = pd.read_csv(self.file.displayText(), delimiter=',', header=None) self.main_table.clear() self.main_table.setCornerButtonEnabled(False) #self.impulse_table.setCornerButtonEnabled(False) self.main_table.setColumnCount(len(df)) #self.impulse_table.setColumnCount(len(df)) self.main_table.setRowCount(len(df)) #self.impulse_table.setRowCount(1) self.main_table.setSortingEnabled(False) for i in range(len(df)): #self.main_table.horizontalHeader.setDefaultSectionSize(60) item = QTableWidgetItem() self.main_table.setVerticalHeaderItem(i, item) item = self.main_table.verticalHeaderItem(i) item.setText(str(i + 1)) self.main_table.setColumnWidth(i, 50) item = QTableWidgetItem() self.main_table.setHorizontalHeaderItem(i, item) item = self.main_table.horizontalHeaderItem(i) item.setText(str(i + 1)) for i in range(len(df)): for j in range(len(df)): item = QTableWidgetItem() mmm = round(df.iloc[i, j], 3) item.setText(str(mmm)) self.main_table.setItem(i, j, item) self.main_table.setColumnWidth(i, 50) self.main_table.setRowHeight(i, 50) #item = QTableWidgetItem() #item.setText(str(0)) #self.impulse_table.setItem(0, i, item) #self.main_table.resizeRowsToContents() except: QMessageBox.warning(w, 'Error', 'Не вибраний існуючий файл')
def setText(self, txt): self.is_placeholder = False self.current_value = txt QTableWidgetItem.setText(self, txt)
def setText(self, txt): self.current_value = txt QTableWidgetItem.setText(txt)
def initRewardsForm(self): self.collateralHidden = True self.rewardsForm = QGroupBox() self.rewardsForm.setTitle("Transfer Rewards") layout = QFormLayout() layout.setContentsMargins(10, 10, 10, 10) layout.setSpacing(13) layout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow) ##--- ROW 1 hBox = QHBoxLayout() self.mnSelect = QComboBox() self.mnSelect.setToolTip("Select Masternode") hBox.addWidget(self.mnSelect) label = QLabel("Total Address Balance") label.setAlignment(Qt.AlignRight | Qt.AlignVCenter) hBox.addWidget(label) self.addrAvailLine = QLabel() self.addrAvailLine.setToolTip("PIVX Address total balance") self.addrAvailLine.setText("--") hBox.addWidget(self.addrAvailLine) self.btn_toggleCollateral = QPushButton("Show Collateral") hBox.addWidget(self.btn_toggleCollateral) hBox.setStretch(0, 1) hBox.setStretch(1, 0) hBox.setStretch(2, 0) layout.addRow(QLabel("Masternode"), hBox) ## --- ROW 2: REWARDS self.rewardsList = QVBoxLayout() self.rewardsList.statusLabel = QLabel( '<b style="color:purple">Checking explorer...</b>') self.rewardsList.statusLabel.setVisible(True) self.rewardsList.addWidget(self.rewardsList.statusLabel) self.rewardsList.box = QTableWidget() self.rewardsList.box.setMinimumHeight(140) self.rewardsList.box.setMaximumHeight(140) self.rewardsList.box.setHorizontalScrollBarPolicy( Qt.ScrollBarAlwaysOff) self.rewardsList.box.setSelectionMode(QAbstractItemView.MultiSelection) self.rewardsList.box.setSelectionBehavior(QAbstractItemView.SelectRows) self.rewardsList.box.setShowGrid(True) self.rewardsList.box.setColumnCount(4) self.rewardsList.box.setRowCount(0) self.rewardsList.box.horizontalHeader().setSectionResizeMode( 2, QHeaderView.Stretch) self.rewardsList.box.verticalHeader().hide() item = QTableWidgetItem() item.setText("PIVs") item.setTextAlignment(Qt.AlignCenter) self.rewardsList.box.setHorizontalHeaderItem(0, item) item = QTableWidgetItem() item.setText("Confirmations") item.setTextAlignment(Qt.AlignCenter) self.rewardsList.box.setHorizontalHeaderItem(1, item) item = QTableWidgetItem() item.setText("TX Hash") item.setTextAlignment(Qt.AlignCenter) self.rewardsList.box.setHorizontalHeaderItem(2, item) item = QTableWidgetItem() item.setText("TX Output N") item.setTextAlignment(Qt.AlignCenter) self.rewardsList.box.setHorizontalHeaderItem(3, item) item = QTableWidgetItem() self.rewardsList.addWidget(self.rewardsList.box) layout.addRow(self.rewardsList) ##--- ROW 3 hBox2 = QHBoxLayout() self.btn_selectAllRewards = QPushButton("Select All") self.btn_selectAllRewards.setToolTip("Select all available UTXOs") hBox2.addWidget(self.btn_selectAllRewards) self.btn_deselectAllRewards = QPushButton("Deselect all") self.btn_deselectAllRewards.setToolTip("Deselect current selection") hBox2.addWidget(self.btn_deselectAllRewards) hBox2.addWidget(QLabel("Selected rewards")) self.selectedRewardsLine = QLabel() self.selectedRewardsLine.setMinimumWidth(200) self.selectedRewardsLine.setStyleSheet("color: purple") self.selectedRewardsLine.setToolTip("PIVX to move away") hBox2.addWidget(self.selectedRewardsLine) hBox2.addStretch(1) self.swiftxCheck = QCheckBox() self.swiftxCheck.setToolTip( "check for SwiftX instant transaction (flat fee rate of 0.01 PIV)") hBox2.addWidget(QLabel("Use SwiftX")) hBox2.addWidget(self.swiftxCheck) layout.addRow(hBox2) ##--- ROW 4 hBox3 = QHBoxLayout() self.destinationLine = QLineEdit() self.destinationLine.setToolTip("PIVX address to transfer rewards to") hBox3.addWidget(self.destinationLine) hBox3.addWidget(QLabel("Fee")) self.feeLine = QDoubleSpinBox() self.feeLine.setDecimals(8) self.feeLine.setPrefix("PIV ") self.feeLine.setToolTip("Insert a small fee amount") self.feeLine.setFixedWidth(150) self.feeLine.setSingleStep(0.001) hBox3.addWidget(self.feeLine) self.btn_sendRewards = QPushButton("Send") hBox3.addWidget(self.btn_sendRewards) layout.addRow(QLabel("Destination Address"), hBox3) ##--- ROW 5 hBox4 = QHBoxLayout() hBox4.addStretch(1) self.loadingLine = QLabel( "<b style='color:red'>Preparing TX.</b> Completed: ") self.loadingLinePercent = QProgressBar() self.loadingLinePercent.setMaximumWidth(200) self.loadingLinePercent.setMaximumHeight(10) self.loadingLinePercent.setRange(0, 100) hBox4.addWidget(self.loadingLine) hBox4.addWidget(self.loadingLinePercent) self.loadingLine.hide() self.loadingLinePercent.hide() layout.addRow(hBox4) #--- Set Layout self.rewardsForm.setLayout(layout) #--- ROW 5 self.btn_Cancel = QPushButton("Clear/Reload")
def initRewardsForm(self): self.rewardsForm = QGroupBox() self.rewardsForm.setTitle("Transfer UTXOs") layout = QFormLayout() layout.setContentsMargins(10, 10, 10, 10) layout.setSpacing(13) layout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow) ##--- ROW 1 line1 = QHBoxLayout() line1.addWidget(QLabel("Account HW")) self.edt_hwAccount = QSpinBox() self.edt_hwAccount.setMaximum(9999) self.edt_hwAccount.setFixedWidth(50) self.edt_hwAccount.setToolTip( "account number of the hardware wallet.\nIf unsure put 0") self.edt_hwAccount.setValue(0) line1.addWidget(self.edt_hwAccount) line1.addWidget(QLabel("spath from")) self.edt_spathFrom = QSpinBox() self.edt_spathFrom.setMaximum(9999) self.edt_spathFrom.setFixedWidth(50) self.edt_spathFrom.setToolTip("starting address n.") self.edt_spathFrom.setValue(0) line1.addWidget(self.edt_spathFrom) line1.addWidget(QLabel("spath to")) self.edt_spathTo = QSpinBox() self.edt_spathTo.setMaximum(9999) self.edt_spathTo.setFixedWidth(50) self.edt_spathTo.setToolTip("ending address n.") self.edt_spathTo.setValue(10) line1.addWidget(self.edt_spathTo) line1.addWidget(QLabel("internal/external")) self.edt_internalExternal = QSpinBox() self.edt_internalExternal.setFixedWidth(50) self.edt_internalExternal.setToolTip("ending address n.") self.edt_internalExternal.setValue(0) self.edt_internalExternal.setMaximum(1) line1.addWidget(self.edt_internalExternal) line1.addStretch(1) self.btn_reload = QPushButton("Scan Ledger device") self.btn_reload.setToolTip("Reload data from ledger device") line1.addWidget(self.btn_reload) layout.addRow(line1) hBox = QHBoxLayout() self.addySelect = QComboBox() self.addySelect.setToolTip("Select Address") hBox.addWidget(self.addySelect) layout.addRow(hBox) ## --- ROW 2: UTXOs self.rewardsList = QVBoxLayout() self.rewardsList.statusLabel = QLabel( '<b style="color:red">Reload Rewards</b>') self.rewardsList.statusLabel.setVisible(True) self.rewardsList.addWidget(self.rewardsList.statusLabel) self.rewardsList.box = QTableWidget() self.rewardsList.box.setMinimumHeight(200) #self.rewardsList.box.setMaximumHeight(140) self.rewardsList.box.setHorizontalScrollBarPolicy( Qt.ScrollBarAlwaysOff) self.rewardsList.box.setSelectionMode(QAbstractItemView.MultiSelection) self.rewardsList.box.setSelectionBehavior(QAbstractItemView.SelectRows) self.rewardsList.box.setShowGrid(True) self.rewardsList.box.setColumnCount(4) self.rewardsList.box.setRowCount(0) self.rewardsList.box.horizontalHeader().setSectionResizeMode( 2, QHeaderView.Stretch) self.rewardsList.box.verticalHeader().hide() item = QTableWidgetItem() item.setText("PIVs") item.setTextAlignment(Qt.AlignCenter) self.rewardsList.box.setHorizontalHeaderItem(0, item) item = QTableWidgetItem() item.setText("Confirmations") item.setTextAlignment(Qt.AlignCenter) self.rewardsList.box.setHorizontalHeaderItem(1, item) item = QTableWidgetItem() item.setText("TX Hash") item.setTextAlignment(Qt.AlignCenter) self.rewardsList.box.setHorizontalHeaderItem(2, item) item = QTableWidgetItem() item.setText("TX Output N") item.setTextAlignment(Qt.AlignCenter) self.rewardsList.box.setHorizontalHeaderItem(3, item) item = QTableWidgetItem() self.rewardsList.addWidget(self.rewardsList.box) layout.addRow(self.rewardsList) ##--- ROW 3 hBox2 = QHBoxLayout() self.btn_selectAllRewards = QPushButton("Select All") self.btn_selectAllRewards.setToolTip("Select all available UTXOs") hBox2.addWidget(self.btn_selectAllRewards) self.btn_deselectAllRewards = QPushButton("Deselect All") self.btn_deselectAllRewards.setToolTip("Deselect current selection") hBox2.addWidget(self.btn_deselectAllRewards) hBox2.addWidget(QLabel("Selected UTXOs")) self.selectedRewardsLine = QLabel() self.selectedRewardsLine.setMinimumWidth(200) self.selectedRewardsLine.setStyleSheet("color: purple") self.selectedRewardsLine.setToolTip("PIVX to move away") hBox2.addWidget(self.selectedRewardsLine) hBox2.addStretch(1) self.swiftxCheck = QCheckBox() self.swiftxCheck.setToolTip( "check for SwiftX instant transaction (flat fee rate of 0.01 PIV)") hBox2.addWidget(QLabel("Use SwiftX")) hBox2.addWidget(self.swiftxCheck) layout.addRow(hBox2) ##--- ROW 4 hBox3 = QHBoxLayout() self.destinationLine = QLineEdit() self.destinationLine.setToolTip("PIVX address to send PIV to") hBox3.addWidget(self.destinationLine) hBox3.addWidget(QLabel("Fee")) self.feeLine = QDoubleSpinBox() self.feeLine.setDecimals(8) self.feeLine.setPrefix("PIV ") self.feeLine.setToolTip("Insert a small fee amount") self.feeLine.setFixedWidth(150) self.feeLine.setSingleStep(0.001) hBox3.addWidget(self.feeLine) self.btn_sendRewards = QPushButton("Send") hBox3.addWidget(self.btn_sendRewards) layout.addRow(QLabel("Destination Address"), hBox3) hBox4 = QHBoxLayout() hBox4.addStretch(1) self.loadingLine = QLabel( "<b style='color:red'>Preparing TX.</b> Completed: ") self.loadingLinePercent = QProgressBar() self.loadingLinePercent.setMaximumWidth(200) self.loadingLinePercent.setMaximumHeight(10) self.loadingLinePercent.setRange(0, 100) hBox4.addWidget(self.loadingLine) hBox4.addWidget(self.loadingLinePercent) self.loadingLine.hide() self.loadingLinePercent.hide() layout.addRow(hBox4) #--- Set Layout self.rewardsForm.setLayout(layout) #--- ROW 5 self.btn_Cancel = QPushButton("Clear")
def setText(self, txt): self.sort_key = sort_key(unicode_type(txt)) QTableWidgetItem.setText(self, txt)