Python PyQt4.QtGui.QTableWidgetItem() Examples
The following are 30
code examples of PyQt4.QtGui.QTableWidgetItem().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt4.QtGui
, or try the search function
.
Example #1
Source File: guinness.py From GUINNESS with GNU General Public License v2.0 | 7 votes |
def open_FileDialog_tl(self): filename = QtGui.QFileDialog.getOpenFileName(self, 'File Open', './') self.tl_label.setText(filename) # check dimension and size with open(filename, 'rb') as f: global n_class labels = pickle.load(f) label_set = labels['train'].astype(np.int8) max_idx = np.max(label_set) + 1 # includes '0' label print("[INFO] #CLASSES: %d" % max_idx) n_class = max_idx item3 = QtGui.QTableWidgetItem(str(n_class)) self.table.setItem(self.table.rowCount()-1,2,item3) # ----------------------------------------------------------------------- # Load PreDefined CNN # -----------------------------------------------------------------------
Example #2
Source File: mainform.py From darkc0de-old-stuff with GNU General Public License v3.0 | 6 votes |
def applyRegex (self): requests=self.controller.getRequests() if str(self.substSrcEdit.text()): indexes=[] n=self.tableWidget.rowCount() for i in range(n): if not self.tableWidget.isRowHidden(i): indexes.append(i) for i in indexes: try: requests[i].Substitute(str(self.substSrcEdit.text()),str(self.substDstEdit.text())) self.tableWidget.setItem(i,1,QtGui.QTableWidgetItem(requests[i].urlWithoutPath)) self.tableWidget.setItem(i,2,QtGui.QTableWidgetItem(requests[i].pathWithVariables)) if requests[i]["Cookie"]: self.tableWidget.setItem(i,3,QtGui.QTableWidgetItem(requests[i]["Cookie"])) except Exception,a: mb = QtGui.QMessageBox ("Error in substitution","ERROR !",QtGui.QMessageBox.Warning,QtGui.QMessageBox.Ok,0,0) mb.exec_() return self.updateAllStats()
Example #3
Source File: demoUi.py From chanlun with MIT License | 6 votes |
def updateTrade(self, event): """""" data = event.dict_['data'] self.insertRow(0) for col, label in enumerate(self.dictLabels.keys()): if label == 'Direction': try: value = self.dictDirection[data[label]] except KeyError: value = u'未知类型' elif label == 'OffsetFlag': try: value = self.dictOffset[data[label]] except KeyError: value = u'未知类型' else: value = str(data[label]) cell = QtGui.QTableWidgetItem(value) self.setItem(0, col, cell) ########################################################################
Example #4
Source File: scanview.py From rexploit with GNU General Public License v3.0 | 6 votes |
def addItem(self, row, data): """ This function add a item on a row :param row: the row's number :param data: the information :return: None """ # state can be filtered, closed or open # data[3] is state if data[3] in ["open"]: self.tableWidget.setVerticalHeaderItem(row, QTableWidgetItem(QIcon().fromTheme('list-add'), '')) else: self.tableWidget.setVerticalHeaderItem(row, QTableWidgetItem(QIcon().fromTheme('dialog-error'), '')) for i, d in enumerate(data): item = QTableWidgetItem(d) item.setFlags(Qt.ItemIsEnabled) self.tableWidget.setItem(row, i, item)
Example #5
Source File: demoUi.py From chanlun with MIT License | 6 votes |
def updateAccount(self, event): """""" data = event.dict_['data'] accountid = data['AccountID'] # 如果之前已经收到过这个账户的数据, 则直接更新 if accountid in self.dictAccount: d = self.dictAccount[accountid] for label, cell in d.items(): cell.setText(str(data[label])) # 否则插入新的一行,并更新 else: self.insertRow(0) d = {} for col, label in enumerate(self.dictLabels.keys()): cell = QtGui.QTableWidgetItem(str(data[label])) self.setItem(0, col, cell) d[label] = cell self.dictAccount[accountid] = d ########################################################################
Example #6
Source File: demoUi.py From chanlun with MIT License | 6 votes |
def updateLog(self, event): """更新日志""" # 获取当前时间和日志内容 t = time.strftime('%H:%M:%S',time.localtime(time.time())) log = event.dict_['log'] # 在表格最上方插入一行 self.insertRow(0) # 创建单元格 cellTime = QtGui.QTableWidgetItem(t) cellLog = QtGui.QTableWidgetItem(log) # 将单元格插入表格 self.setItem(0, 0, cellTime) self.setItem(0, 1, cellLog) ########################################################################
Example #7
Source File: demoUi.py From chanlun with MIT License | 6 votes |
def updateLog(self, event): """更新日志""" # 获取当前时间和日志内容 t = time.strftime('%H:%M:%S',time.localtime(time.time())) log = event.dict_['log'] # 在表格最上方插入一行 self.insertRow(0) # 创建单元格 cellTime = QtGui.QTableWidgetItem(t) cellLog = QtGui.QTableWidgetItem(log) # 将单元格插入表格 self.setItem(0, 0, cellTime) self.setItem(0, 1, cellLog) ########################################################################
Example #8
Source File: demoUi.py From chanlun with MIT License | 6 votes |
def updateAccount(self, event): """""" data = event.dict_['data'] accountid = data['AccountID'] # 如果之前已经收到过这个账户的数据, 则直接更新 if accountid in self.dictAccount: d = self.dictAccount[accountid] for label, cell in d.items(): cell.setText(str(data[label])) # 否则插入新的一行,并更新 else: self.insertRow(0) d = {} for col, label in enumerate(self.dictLabels.keys()): cell = QtGui.QTableWidgetItem(str(data[label])) self.setItem(0, col, cell) d[label] = cell self.dictAccount[accountid] = d ########################################################################
Example #9
Source File: sync_options.py From EasyStorj with MIT License | 6 votes |
def add_new_sync_directory(self): self.selected_sync_sirectory = QtGui.QFileDialog.getExistingDirectory( None, 'Select a sync directory: ', "", QtGui.QFileDialog.ShowDirsOnly) if self.selected_sync_sirectory != "": self.current_time = time.ctime() total_files_count = self.tools.count_files_in_dir(directory=self.selected_sync_sirectory) total_files_size = self.tools.human_size(self.tools.count_directory_size(self.selected_sync_sirectory, True)) table_row_count = self.sync_menu_ui.sync_directories_tableWidget.rowCount() self.sync_menu_ui.sync_directories_tableWidget.setRowCount(table_row_count + 1) self.sync_menu_ui.sync_directories_tableWidget.setItem( table_row_count, 0, QtGui.QTableWidgetItem(str(self.selected_sync_sirectory))) self.sync_menu_ui.sync_directories_tableWidget.setItem( table_row_count, 1, QtGui.QTableWidgetItem(str(self.current_time))) self.sync_menu_ui.sync_directories_tableWidget.setItem( table_row_count, 2, QtGui.QTableWidgetItem(str(total_files_count))) self.sync_menu_ui.sync_directories_tableWidget.setItem( table_row_count, 3, QtGui.QTableWidgetItem(str(total_files_size))) return True
Example #10
Source File: demoUi.py From chanlun with MIT License | 6 votes |
def updateTrade(self, event): """""" data = event.dict_['data'] self.insertRow(0) for col, label in enumerate(self.dictLabels.keys()): if label == 'Direction': try: value = self.dictDirection[data[label]] except KeyError: value = u'未知类型' elif label == 'OffsetFlag': try: value = self.dictOffset[data[label]] except KeyError: value = u'未知类型' else: value = str(data[label]) cell = QtGui.QTableWidgetItem(value) self.setItem(0, col, cell) ########################################################################
Example #11
Source File: ExplorerDialog.py From qgisSpaceSyntaxToolkit with GNU General Public License v3.0 | 6 votes |
def setStats(self, stats, selection): # update the interface for row in range(self.statisticsTable.rowCount()): label = self.statisticsTable.item(row,0).text() if label in stats: item = QtGui.QTableWidgetItem(str(stats[label])) self.statisticsTable.setItem(row, 1, item) if selection: if label in selection: item = QtGui.QTableWidgetItem(str(selection[label])) self.statisticsTable.setItem(row, 2, item) else: self.statisticsTable.setItem(row, 2, QtGui.QTableWidgetItem("")) self.statisticsTable.horizontalHeader().setResizeMode(0, QtGui.QHeaderView.ResizeToContents) self.statisticsTable.horizontalHeader().setResizeMode(1, QtGui.QHeaderView.Stretch) self.statisticsTable.horizontalHeader().setResizeMode(2, QtGui.QHeaderView.Stretch) self.statisticsTable.resizeRowsToContents()
Example #12
Source File: file_upload.py From EasyStorj with MIT License | 6 votes |
def add_row_files_queue_table(self, row_data): self.files_queue_progressbar_list.append(QtGui.QProgressBar()) self.files_queue_table_row_count = self.ui_single_file_upload.files_queue_table_widget.rowCount() self.ui_single_file_upload.files_queue_table_widget.setRowCount( self.files_queue_table_row_count + 1) self.ui_single_file_upload.files_queue_table_widget.setItem( self.files_queue_table_row_count, 0, QtGui.QTableWidgetItem(os.path.split(str(row_data['file_path']))[1])) self.ui_single_file_upload.files_queue_table_widget.setItem( self.files_queue_table_row_count, 1, QtGui.QTableWidgetItem(row_data['file_path'])) self.ui_single_file_upload.files_queue_table_widget.setItem( self.files_queue_table_row_count, 2, QtGui.QTableWidgetItem(str(self.tools.human_size(os.path.getsize(str(row_data['file_path'])))))) self.ui_single_file_upload.files_queue_table_widget.setCellWidget( self.files_queue_table_row_count, 3, self.files_queue_progressbar_list[self.files_queue_table_row_count])
Example #13
Source File: gps_tool.py From stdm with GNU General Public License v2.0 | 6 votes |
def _set_table_widget_item(self, feature_attr, table_widget, row): """ Sets table widget items :param feature_attr: Data from the GPX feature :param table_widget: Table widget object :param row: Feature count. To be used to set table row number :return: """ check_box = None for column_num, attr in enumerate(feature_attr): if column_num == 0: check_box = self._set_checkbox_item() table_widget.setItem(row, column_num, check_box) column_num += 1 if type(attr) is not basestring: attr = unicode(attr) table_widget.setItem(row, column_num, qg.QTableWidgetItem(attr)) return check_box
Example #14
Source File: demoUi - 副本.py From chanlun with MIT License | 6 votes |
def updateLog(self, event): """更新日志""" # 获取当前时间和日志内容 t = time.strftime('%H:%M:%S',time.localtime(time.time())) log = event.dict_['log'] # 在表格最上方插入一行 self.insertRow(0) # 创建单元格 cellTime = QtGui.QTableWidgetItem(t) cellLog = QtGui.QTableWidgetItem(log) # 将单元格插入表格 self.setItem(0, 0, cellTime) self.setItem(0, 1, cellLog) ########################################################################
Example #15
Source File: demoUi - 副本.py From chanlun with MIT License | 6 votes |
def updateAccount(self, event): """""" data = event.dict_['data'] accountid = data['AccountID'] # 如果之前已经收到过这个账户的数据, 则直接更新 if accountid in self.dictAccount: d = self.dictAccount[accountid] for label, cell in d.items(): cell.setText(str(data[label])) # 否则插入新的一行,并更新 else: self.insertRow(0) d = {} for col, label in enumerate(self.dictLabels.keys()): cell = QtGui.QTableWidgetItem(str(data[label])) self.setItem(0, col, cell) d[label] = cell self.dictAccount[accountid] = d ########################################################################
Example #16
Source File: demoUi - 副本.py From chanlun with MIT License | 6 votes |
def updateTrade(self, event): """""" data = event.dict_['data'] self.insertRow(0) for col, label in enumerate(self.dictLabels.keys()): if label == 'Direction': try: value = self.dictDirection[data[label]] except KeyError: value = u'未知类型' elif label == 'OffsetFlag': try: value = self.dictOffset[data[label]] except KeyError: value = u'未知类型' else: value = str(data[label]) cell = QtGui.QTableWidgetItem(value) self.setItem(0, col, cell) ########################################################################
Example #17
Source File: mainwindow.py From nike_purchase_system with GNU General Public License v3.0 | 5 votes |
def add_account(self): result = self.add_account_instance.line.toPlainText().strip().split("\n") print(result) for i in result: i = i.strip() col = 0 row_num = self.table.rowCount() self.table.insertRow(row_num) for j in re.split(':|,| ', i): new_item = QtGui.QTableWidgetItem(j) self.table.setItem(row_num, col, new_item) col += 1 self.add_account_instance.close()
Example #18
Source File: mainform.py From darkc0de-old-stuff with GNU General Public License v3.0 | 5 votes |
def cambiaPeticion(self,row,col,row2,col2): "Cada vez que se aprieta una peticion de la tabla. row2 y col 2 no se utilizan" requests=self.controller.getRequests() if self.numRequests: self.requestEdit.clear() self.requestEdit.append(requests[row].getAll()) self.responseEdit.clear() self.responseEdit.setPlainText(requests[row].response.getAll()) self.tableWidget_2.clear() self.tableWidget_2.setColumnCount(2) self.tableWidget_2.setRowCount(0) headerItem4 = QtGui.QTableWidgetItem() headerItem4.setText(QtGui.QApplication.translate("MainWindow", "Variable", None, QtGui.QApplication.UnicodeUTF8)) self.tableWidget_2.setHorizontalHeaderItem(0,headerItem4) headerItem5 = QtGui.QTableWidgetItem() headerItem5.setText(QtGui.QApplication.translate("MainWindow", "Value", None, QtGui.QApplication.UnicodeUTF8)) self.tableWidget_2.setHorizontalHeaderItem(1,headerItem5) a=0 for i in requests[row].variablesGET(): self.tableWidget_2.insertRow(a) self.tableWidget_2.setItem(a,0,QtGui.QTableWidgetItem(i)) self.tableWidget_2.setItem(a,1,QtGui.QTableWidgetItem(requests[row].getVariableGET(i))) a+=1 for i in requests[row].variablesPOST(): self.tableWidget_2.insertRow(a) self.tableWidget_2.setItem(a,0,QtGui.QTableWidgetItem(i)) self.tableWidget_2.setItem(a,1,QtGui.QTableWidgetItem(requests[row].getVariablePOST(i))) a+=1 self.tableWidget_2.resizeColumnToContents(0) self.tableWidget_2.resizeColumnToContents(1) self.tableWidget_2.resizeRowsToContents()
Example #19
Source File: mainwindow.py From nike_purchase_system with GNU General Public License v3.0 | 5 votes |
def refresh_table(self): # 删除所有行 self.table.setRowCount(0) for index, proxy in enumerate(self.proxies): self.table.insertRow(self.table.rowCount()) if len(proxy) == 1: new_item = QtGui.QTableWidgetItem(proxy[0]) self.table.setItem(index, 0, new_item) elif len(proxy) == 3: new_item = QtGui.QTableWidgetItem(proxy[0]) self.table.setItem(index, 0, new_item) new_item = QtGui.QTableWidgetItem(proxy[1]) self.table.setItem(index, 1, new_item) new_item = QtGui.QTableWidgetItem(proxy[2]) self.table.setItem(index, 2, new_item)
Example #20
Source File: ExplorerDialog.py From qgisSpaceSyntaxToolkit with GNU General Public License v3.0 | 5 votes |
def __addStatsLabels(self): self.statisticsTable.setHorizontalHeaderLabels(["Statistic","Value","Selection"]) self.statisticsTable.setRowCount(12) self.statisticsTable.setItem(0,0,QtGui.QTableWidgetItem("Number")) self.statisticsTable.setItem(1,0,QtGui.QTableWidgetItem("Mean")) self.statisticsTable.setItem(2,0,QtGui.QTableWidgetItem("Std Dev")) self.statisticsTable.setItem(3,0,QtGui.QTableWidgetItem("Variance")) self.statisticsTable.setItem(4,0,QtGui.QTableWidgetItem("Median")) self.statisticsTable.setItem(5,0,QtGui.QTableWidgetItem("Minimum")) self.statisticsTable.setItem(6,0,QtGui.QTableWidgetItem("Maximum")) self.statisticsTable.setItem(7,0,QtGui.QTableWidgetItem("Range")) self.statisticsTable.setItem(8,0,QtGui.QTableWidgetItem("1st Quart")) self.statisticsTable.setItem(9,0,QtGui.QTableWidgetItem("3rd Quart")) self.statisticsTable.setItem(10,0,QtGui.QTableWidgetItem("IQR")) self.statisticsTable.setItem(11,0,QtGui.QTableWidgetItem("Gini"))
Example #21
Source File: mainwindow.py From nike_purchase_system with GNU General Public License v3.0 | 5 votes |
def update_status(self, para_list): new_item = QtGui.QTableWidgetItem(para_list[1]) self.table.setItem(para_list[0], 3, new_item)
Example #22
Source File: UITranslator.py From universal_tool_template.py with MIT License | 5 votes |
def memory_to_source_ui(self): # update ui once memory gets update txt='\n'.join([row for row in self.memoData['fileList']]) self.uiList['source_txtEdit'].setText(txt) # table table = self.uiList['dict_table'] table.clear() table.setRowCount(0) table.setColumnCount(0) headers = ["UI Name"] table.insertColumn(table.columnCount()) for key in self.memoData['fileList']: headers.append(key) table.insertColumn(table.columnCount()) table.setHorizontalHeaderLabels(headers) ui_name_ok = 0 translate = 1 for file in self.memoData['fileList']: for row, ui_name in enumerate(self.memoData['fileList'][file]): #create ui list if ui_name_ok == 0: ui_item = QtWidgets.QTableWidgetItem(ui_name) table.insertRow(table.rowCount()) table.setItem(row, 0, ui_item) translate_item = QtWidgets.QTableWidgetItem(self.memoData['fileList'][file][ui_name]) table.setItem(row, translate, translate_item) ui_name_ok = 1 translate +=1
Example #23
Source File: gps_tool.py From stdm with GNU General Public License v2.0 | 5 votes |
def _set_checkbox_item(self): """ Sets the checkbox item :return: Table widget item :rtype: Object """ check_box = qg.QTableWidgetItem() check_box.setCheckState(qc.Qt.Checked) check_box.setFlags(qc.Qt.ItemIsUserCheckable | qc.Qt.ItemIsEnabled | qc.Qt.ItemIsSelectable) return check_box
Example #24
Source File: gerix.py From gerix-wifi-cracker-2 with GNU General Public License v2.0 | 5 votes |
def slot_database_changed(self): selrow = self.table_database.currentRow() if selrow == -1: return key = str(self.table_database.item(selrow, 3)) item=QtGui.QTableWidgetItem() item.setText((key_to_ascii(key))) self.table_database.setItem(selrow, 4, item) # # Add an entry to the database table #
Example #25
Source File: UITranslator_v1.0.py From universal_tool_template.py with MIT License | 5 votes |
def changeTableHeader(self, index): table = self.uiList["dict_table"] oldHeader = str(table.horizontalHeaderItem(index).text()) text, ok = QtGui.QInputDialog.getText(self, 'Change header label for column %d' % index,'Header:',QtGui.QLineEdit.Normal, oldHeader) if ok: if text in self.memoData['fileList'].keys(): print("This Language already in the table.") else: table.setHorizontalHeaderItem(index, QtGui.QTableWidgetItem(text) ) #~~~~~~~~~~~~~~ # default ui function
Example #26
Source File: UITranslator_v1.0.py From universal_tool_template.py with MIT License | 5 votes |
def memory_to_source_ui(self): # update ui once memory gets update txt='\n'.join([row for row in self.memoData['fileList']]) self.uiList['source_txtEdit'].setText(txt) # table table = self.uiList['dict_table'] table.clear() table.setRowCount(0) table.setColumnCount(0) headers = ["UI Name"] table.insertColumn(table.columnCount()) for key in self.memoData['fileList']: headers.append(key) table.insertColumn(table.columnCount()) table.setHorizontalHeaderLabels(headers) ui_name_ok = 0 translate = 1 for file in self.memoData['fileList']: for row, ui_name in enumerate(self.memoData['fileList'][file]): #create ui list if ui_name_ok == 0: ui_item = QtGui.QTableWidgetItem(ui_name) table.insertRow(table.rowCount()) table.setItem(row, 0, ui_item) translate_item = QtGui.QTableWidgetItem(self.memoData['fileList'][file][ui_name]) table.setItem(row, translate, translate_item) ui_name_ok = 1 translate +=1
Example #27
Source File: gerix.py From gerix-wifi-cracker-2 with GNU General Public License v2.0 | 5 votes |
def add_key_to_database(self): aircrack_log = config_dir + 'aircrack-log.txt' # read cracked key key = commands.getoutput("cat " + aircrack_log + " | grep 'KEY FOUND' | tr '[]' '\n' | egrep '([a-fA-F0-9]:)+' | tr -d ' \t'") # insert a row in the database self.table_database.insertRow(0) item=QtGui.QTableWidgetItem() item.setText(essid) self.table_database.setItem(0, 0, item) item=QtGui.QTableWidgetItem() item.setText(self.ac) self.table_database.setItem(0, 1, item) item=QtGui.QTableWidgetItem() item.setText(self.canale) self.table_database.setItem(0, 2, item) item=QtGui.QTableWidgetItem() item.setText(key) self.table_database.setItem(0, 3, item) item=QtGui.QTableWidgetItem() item.setText((key_to_ascii(key))) self.table_database.setItem(0, 4, item) # # Database changed #
Example #28
Source File: UITranslator.py From universal_tool_template.py with MIT License | 5 votes |
def newLang_action(self): if len(self.memoData['fileList'].keys()) == 0: print("You need have UI name structure loaded in order to create a new language.") else: text, ok = QtWidgets.QInputDialog.getText(self, 'New Translation Creation', 'Enter language file name (eg. lang_cn):') if ok: if text in self.memoData['fileList'].keys(): print("This Language already in the table.") else: self.uiList['dict_table'].insertColumn(self.uiList['dict_table'].columnCount()) index = self.uiList['dict_table'].columnCount() - 1 self.uiList['dict_table'].setHorizontalHeaderItem(index, QtWidgets.QTableWidgetItem(text) )
Example #29
Source File: mainform.py From darkc0de-old-stuff with GNU General Public License v3.0 | 5 votes |
def limpiatablas(self): self.tableWidget.clear() self.tableWidget.setColumnCount(4) self.tableWidget.setRowCount(0) headerItem = QtGui.QTableWidgetItem() headerItem.setText(QtGui.QApplication.translate("MainWindow", "Method", None, QtGui.QApplication.UnicodeUTF8)) self.tableWidget.setHorizontalHeaderItem(0,headerItem) headerItem1 = QtGui.QTableWidgetItem() headerItem1.setText(QtGui.QApplication.translate("MainWindow", "Target", None, QtGui.QApplication.UnicodeUTF8)) self.tableWidget.setHorizontalHeaderItem(1,headerItem1) headerItem2 = QtGui.QTableWidgetItem() headerItem2.setText(QtGui.QApplication.translate("MainWindow", "Url", None, QtGui.QApplication.UnicodeUTF8)) self.tableWidget.setHorizontalHeaderItem(2,headerItem2) headerItem3 = QtGui.QTableWidgetItem() headerItem3.setText(QtGui.QApplication.translate("MainWindow", "Cookies", None, QtGui.QApplication.UnicodeUTF8)) self.tableWidget.setHorizontalHeaderItem(3,headerItem3) self.tableWidget_2.clear() self.tableWidget_2.setColumnCount(2) self.tableWidget_2.setRowCount(0) headerItem4 = QtGui.QTableWidgetItem() headerItem4.setText(QtGui.QApplication.translate("MainWindow", "Variable", None, QtGui.QApplication.UnicodeUTF8)) self.tableWidget_2.setHorizontalHeaderItem(0,headerItem4) headerItem5 = QtGui.QTableWidgetItem() headerItem5.setText(QtGui.QApplication.translate("MainWindow", "Value", None, QtGui.QApplication.UnicodeUTF8)) self.tableWidget_2.setHorizontalHeaderItem(1,headerItem5)
Example #30
Source File: mainform.py From darkc0de-old-stuff with GNU General Public License v3.0 | 5 votes |
def setNewCookie(self): requests=self.controller.getRequests() indexes=[] n=self.tableWidget.rowCount() for i in range(n): if not self.tableWidget.isRowHidden(i): indexes.append(i) for i in indexes: requests[i].addHeader("Cookie",str(self.cookieEdit.text())) self.tableWidget.setItem(i,3,QtGui.QTableWidgetItem(str(self.cookieEdit.text())))