def add_item(self, file_name, local_path): count = self.rename_table.rowCount() self.rename_table.insertRow(count) item = QtWidgets.QTableWidgetItem(file_name) item.setToolTip('source name') self.rename_table.setItem(count, 1, item) rename_item = QtWidgets.QTableWidgetItem('') rename_item.setToolTip('alias name') self.rename_table.setItem(count, 3, rename_item) self.rename_table.setItem(count, 2, QtWidgets.QTableWidgetItem(local_path)) self.add_button(count, file_name)
def rename_dialog(self, type): rename_list = [] for index in self.rename_table.selectedIndexes(): if index.column() == 1: rename_list.append( str(self.rename_table.item(index.row(), 1).text())) else: context = self.rename_table.item(index.row(), 3) if context: rename_list.append(str(context.text())) self.rename = RenameDialog(rename_list, type, parent=self) rename_list = self.rename.new_filed if rename_list: count = 0 for index in self.rename_table.selectedIndexes(): if rename_list[count]: item = QtWidgets.QTableWidgetItem(rename_list[count]) item.setToolTip('alias name') self.rename_table.setItem(index.row(), 3, item) count += 1