我们从Python开源项目中,提取了以下35个代码示例,用于说明如何使用PyQt5.QtWidgets.QTableWidget()。
def createTable(self): q = LatestQuakes() c = 0 self.tableWidget = QTableWidget() self.tableWidget.setVerticalHeaderLabels(('Row 1', 'Row 2', 'Row 3')) self.tableWidget.setRowCount(30) self.tableWidget.setColumnCount(7) self.tableWidget.setColumnWidth(0, 30) self.tableWidget.setColumnWidth(1, 160) for quake in q.work(): self.tableWidget.setItem(c, 0, QTableWidgetItem(quake["text"])) self.tableWidget.setItem(c, 1, QTableWidgetItem(quake["name"])) self.tableWidget.setItem(c, 2, QTableWidgetItem(quake["time"])) self.tableWidget.setItem(c, 3, QTableWidgetItem(quake["hours"])) self.tableWidget.setItem(c, 4, QTableWidgetItem(quake["deep"])) self.tableWidget.setItem(c, 5, QTableWidgetItem(quake["longitude"][0])) self.tableWidget.setItem(c, 6, QTableWidgetItem(quake["latitude"][0])) c = c + 1 self.tableWidget.move(0, 0) # table selection change # self.tableWidget.doubleClicked.connect(self.on_click)
def setupUi(self, AvailableModules): AvailableModules.setObjectName("AvailableModules") AvailableModules.resize(640, 480) self.verticalLayout = QtWidgets.QVBoxLayout(AvailableModules) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName("verticalLayout") self.table_modules = QtWidgets.QTableWidget(AvailableModules) self.table_modules.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection) self.table_modules.setCornerButtonEnabled(True) self.table_modules.setRowCount(0) self.table_modules.setColumnCount(3) self.table_modules.setObjectName("table_modules") self.table_modules.horizontalHeader().setSortIndicatorShown(False) self.table_modules.horizontalHeader().setStretchLastSection(True) self.table_modules.verticalHeader().setVisible(False) self.verticalLayout.addWidget(self.table_modules) self.retranslateUi(AvailableModules) QtCore.QMetaObject.connectSlotsByName(AvailableModules)
def createTable(self): # Create table self.tableWidget = QTableWidget() self.tableWidget.setRowCount(4) self.tableWidget.setColumnCount(2) self.tableWidget.setItem(0,0, QTableWidgetItem("Cell (1,1)")) self.tableWidget.setItem(0,1, QTableWidgetItem("Cell (1,2)")) self.tableWidget.setItem(1,0, QTableWidgetItem("Cell (2,1)")) self.tableWidget.setItem(1,1, QTableWidgetItem("Cell (2,2)")) self.tableWidget.setItem(2,0, QTableWidgetItem("Cell (3,1)")) self.tableWidget.setItem(2,1, QTableWidgetItem("Cell (3,2)")) self.tableWidget.setItem(3,0, QTableWidgetItem("Cell (4,1)")) self.tableWidget.setItem(3,1, QTableWidgetItem("Cell (4,2)")) self.tableWidget.move(0,0) # table selection change self.tableWidget.doubleClicked.connect(self.on_click)
def __init__(self): QWidget.__init__(self) self.main_vbox=QVBoxLayout() self.tab = QTableWidget() self.tab.resizeColumnsToContents() self.tab.verticalHeader().setVisible(False) self.create_model() # self.tab.cellChanged.connect(self.tab_changed) self.main_vbox.addWidget(self.tab) self.setLayout(self.main_vbox) self.show()
def __init__(self, registers=None): super(RegisterWindow, self).__init__() self.setWindowTitle("Registers") self.setLayout(QtWidgets.QVBoxLayout()) self._layout = self.layout() # Set up display mode combobox self._picker = QtWidgets.QComboBox() for mode in self._display_modes: self._picker.addItem(mode) self._picker.setCurrentIndex(2) self._layout.addWidget(self._picker) self._picker.currentIndexChanged.connect(self.change_display_mode) # Set up register table self._table = QtWidgets.QTableWidget() self._table.setColumnCount(2) self._table.setHorizontalHeaderLabels(['Register', 'Value']) self._table.horizontalHeader().setStretchLastSection(True) self._table.verticalHeader().setVisible(False) self._layout.addWidget(self._table) # Set up flag viewer self._flags = QtWidgets.QTableWidget() self._flags.setColumnCount(len(flagbits.keys())) self._flags.setHorizontalHeaderLabels(flagbits.keys()) self._flags.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch) self._flags.verticalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Fixed) self._flags.verticalHeader().setVisible(False) self._flags.setMaximumHeight(55) self._flags.setRowCount(1) for index, value in enumerate(flagnames): self._flags.horizontalHeaderItem(index).setToolTip(value) self._layout.addWidget(self._flags) self.setObjectName('Register_Window') self.should_clean = False if registers is not None: self.update_registers(registers)
def __init__(self, label, widget): super().__init__(label) self.widget = widget self.setCheckable(True) self.toggled.connect(self.showhide) self.setChecked(False) layout = QtWidgets.QVBoxLayout() layout.addWidget(widget) self.setLayout(layout) if isinstance(self.widget, QtWidgets.QTableWidget): self.widget.itemChanged.connect(self.toggle_empty_table)
def __init__(self): QWidgetSavePos.__init__(self,"cost") self.setFixedSize(900, 600) self.setWindowIcon(QIcon_load("jv")) self.setWindowTitle(_("Cost and energy payback calculator")) self.main_vbox = QVBoxLayout() toolbar=QToolBar() toolbar.setIconSize(QSize(48, 48)) self.play = QAction(QIcon_load("media-playback-start"), _("Re-calcualte"), self) self.play.triggered.connect(self.update) toolbar.addAction(self.play) spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) toolbar.addWidget(spacer) self.help = QAction(QIcon_load("help"), _("Help"), self) self.help.triggered.connect(self.callback_help) toolbar.addAction(self.help) self.main_vbox.addWidget(toolbar) self.tab= QTableWidget() self.main_vbox.addWidget(self.tab) self.setLayout(self.main_vbox) self.update()
def __init__(self): self.file_path="" QWidget.__init__(self) self.main_vbox=QVBoxLayout() self.setFixedSize(800,400) self.tab = QTableWidget() self.tab.setWordWrap(True) self.tab.resizeColumnsToContents() self.tab.verticalHeader().setVisible(False) self.create_model() # self.tab.cellChanged.connect(self.tab_changed) self.main_vbox.addWidget(self.tab) self.hwidget=QWidget() okButton = QPushButton("OK") cancelButton = QPushButton("Cancel") hbox = QHBoxLayout() hbox.addStretch(1) hbox.addWidget(okButton) hbox.addWidget(cancelButton) self.hwidget.setLayout(hbox) self.main_vbox.addWidget(self.hwidget) self.setLayout(self.main_vbox) okButton.clicked.connect(self.on_ok_clicked) cancelButton.clicked.connect(self.close) return
def __init__(self,file_name,name): QGroupBox.__init__(self) self.file_name=file_name self.name=name self.setTitle(name) self.setStyleSheet("QGroupBox { border: 1px solid gray;}") vbox=QVBoxLayout() self.setLayout(vbox) toolbar=QToolBar() toolbar.setIconSize(QSize(48, 48)) add = QAction(QIcon_load("list-add",size=16), _("Add "+self.name+" mesh layer"), self) add.triggered.connect(self.add_item_clicked) toolbar.addAction(add) remove = QAction(QIcon_load("list-remove",size=16), _("Remove "+self.name+" mesh layer"), self) remove.triggered.connect(self.on_remove_click) toolbar.addAction(remove) vbox.addWidget(toolbar) self.tab = QTableWidget() self.tab.resizeColumnsToContents() self.tab.verticalHeader().setVisible(False) self.tab.clear() self.tab.setColumnCount(5) self.tab.setSelectionBehavior(QAbstractItemView.SelectRows) self.load() self.tab.cellChanged.connect(self.tab_changed) vbox.addWidget(self.tab)
def __init__(self, pixel_information_window): # set window title, object name and window size pixel_information_window.setWindowTitle("Pixel Information") pixel_information_window.setObjectName("PixelInformationWindow") pixel_information_window.resize(320, 240) # pixel information table self.pixel_information_table_widget = QTableWidget() self.pixel_information_table_widget.setParent(pixel_information_window) self.pixel_information_table_widget.setGeometry(QRect(10, 10, 300, 220)) self.pixel_information_table_widget.setObjectName("pixel_information_table") self.pixel_information_table_widget.setColumnCount(0) self.pixel_information_table_widget.setRowCount(0)
def setupUi(self, SQLWindow): SQLWindow.setObjectName("FobberWindow") SQLWindow.resize(800, 370) font = QtGui.QFont() font.setBold(False) font.setWeight(50) SQLWindow.setFont(font) self.centralwidget = QtWidgets.QWidget(SQLWindow) self.centralwidget.setObjectName("centralwidget") self.sqlTable = QtWidgets.QTableWidget(self.centralwidget) self.sqlTable.setGeometry(QtCore.QRect(10, 20, 782, 321)) self.sqlTable.setObjectName("sqlTable") self.validationButton = QtWidgets.QPushButton(self.centralwidget) self.validationButton.setGeometry(QtCore.QRect(10, 340, 93, 28)) self.validationButton.setObjectName("validationButton") self.logoutButton = QtWidgets.QPushButton(self.centralwidget) self.logoutButton.setGeometry(QtCore.QRect(210, 340, 93, 28)) self.logoutButton.setObjectName("logoutButton") self.refreshButton = QtWidgets.QPushButton(self.centralwidget) self.refreshButton.setGeometry(QtCore.QRect(110, 340, 93, 28)) self.refreshButton.setObjectName("refreshButton") self.retranslateUi(SQLWindow) QtCore.QMetaObject.connectSlotsByName(SQLWindow)
def setLang(self, langName): lang_data = self.memoData['lang'][langName] for ui_name in lang_data.keys(): if ui_name in self.uiList.keys() and lang_data[ui_name] != '': ui_element = self.uiList[ui_name] # '' means no translation availdanle in that data file if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ): # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox ui_element.setText(lang_data[ui_name]) elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ): # uiType: QMenu, QGroupBox ui_element.setTitle(lang_data[ui_name]) elif isinstance(ui_element, QtWidgets.QTabWidget): # uiType: QTabWidget tabCnt = ui_element.count() tabNameList = lang_data[ui_name].split(';') if len(tabNameList) == tabCnt: for i in range(tabCnt): if tabNameList[i] != '': ui_element.setTabText(i,tabNameList[i]) elif isinstance(ui_element, QtWidgets.QComboBox): # uiType: QComboBox itemCnt = ui_element.count() itemNameList = lang_data[ui_name].split(';') ui_element.clear() ui_element.addItems(itemNameList) elif isinstance(ui_element, QtWidgets.QTreeWidget): # uiType: QTreeWidget labelCnt = ui_element.headerItem().columnCount() labelList = lang_data[ui_name].split(';') ui_element.setHeaderLabels(labelList) elif isinstance(ui_element, QtWidgets.QTableWidget): # uiType: QTableWidget colCnt = ui_element.columnCount() headerList = lang_data[ui_name].split(';') cur_table.setHorizontalHeaderLabels( headerList ) elif isinstance(ui_element, (str, unicode) ): # uiType: string for msg self.uiList[ui_name] = lang_data[ui_name]
def setupUi(self, topRelation): topRelation.setObjectName("topRelation") topRelation.resize(324, 300) self.verticalLayout = QtWidgets.QVBoxLayout(topRelation) self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.staticLabel = QtWidgets.QLabel(topRelation) font = QtGui.QFont() font.setPointSize(12) self.staticLabel.setFont(font) self.staticLabel.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.staticLabel.setObjectName("staticLabel") self.horizontalLayout.addWidget(self.staticLabel) self.relationName = QtWidgets.QLabel(topRelation) font = QtGui.QFont() font.setPointSize(12) self.relationName.setFont(font) self.relationName.setText("") self.relationName.setScaledContents(False) self.relationName.setObjectName("relationName") self.horizontalLayout.addWidget(self.relationName) self.verticalLayout.addLayout(self.horizontalLayout) self.tableWidget = QtWidgets.QTableWidget(topRelation) self.tableWidget.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) self.tableWidget.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection) self.tableWidget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) self.tableWidget.setObjectName("tableWidget") self.tableWidget.setColumnCount(3) self.tableWidget.setRowCount(0) item = QtWidgets.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(0, item) item = QtWidgets.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(1, item) item = QtWidgets.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(2, item) self.tableWidget.verticalHeader().setVisible(False) self.verticalLayout.addWidget(self.tableWidget) self.retranslateUi(topRelation) QtCore.QMetaObject.connectSlotsByName(topRelation)
def _config_ui(self): for i, name in enumerate(self.types): tbl_name = "{0}Table".format(name.lower().replace('-', '')) tbl = self.findChild(QtWidgets.QTableWidget, tbl_name) tbl.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch) self._tables.append(tbl) tbl.itemSelectionChanged.connect(self._on_select) self.ui.tabWidget.currentChanged.connect(lambda i: self._set_active_index(i))
def setupUi(self, UniqueViewer): UniqueViewer.setObjectName("UniqueViewer") UniqueViewer.resize(407, 544) self.verticalLayout = QtWidgets.QVBoxLayout(UniqueViewer) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName("verticalLayout") self.verticalLayout_2 = QtWidgets.QVBoxLayout() self.verticalLayout_2.setSpacing(0) self.verticalLayout_2.setObjectName("verticalLayout_2") self.verticalLayout_3 = QtWidgets.QVBoxLayout() self.verticalLayout_3.setContentsMargins(4, -1, 4, -1) self.verticalLayout_3.setSpacing(1) self.verticalLayout_3.setObjectName("verticalLayout_3") self.label_inform = QtWidgets.QLabel(UniqueViewer) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_inform.sizePolicy().hasHeightForWidth()) self.label_inform.setSizePolicy(sizePolicy) self.label_inform.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) self.label_inform.setObjectName("label_inform") self.verticalLayout_3.addWidget(self.label_inform) self.progress_bar = QtWidgets.QProgressBar(UniqueViewer) self.progress_bar.setMaximum(0) self.progress_bar.setProperty("value", 0) self.progress_bar.setObjectName("progress_bar") self.verticalLayout_3.addWidget(self.progress_bar) self.verticalLayout_2.addLayout(self.verticalLayout_3) self.tableWidget = QtWidgets.QTableWidget(UniqueViewer) self.tableWidget.setAlternatingRowColors(True) self.tableWidget.setShowGrid(False) self.tableWidget.setCornerButtonEnabled(False) self.tableWidget.setObjectName("tableWidget") self.tableWidget.setColumnCount(0) self.tableWidget.setRowCount(0) self.tableWidget.horizontalHeader().setSortIndicatorShown(True) self.tableWidget.horizontalHeader().setStretchLastSection(True) self.verticalLayout_2.addWidget(self.tableWidget) spacerItem = QtWidgets.QSpacerItem(20, 0, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.verticalLayout_2.addItem(spacerItem) self.verticalLayout_2.setStretch(1, 1) self.verticalLayout.addLayout(self.verticalLayout_2) self.buttonBox = QtWidgets.QDialogButtonBox(UniqueViewer) self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Save) self.buttonBox.setObjectName("buttonBox") self.verticalLayout.addWidget(self.buttonBox) self.retranslateUi(UniqueViewer) QtCore.QMetaObject.connectSlotsByName(UniqueViewer)
def setupUi(self, RegexDialog): RegexDialog.setObjectName("RegexDialog") RegexDialog.resize(640, 480) self.verticalLayout = QtWidgets.QVBoxLayout(RegexDialog) self.verticalLayout.setObjectName("verticalLayout") self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.edit_regex = QtWidgets.QLineEdit(RegexDialog) self.edit_regex.setObjectName("edit_regex") self.gridLayout.addWidget(self.edit_regex, 1, 0, 1, 1) self.edit_test_string = QtWidgets.QLineEdit(RegexDialog) self.edit_test_string.setObjectName("edit_test_string") self.gridLayout.addWidget(self.edit_test_string, 4, 0, 1, 1) self.label = QtWidgets.QLabel(RegexDialog) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 0, 1, 1) self.label_3 = QtWidgets.QLabel(RegexDialog) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 0, 1, 1, 1) self.text_cheatsheet = QtWidgets.QTextBrowser(RegexDialog) self.text_cheatsheet.setObjectName("text_cheatsheet") self.gridLayout.addWidget(self.text_cheatsheet, 6, 0, 1, 2) self.label_2 = QtWidgets.QLabel(RegexDialog) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 3, 0, 1, 1) spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem, 5, 0, 1, 1) self.table_groups = QtWidgets.QTableWidget(RegexDialog) self.table_groups.setColumnCount(1) self.table_groups.setObjectName("table_groups") self.table_groups.setRowCount(0) self.table_groups.horizontalHeader().setVisible(False) self.table_groups.horizontalHeader().setStretchLastSection(True) self.gridLayout.addWidget(self.table_groups, 1, 1, 5, 1) self.label_error = QtWidgets.QLabel(RegexDialog) self.label_error.setText("") self.label_error.setObjectName("label_error") self.gridLayout.addWidget(self.label_error, 2, 0, 1, 1) self.gridLayout.setColumnStretch(0, 3) self.gridLayout.setColumnStretch(1, 2) self.verticalLayout.addLayout(self.gridLayout) self.label.setBuddy(self.edit_regex) self.label_2.setBuddy(self.edit_test_string) self.retranslateUi(RegexDialog) QtCore.QMetaObject.connectSlotsByName(RegexDialog)
def __init__(self, text, columns = None, parent = None): """ Initialization of the CfgTable class (editable 2D table). @param text: text string associated with the table @param columns: string list containing all the columns names """ QWidget.__init__(self, parent) self.tablewidget = QTableWidget(parent) self.tablewidget.setSelectionBehavior(QAbstractItemView.SelectRows) if isinstance(columns, (list, tuple)): self.setSpec({'string_list': columns, 'comment': ''}) else: self.keys = [] #No columns yet self.tablewidget.horizontalHeader().setStretchLastSection(True) self.tablewidget.horizontalHeader().sectionClicked.connect(self.tablewidget.clearSelection) #Allow to unselect the lines by clicking on the column name (useful to add a line at the end) self.label = QLabel(text, parent) self.button_add = QPushButton(QIcon(QPixmap(":/images/list-add.png")), "") self.button_remove = QPushButton(QIcon(QPixmap(":/images/list-remove.png")), "") self.button_add.clicked.connect(self.appendLine) self.button_remove.clicked.connect(self.removeLine) self.layout_button = QVBoxLayout(); self.layout_button.addWidget(self.button_add) self.layout_button.addWidget(self.button_remove) self.layout_table = QHBoxLayout(); #self.tablewidget.setSizePolicy(size_policy) self.layout_table.addWidget(self.tablewidget) self.layout_table.addLayout(self.layout_button) self.layout = QVBoxLayout(parent); self.layout.addWidget(self.label) self.layout.addLayout(self.layout_table) self.setLayout(self.layout) #Ensure that the table always expand to the maximum available space size_policy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) size_policy.setVerticalStretch(10) size_policy.setHorizontalStretch(10) self.setSizePolicy(size_policy)
def setupUi(self, TabWidget): TabWidget.setObjectName("TabWidget") TabWidget.resize(659, 496) self.tab_BreakpointInfo = QtWidgets.QWidget() self.tab_BreakpointInfo.setObjectName("tab_BreakpointInfo") self.gridLayout_2 = QtWidgets.QGridLayout(self.tab_BreakpointInfo) self.gridLayout_2.setObjectName("gridLayout_2") self.tableWidget_BreakpointInfo = QtWidgets.QTableWidget(self.tab_BreakpointInfo) self.tableWidget_BreakpointInfo.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) self.tableWidget_BreakpointInfo.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection) self.tableWidget_BreakpointInfo.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) self.tableWidget_BreakpointInfo.setObjectName("tableWidget_BreakpointInfo") self.tableWidget_BreakpointInfo.setColumnCount(9) self.tableWidget_BreakpointInfo.setRowCount(0) item = QtWidgets.QTableWidgetItem() self.tableWidget_BreakpointInfo.setHorizontalHeaderItem(0, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_BreakpointInfo.setHorizontalHeaderItem(1, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_BreakpointInfo.setHorizontalHeaderItem(2, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_BreakpointInfo.setHorizontalHeaderItem(3, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_BreakpointInfo.setHorizontalHeaderItem(4, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_BreakpointInfo.setHorizontalHeaderItem(5, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_BreakpointInfo.setHorizontalHeaderItem(6, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_BreakpointInfo.setHorizontalHeaderItem(7, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_BreakpointInfo.setHorizontalHeaderItem(8, item) self.tableWidget_BreakpointInfo.horizontalHeader().setStretchLastSection(True) self.tableWidget_BreakpointInfo.verticalHeader().setVisible(False) self.tableWidget_BreakpointInfo.verticalHeader().setDefaultSectionSize(16) self.tableWidget_BreakpointInfo.verticalHeader().setMinimumSectionSize(16) self.gridLayout_2.addWidget(self.tableWidget_BreakpointInfo, 0, 0, 1, 1) TabWidget.addTab(self.tab_BreakpointInfo, "") self.tab_RawBreakpointInfo = QtWidgets.QWidget() self.tab_RawBreakpointInfo.setObjectName("tab_RawBreakpointInfo") self.gridLayout = QtWidgets.QGridLayout(self.tab_RawBreakpointInfo) self.gridLayout.setObjectName("gridLayout") self.textBrowser_BreakpointInfo = QtWidgets.QTextBrowser(self.tab_RawBreakpointInfo) self.textBrowser_BreakpointInfo.setObjectName("textBrowser_BreakpointInfo") self.gridLayout.addWidget(self.textBrowser_BreakpointInfo, 0, 0, 1, 1) TabWidget.addTab(self.tab_RawBreakpointInfo, "") self.retranslateUi(TabWidget) TabWidget.setCurrentIndex(0) QtCore.QMetaObject.connectSlotsByName(TabWidget)
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(1025, 530) Form.setToolTip("") self.gridLayout = QtWidgets.QGridLayout(Form) self.gridLayout.setObjectName("gridLayout") self.splitter = QtWidgets.QSplitter(Form) self.splitter.setOrientation(QtCore.Qt.Horizontal) self.splitter.setObjectName("splitter") self.layoutWidget = QtWidgets.QWidget(self.splitter) self.layoutWidget.setObjectName("layoutWidget") self.verticalLayout = QtWidgets.QVBoxLayout(self.layoutWidget) self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.lineEdit_Regex = QtWidgets.QLineEdit(self.layoutWidget) self.lineEdit_Regex.setObjectName("lineEdit_Regex") self.horizontalLayout_2.addWidget(self.lineEdit_Regex) self.checkBox_IgnoreCase = QtWidgets.QCheckBox(self.layoutWidget) self.checkBox_IgnoreCase.setChecked(True) self.checkBox_IgnoreCase.setObjectName("checkBox_IgnoreCase") self.horizontalLayout_2.addWidget(self.checkBox_IgnoreCase) self.checkBox_Regex = QtWidgets.QCheckBox(self.layoutWidget) self.checkBox_Regex.setObjectName("checkBox_Regex") self.horizontalLayout_2.addWidget(self.checkBox_Regex) self.pushButton_Search = QtWidgets.QPushButton(self.layoutWidget) self.pushButton_Search.setObjectName("pushButton_Search") self.horizontalLayout_2.addWidget(self.pushButton_Search) self.verticalLayout.addLayout(self.horizontalLayout_2) self.tableWidget_References = QtWidgets.QTableWidget(self.layoutWidget) self.tableWidget_References.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) self.tableWidget_References.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection) self.tableWidget_References.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) self.tableWidget_References.setObjectName("tableWidget_References") self.tableWidget_References.setColumnCount(2) self.tableWidget_References.setRowCount(0) item = QtWidgets.QTableWidgetItem() self.tableWidget_References.setHorizontalHeaderItem(0, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_References.setHorizontalHeaderItem(1, item) self.tableWidget_References.horizontalHeader().setStretchLastSection(True) self.tableWidget_References.verticalHeader().setVisible(False) self.tableWidget_References.verticalHeader().setDefaultSectionSize(16) self.tableWidget_References.verticalHeader().setMinimumSectionSize(16) self.verticalLayout.addWidget(self.tableWidget_References) self.listWidget_Referrers = QtWidgets.QListWidget(self.splitter) self.listWidget_Referrers.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) self.listWidget_Referrers.setObjectName("listWidget_Referrers") self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(640, 555) self.gridLayout = QtWidgets.QGridLayout(Form) self.gridLayout.setObjectName("gridLayout") self.tableWidget_SymbolInfo = QtWidgets.QTableWidget(Form) self.tableWidget_SymbolInfo.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) self.tableWidget_SymbolInfo.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection) self.tableWidget_SymbolInfo.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) self.tableWidget_SymbolInfo.setObjectName("tableWidget_SymbolInfo") self.tableWidget_SymbolInfo.setColumnCount(2) self.tableWidget_SymbolInfo.setRowCount(0) item = QtWidgets.QTableWidgetItem() self.tableWidget_SymbolInfo.setHorizontalHeaderItem(0, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_SymbolInfo.setHorizontalHeaderItem(1, item) self.tableWidget_SymbolInfo.horizontalHeader().setStretchLastSection(True) self.tableWidget_SymbolInfo.verticalHeader().setVisible(False) self.tableWidget_SymbolInfo.verticalHeader().setDefaultSectionSize(20) self.tableWidget_SymbolInfo.verticalHeader().setMinimumSectionSize(20) self.gridLayout.addWidget(self.tableWidget_SymbolInfo, 2, 0, 1, 1) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.lineEdit_SearchInput = QtWidgets.QLineEdit(Form) self.lineEdit_SearchInput.setObjectName("lineEdit_SearchInput") self.horizontalLayout.addWidget(self.lineEdit_SearchInput) self.checkBox_IgnoreCase = QtWidgets.QCheckBox(Form) self.checkBox_IgnoreCase.setChecked(True) self.checkBox_IgnoreCase.setObjectName("checkBox_IgnoreCase") self.horizontalLayout.addWidget(self.checkBox_IgnoreCase) self.pushButton_Search = QtWidgets.QPushButton(Form) self.pushButton_Search.setObjectName("pushButton_Search") self.horizontalLayout.addWidget(self.pushButton_Search) self.pushButton_Help = QtWidgets.QPushButton(Form) self.pushButton_Help.setText("") self.pushButton_Help.setObjectName("pushButton_Help") self.horizontalLayout.addWidget(self.pushButton_Help) self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1) self.textBrowser_AddressInfo = QtWidgets.QTextBrowser(Form) self.textBrowser_AddressInfo.setObjectName("textBrowser_AddressInfo") self.gridLayout.addWidget(self.textBrowser_AddressInfo, 1, 0, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, TabWidget): TabWidget.setObjectName("TabWidget") TabWidget.resize(400, 300) self.FPU = QtWidgets.QWidget() self.FPU.setObjectName("FPU") self.gridLayout = QtWidgets.QGridLayout(self.FPU) self.gridLayout.setObjectName("gridLayout") self.tableWidget_FPU = QtWidgets.QTableWidget(self.FPU) self.tableWidget_FPU.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) self.tableWidget_FPU.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection) self.tableWidget_FPU.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) self.tableWidget_FPU.setObjectName("tableWidget_FPU") self.tableWidget_FPU.setColumnCount(2) self.tableWidget_FPU.setRowCount(0) item = QtWidgets.QTableWidgetItem() self.tableWidget_FPU.setHorizontalHeaderItem(0, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_FPU.setHorizontalHeaderItem(1, item) self.tableWidget_FPU.horizontalHeader().setStretchLastSection(True) self.tableWidget_FPU.verticalHeader().setVisible(False) self.gridLayout.addWidget(self.tableWidget_FPU, 0, 0, 1, 1) TabWidget.addTab(self.FPU, "") self.XMM = QtWidgets.QWidget() self.XMM.setObjectName("XMM") self.gridLayout_2 = QtWidgets.QGridLayout(self.XMM) self.gridLayout_2.setObjectName("gridLayout_2") self.tableWidget_XMM = QtWidgets.QTableWidget(self.XMM) self.tableWidget_XMM.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) self.tableWidget_XMM.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection) self.tableWidget_XMM.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) self.tableWidget_XMM.setObjectName("tableWidget_XMM") self.tableWidget_XMM.setColumnCount(2) self.tableWidget_XMM.setRowCount(0) item = QtWidgets.QTableWidgetItem() self.tableWidget_XMM.setHorizontalHeaderItem(0, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_XMM.setHorizontalHeaderItem(1, item) self.tableWidget_XMM.horizontalHeader().setStretchLastSection(True) self.tableWidget_XMM.verticalHeader().setVisible(False) self.gridLayout_2.addWidget(self.tableWidget_XMM, 0, 0, 1, 1) TabWidget.addTab(self.XMM, "") self.retranslateUi(TabWidget) TabWidget.setCurrentIndex(0) QtCore.QMetaObject.connectSlotsByName(TabWidget)
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(684, 539) self.gridLayout = QtWidgets.QGridLayout(Form) self.gridLayout.setObjectName("gridLayout") self.tableWidget_MemoryRegions = QtWidgets.QTableWidget(Form) self.tableWidget_MemoryRegions.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) self.tableWidget_MemoryRegions.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection) self.tableWidget_MemoryRegions.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) self.tableWidget_MemoryRegions.setObjectName("tableWidget_MemoryRegions") self.tableWidget_MemoryRegions.setColumnCount(13) self.tableWidget_MemoryRegions.setRowCount(0) item = QtWidgets.QTableWidgetItem() self.tableWidget_MemoryRegions.setHorizontalHeaderItem(0, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_MemoryRegions.setHorizontalHeaderItem(1, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_MemoryRegions.setHorizontalHeaderItem(2, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_MemoryRegions.setHorizontalHeaderItem(3, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_MemoryRegions.setHorizontalHeaderItem(4, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_MemoryRegions.setHorizontalHeaderItem(5, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_MemoryRegions.setHorizontalHeaderItem(6, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_MemoryRegions.setHorizontalHeaderItem(7, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_MemoryRegions.setHorizontalHeaderItem(8, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_MemoryRegions.setHorizontalHeaderItem(9, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_MemoryRegions.setHorizontalHeaderItem(10, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_MemoryRegions.setHorizontalHeaderItem(11, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_MemoryRegions.setHorizontalHeaderItem(12, item) self.tableWidget_MemoryRegions.horizontalHeader().setStretchLastSection(True) self.tableWidget_MemoryRegions.verticalHeader().setVisible(False) self.tableWidget_MemoryRegions.verticalHeader().setDefaultSectionSize(16) self.tableWidget_MemoryRegions.verticalHeader().setMinimumSectionSize(16) self.gridLayout.addWidget(self.tableWidget_MemoryRegions, 0, 0, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(549, 437) self.gridLayout = QtWidgets.QGridLayout(Form) self.gridLayout.setObjectName("gridLayout") self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.pushButton_Stop = QtWidgets.QPushButton(Form) self.pushButton_Stop.setObjectName("pushButton_Stop") self.horizontalLayout.addWidget(self.pushButton_Stop) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.comboBox_ValueType = QtWidgets.QComboBox(Form) self.comboBox_ValueType.setToolTip("") self.comboBox_ValueType.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents) self.comboBox_ValueType.setObjectName("comboBox_ValueType") self.horizontalLayout.addWidget(self.comboBox_ValueType) self.gridLayout.addLayout(self.horizontalLayout, 3, 0, 1, 1) self.tableWidget_TrackInfo = QtWidgets.QTableWidget(Form) self.tableWidget_TrackInfo.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) self.tableWidget_TrackInfo.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection) self.tableWidget_TrackInfo.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) self.tableWidget_TrackInfo.setObjectName("tableWidget_TrackInfo") self.tableWidget_TrackInfo.setColumnCount(4) self.tableWidget_TrackInfo.setRowCount(0) item = QtWidgets.QTableWidgetItem() self.tableWidget_TrackInfo.setHorizontalHeaderItem(0, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_TrackInfo.setHorizontalHeaderItem(1, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_TrackInfo.setHorizontalHeaderItem(2, item) item = QtWidgets.QTableWidgetItem() self.tableWidget_TrackInfo.setHorizontalHeaderItem(3, item) self.tableWidget_TrackInfo.horizontalHeader().setStretchLastSection(True) self.tableWidget_TrackInfo.verticalHeader().setVisible(False) self.tableWidget_TrackInfo.verticalHeader().setDefaultSectionSize(16) self.tableWidget_TrackInfo.verticalHeader().setMinimumSectionSize(16) self.gridLayout.addWidget(self.tableWidget_TrackInfo, 0, 0, 1, 1) self.label_Info = QtWidgets.QLabel(Form) self.label_Info.setText("") self.label_Info.setAlignment(QtCore.Qt.AlignCenter) self.label_Info.setObjectName("label_Info") self.gridLayout.addWidget(self.label_Info, 1, 0, 1, 1) self.label_AdditionalInfo = QtWidgets.QLabel(Form) self.label_AdditionalInfo.setAlignment(QtCore.Qt.AlignCenter) self.label_AdditionalInfo.setObjectName("label_AdditionalInfo") self.gridLayout.addWidget(self.label_AdditionalInfo, 2, 0, 1, 1) self.retranslateUi(Form) self.comboBox_ValueType.setCurrentIndex(-1) QtCore.QMetaObject.connectSlotsByName(Form)
def __init__(self): QWidgetSavePos.__init__(self,"contacts") self.setFixedSize(750, 400) self.setWindowIcon(QIcon_load("contact")) self.setWindowTitle(_("Edit contacts")+" (www.gpvdm.com)") self.main_vbox = QVBoxLayout() toolbar=QToolBar() toolbar.setIconSize(QSize(48, 48)) add = QAction(QIcon_load("list-add"), _("Add contact"), self) add.triggered.connect(self.on_add_clicked) toolbar.addAction(add) remove = QAction(QIcon_load("list-remove"), _("Remove contacts"), self) remove.triggered.connect(self.on_remove_clicked) toolbar.addAction(remove) spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) toolbar.addWidget(spacer) self.help = QAction(QIcon_load("help"), _("Help"), self) self.help.setStatusTip(_("Close")) self.help.triggered.connect(self.callback_help) toolbar.addAction(self.help) self.main_vbox.addWidget(toolbar) self.tab = QTableWidget() self.tab.resizeColumnsToContents() self.tab.verticalHeader().setVisible(False) self.tab.clear() self.tab.setColumnCount(7) self.tab.setSelectionBehavior(QAbstractItemView.SelectRows) self.load() self.tab.cellChanged.connect(self.tab_changed) self.main_vbox.addWidget(self.tab) self.setLayout(self.main_vbox)
def __init__(self): QWidget.__init__(self) self.setWindowTitle(_("Fit variables duplicate window")+" - https://www.gpvdm.com") self.setWindowIcon(QIcon_load("duplicate")) self.vbox=QVBoxLayout() toolbar=QToolBar() toolbar.setIconSize(QSize(32, 32)) self.tb_save = QAction(QIcon_load("list-add"), _("Add"), self) self.tb_save.triggered.connect(self.callback_add_item) toolbar.addAction(self.tb_save) self.tb_save = QAction(QIcon_load("list-remove"), _("Minus"), self) self.tb_save.triggered.connect(self.callback_delete_item) toolbar.addAction(self.tb_save) self.tb_down= QAction(QIcon_load("go-down"), _("Move down"), self) self.tb_down.triggered.connect(self.on_move_down) toolbar.addAction(self.tb_down) self.tb_up= QAction(QIcon_load("go-up"), _("Move up"), self) self.tb_up.triggered.connect(self.on_move_up) toolbar.addAction(self.tb_up) self.vbox.addWidget(toolbar) self.tab = QTableWidget() self.tab.resizeColumnsToContents() self.tab.verticalHeader().setVisible(False) self.create_model() self.tab.cellChanged.connect(self.tab_changed) self.select_param_window_src=select_param() self.select_param_window_src.init(self.tab) self.select_param_window_src.set_save_function(self.save_combo) self.select_param_window_src.file_name_tab_pos=1 self.select_param_window_src.token_tab_pos=2 self.select_param_window_src.path_tab_pos=3 self.select_param_window_dest=select_param() self.select_param_window_dest.init(self.tab) self.select_param_window_dest.set_save_function(self.save_combo) self.select_param_window_dest.file_name_tab_pos=4 self.select_param_window_dest.token_tab_pos=5 self.select_param_window_dest.path_tab_pos=6 self.vbox.addWidget(self.tab) self.setLayout(self.vbox)
def __init__(self): QWidgetSavePos.__init__(self,"layer_widget") self.setWindowTitle(_("Layer editor")+" https://www.gpvdm.com") self.setWindowIcon(QIcon_load("layers")) self.resize(800,500) self.cost_window=False self.main_vbox=QVBoxLayout() self.toolbar=QToolBar() self.toolbar.setIconSize(QSize(32, 32)) self.tb_add = QAction(QIcon_load("list-add"), _("Add device layer"), self) self.tb_add.triggered.connect(self.on_add_item_clicked) self.toolbar.addAction(self.tb_add) self.tb_remove = QAction(QIcon_load("list-remove"), _("Delete device layer"), self) self.tb_remove.triggered.connect(self.on_remove_item_clicked) self.toolbar.addAction(self.tb_remove) self.tb_down= QAction(QIcon_load("go-down"), _("Move device layer"), self) self.tb_down.triggered.connect(self.on_move_down) self.toolbar.addAction(self.tb_down) self.tb_up= QAction(QIcon_load("go-up"), _("Move device layer"), self) self.tb_up.triggered.connect(self.on_move_up) self.toolbar.addAction(self.tb_up) self.main_vbox.addWidget(self.toolbar) self.tab = QTableWidget() #self.tab.resizeColumnsToContents() self.tab.verticalHeader().setVisible(False) self.create_model() self.tab.cellChanged.connect(self.tab_changed) self.tab.itemSelectionChanged.connect(self.callback_tab_selection_changed) self.main_vbox.addWidget(self.tab) self.setLayout(self.main_vbox) self.tab.itemSelectionChanged.connect(self.layer_selection_changed)
def setupUi(self, Downloader): Downloader.setObjectName("Downloader") Downloader.resize(829, 480) Downloader.setStyleSheet("background-color:#301010;") self.centralwidget = QtWidgets.QWidget(Downloader) self.centralwidget.setObjectName("centralwidget") self.gridLayout_2 = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout_2.setObjectName("gridLayout_2") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.tableWidget = QtWidgets.QTableWidget(self.centralwidget) self.tableWidget.setStyleSheet("background-color:#481616; color:grey") self.tableWidget.setObjectName("tableWidget") self.tableWidget.setColumnCount(6) self.tableWidget.setRowCount(0) item = QtWidgets.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(0, item) item = QtWidgets.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(1, item) item = QtWidgets.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(2, item) item = QtWidgets.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(3, item) item = QtWidgets.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(4, item) item = QtWidgets.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(5, item) self.horizontalLayout.addWidget(self.tableWidget) self.verticalLayout.addLayout(self.horizontalLayout) self.pbar = QtWidgets.QProgressBar(self.centralwidget) self.pbar.setProperty("value", 0) self.pbar.setObjectName("pbar") self.verticalLayout.addWidget(self.pbar) self.gridLayout_2.addLayout(self.verticalLayout, 0, 0, 1, 1) Downloader.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(Downloader) self.menubar.setGeometry(QtCore.QRect(0, 0, 829, 22)) self.menubar.setObjectName("menubar") Downloader.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(Downloader) self.statusbar.setObjectName("statusbar") Downloader.setStatusBar(self.statusbar) self.retranslateUi(Downloader) QtCore.QMetaObject.connectSlotsByName(Downloader)
def __init__(self, parent=None, mode=0): QtWidgets.QMainWindow.__init__(self, parent) #------------------------------ # class variables #------------------------------ self.version = '0.1' self.date = '2017.01.01' self.log = 'no version log in user class' self.help = 'no help guide in user class' self.uiList={} # for ui obj storage self.memoData = {} # key based variable data storage self.memoData['font_size_default'] = QtGui.QFont().pointSize() self.memoData['font_size'] = self.memoData['font_size_default'] self.memoData['last_export'] = '' self.memoData['last_import'] = '' self.name = self.__class__.__name__ self.location = '' if getattr(sys, 'frozen', False): # frozen - cx_freeze self.location = sys.executable else: # unfrozen self.location = os.path.realpath(sys.modules[self.__class__.__module__].__file__) self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png') self.iconPix = QtGui.QPixmap(self.iconPath) self.icon = QtGui.QIcon(self.iconPath) self.fileType='.{0}_EXT'.format(self.name) #------------------------------ # core function variable #------------------------------ self.qui_core_dict = { 'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout', 'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget', 'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox', 'txt': 'QTextEdit', 'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget', 'space': 'QSpacerItem', 'menu' : 'QMenu', 'menubar' : 'QMenuBar', } self.qui_user_dict = {}
def __init__(self, parent=None, mode=0): super_class.__init__(self, parent) #------------------------------ # class variables #------------------------------ self.version = "0.1" self.date = '2017.01.01' self.log = 'no version log in user class' self.help = 'no help guide in user class' self.uiList={} # for ui obj storage self.memoData = {} # key based variable data storage self.memoData['font_size_default'] = QtGui.QFont().pointSize() self.memoData['font_size'] = self.memoData['font_size_default'] self.memoData['last_export'] = '' self.memoData['last_import'] = '' self.location = "" if getattr(sys, 'frozen', False): # frozen - cx_freeze self.location = sys.executable else: # unfrozen self.location = os.path.realpath(sys.modules[self.__class__.__module__].__file__) self.name = self.__class__.__name__ self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png') self.iconPix = QtGui.QPixmap(self.iconPath) self.icon = QtGui.QIcon(self.iconPath) self.fileType='.{0}_EXT'.format(self.name) #------------------------------ # core function variable #------------------------------ self.qui_core_dict = { 'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout', 'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget', 'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox', 'txt': 'QTextEdit', 'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget', 'space': 'QSpacerItem', 'menu' : 'QMenu', 'menubar' : 'QMenuBar', } self.qui_user_dict = {} #------------------------------
def __init__(self, parent=None, mode=0): super_class.__init__(self, parent) #------------------------------ # class variables #------------------------------ self.version = "0.1" self.date = '2017.01.01' self.log = 'no version log in user class' self.help = 'no help guide in user class' self.uiList={} # for ui obj storage self.memoData = {} # key based variable data storage self.memoData['font_size_default'] = QtGui.QFont().pointSize() self.memoData['font_size'] = self.memoData['font_size_default'] self.location = "" if getattr(sys, 'frozen', False): # frozen - cx_freeze self.location = sys.executable else: # unfrozen self.location = os.path.realpath(sys.modules[self.__class__.__module__].__file__) self.name = self.__class__.__name__ self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png') self.iconPix = QtGui.QPixmap(self.iconPath) self.icon = QtGui.QIcon(self.iconPath) self.fileType='.{0}_EXT'.format(self.name) #------------------------------ # core function variable #------------------------------ self.qui_core_dict = { 'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout', 'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget', 'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox', 'txt': 'QTextEdit', 'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget', 'space': 'QSpacerItem', 'menu' : 'QMenu', 'menubar' : 'QMenuBar', } self.qui_user_dict = {} #------------------------------
def load_trace(self): filename = QtWidgets.QFileDialog.getOpenFileName()[0] filepath = Path(filename) if filepath.exists() and filepath.isfile(): trace = Trace(filename) try: # ==== Gui stuff self.loading_stat.setVisible(True) self.progressbar_loading.setVisible(True) self.progressbar_loading.reset() self.progressbar_loading.setMaximum(filepath.getsize()) newtable = QtWidgets.QTableWidget(self) newtable.verticalHeader().setVisible(False) newtable.setColumnCount(len(self.trace_header_table)) newtable.setHorizontalHeaderLabels(self.trace_header_table) newtable.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch) newtable.currentItemChanged.connect(self.update_instruction_informations) newtable.itemDoubleClicked.connect(self.go_to_instruction) index = self.traces_tab.addTab(newtable, filepath.name) id = self.parent.add_trace(trace) self.id_map[index] = id self.index_map[index] = newtable self.traces_tab.setCurrentIndex(index) # ===== total_instr = 0 nb_row = 0 current_size = 0 for chk, sz_chk, i, j, sz in trace.parse_file_generator(filename): total_instr += j-i current_size += sz self.loading_stat.setText("Chunk nb:"+str(chk)+" | Instr nb:"+str(total_instr)) self.loading_stat.adjustSize() self.progressbar_loading.setValue(current_size) newtable.setRowCount(nb_row+sz_chk) self.add_chunk_trace_table(newtable, trace, i, nb_row) nb_row += sz_chk newtable.scrollToBottom() self.trace_switch(index) # ===== Gui stuff newtable.scrollToTop() self.loading_stat.setVisible(False) self.progressbar_loading.setVisible(False) # ============ except DecodeError: print "Fail to parse the given trace" else: print "File not existing or not a file"