class QServiceList(QWidget): server_changed = Signal(Server) # GUI tree: QTreeWidget services: ServiceListModel def __init__(self, services, parent=None): super().__init__(parent) self.services = services self.init_ui() self.translate() def init_ui(self): self.setLayout(QHBoxLayout()) self.tree = QTreeView(self) self.tree.setModel(self.services) # self.tree.setHeaderHidden(True) self.layout().addWidget(self.tree) def translate(self): pass
def init_ui(self): self.setLayout(QHBoxLayout()) self.tree = QTreeView(self) self.tree.setModel(self.services) # self.tree.setHeaderHidden(True) self.layout().addWidget(self.tree)
def __init__(self, parent, view, data): QTreeView.__init__(self, parent) FilterTarget.__init__(self) self.data = data self.parent = parent self.view = view # Allow view-specific shortcuts when exports are focused self.actionHandler = UIActionHandler() self.actionHandler.setupActionHandler(self) self.actionHandler.setActionContext(lambda: self.view.actionContext()) self.model = GenericExportsModel(self.data) self.setModel(self.model) self.setRootIsDecorated(False) self.setUniformRowHeights(True) self.setSortingEnabled(True) self.sortByColumn(0, Qt.AscendingOrder) if self.model.ordinal_col is not None: self.setColumnWidth(self.model.ordinal_col, 55) self.setFont(binaryninjaui.getMonospaceFont(self)) self.selectionModel().currentChanged.connect(self.exportSelected) self.doubleClicked.connect(self.exportDoubleClicked)
def setupUi(self, HoldingsWidget): if not HoldingsWidget.objectName(): HoldingsWidget.setObjectName(u"HoldingsWidget") HoldingsWidget.resize(1066, 589) self.verticalLayout = QVBoxLayout(HoldingsWidget) self.verticalLayout.setSpacing(0) self.verticalLayout.setObjectName(u"verticalLayout") self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.HoldingsParamsFrame = QFrame(HoldingsWidget) self.HoldingsParamsFrame.setObjectName(u"HoldingsParamsFrame") self.HoldingsParamsFrame.setFrameShape(QFrame.Panel) self.HoldingsParamsFrame.setFrameShadow(QFrame.Sunken) self.horizontalLayout_8 = QHBoxLayout(self.HoldingsParamsFrame) self.horizontalLayout_8.setSpacing(6) self.horizontalLayout_8.setObjectName(u"horizontalLayout_8") self.horizontalLayout_8.setContentsMargins(2, 2, 2, 2) self.HoldingsDate = QDateEdit(self.HoldingsParamsFrame) self.HoldingsDate.setObjectName(u"HoldingsDate") self.HoldingsDate.setDateTime( QDateTime(QDate(2020, 11, 24), QTime(21, 0, 0))) self.HoldingsDate.setCalendarPopup(True) self.HoldingsDate.setTimeSpec(Qt.UTC) self.horizontalLayout_8.addWidget(self.HoldingsDate) self.HoldingsCurrencyLbl = QLabel(self.HoldingsParamsFrame) self.HoldingsCurrencyLbl.setObjectName(u"HoldingsCurrencyLbl") self.horizontalLayout_8.addWidget(self.HoldingsCurrencyLbl) self.HoldingsCurrencyCombo = CurrencyComboBox(self.HoldingsParamsFrame) self.HoldingsCurrencyCombo.setObjectName(u"HoldingsCurrencyCombo") self.horizontalLayout_8.addWidget(self.HoldingsCurrencyCombo) self.horizontalSpacer = QSpacerItem(1411, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout_8.addItem(self.horizontalSpacer) self.verticalLayout.addWidget(self.HoldingsParamsFrame) self.HoldingsTableView = QTreeView(HoldingsWidget) self.HoldingsTableView.setObjectName(u"HoldingsTableView") self.HoldingsTableView.setFrameShape(QFrame.Panel) self.HoldingsTableView.setAlternatingRowColors(True) self.HoldingsTableView.setAnimated(True) self.HoldingsTableView.setAllColumnsShowFocus(True) self.verticalLayout.addWidget(self.HoldingsTableView) self.retranslateUi(HoldingsWidget) QMetaObject.connectSlotsByName(HoldingsWidget)
def setupUi(self, IncomeSpendingReportWidget): if not IncomeSpendingReportWidget.objectName(): IncomeSpendingReportWidget.setObjectName( u"IncomeSpendingReportWidget") IncomeSpendingReportWidget.resize(595, 347) self.verticalLayout = QVBoxLayout(IncomeSpendingReportWidget) self.verticalLayout.setSpacing(0) self.verticalLayout.setObjectName(u"verticalLayout") self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.ReportParamsFrame = QFrame(IncomeSpendingReportWidget) self.ReportParamsFrame.setObjectName(u"ReportParamsFrame") self.ReportParamsFrame.setFrameShape(QFrame.Panel) self.ReportParamsFrame.setFrameShadow(QFrame.Sunken) self.horizontalLayout = QHBoxLayout(self.ReportParamsFrame) self.horizontalLayout.setSpacing(6) self.horizontalLayout.setObjectName(u"horizontalLayout") self.horizontalLayout.setContentsMargins(2, 2, 2, 2) self.ReportRange = DateRangeSelector(self.ReportParamsFrame) self.ReportRange.setObjectName(u"ReportRange") self.ReportRange.setProperty("ItemsList", u"QTD;YTD;this_year;last_year") self.horizontalLayout.addWidget(self.ReportRange) self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout.addItem(self.horizontalSpacer) self.verticalLayout.addWidget(self.ReportParamsFrame) self.ReportTreeView = QTreeView(IncomeSpendingReportWidget) self.ReportTreeView.setObjectName(u"ReportTreeView") self.ReportTreeView.setEditTriggers(QAbstractItemView.NoEditTriggers) self.ReportTreeView.setAlternatingRowColors(True) self.ReportTreeView.header().setStretchLastSection(False) self.verticalLayout.addWidget(self.ReportTreeView) self.retranslateUi(IncomeSpendingReportWidget) QMetaObject.connectSlotsByName(IncomeSpendingReportWidget)
def __init__(self, context): super(TriageFilePicker, self).__init__() self.context = context self.actionHandler = UIActionHandler() self.actionHandler.setupActionHandler(self) self.contextMenu = Menu() self.contextMenuManager = ContextMenuManager(self) layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) self.model = QFileSystemModel() self.model.setRootPath("") self.model.setFilter(QDir.AllEntries | QDir.Hidden | QDir.System) self.tree = QTreeView(self) self.tree.setModel(self.model) self.tree.setSelectionMode(QAbstractItemView.ExtendedSelection) self.tree.setColumnWidth(0, 500) layout.addWidget(self.tree, 1) self.setLayout(layout) self.tree.doubleClicked.connect(self.onDoubleClick) recentFile = QSettings().value("triage/recentFile", os.path.expanduser("~")) while len(recentFile) > 0: f = self.model.index(recentFile) if f.isValid(): self.tree.scrollTo(f) self.tree.setExpanded(f, True) break parentDir = os.path.dirname(recentFile) if parentDir == recentFile: break recentFile = parentDir self.actionHandler.bindAction("Open Selected Files", UIAction( lambda context: self.openSelectedFiles(), lambda context: self.areFilesSelected())) self.contextMenu.addAction("Open Selected Files", "Open")
def __init__(self, context, parent=None): super(Snippets, self).__init__(parent) # Create widgets self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) self.title = QLabel(self.tr("Snippet Editor")) self.saveButton = QPushButton(self.tr("&Save")) self.saveButton.setShortcut(QKeySequence(self.tr("Ctrl+S"))) self.runButton = QPushButton(self.tr("&Run")) self.runButton.setShortcut(QKeySequence(self.tr("Ctrl+R"))) self.closeButton = QPushButton(self.tr("Close")) self.clearHotkeyButton = QPushButton(self.tr("Clear Hotkey")) self.setWindowTitle(self.title.text()) #self.newFolderButton = QPushButton("New Folder") self.browseButton = QPushButton("Browse Snippets") self.browseButton.setIcon(QIcon.fromTheme("edit-undo")) self.deleteSnippetButton = QPushButton("Delete") self.newSnippetButton = QPushButton("New Snippet") indentation = Settings().get_string("snippets.indentation") if Settings().get_bool("snippets.syntaxHighlight"): self.edit = QCodeEditor(SyntaxHighlighter=Pylighter, delimeter=indentation) else: self.edit = QCodeEditor(SyntaxHighlighter=None, delimeter=indentation) self.edit.setPlaceholderText("python code") self.resetting = False self.columns = 3 self.context = context self.keySequenceEdit = QKeySequenceEdit(self) self.currentHotkey = QKeySequence() self.currentHotkeyLabel = QLabel("") self.currentFileLabel = QLabel() self.currentFile = "" self.snippetDescription = QLineEdit() self.snippetDescription.setPlaceholderText("optional description") #Set Editbox Size font = getMonospaceFont(self) self.edit.setFont(font) font = QFontMetrics(font) self.edit.setTabStopDistance( 4 * font.horizontalAdvance(' ')) #TODO, replace with settings API #Files self.files = QFileSystemModel() self.files.setRootPath(snippetPath) self.files.setNameFilters(["*.py"]) #Tree self.tree = QTreeView() self.tree.setModel(self.files) self.tree.setSortingEnabled(True) self.tree.hideColumn(2) self.tree.sortByColumn(0, Qt.AscendingOrder) self.tree.setRootIndex(self.files.index(snippetPath)) for x in range(self.columns): #self.tree.resizeColumnToContents(x) self.tree.header().setSectionResizeMode( x, QHeaderView.ResizeToContents) treeLayout = QVBoxLayout() treeLayout.addWidget(self.tree) treeButtons = QHBoxLayout() #treeButtons.addWidget(self.newFolderButton) treeButtons.addWidget(self.browseButton) treeButtons.addWidget(self.newSnippetButton) treeButtons.addWidget(self.deleteSnippetButton) treeLayout.addLayout(treeButtons) treeWidget = QWidget() treeWidget.setLayout(treeLayout) # Create layout and add widgets buttons = QHBoxLayout() buttons.addWidget(self.clearHotkeyButton) buttons.addWidget(self.keySequenceEdit) buttons.addWidget(self.currentHotkeyLabel) buttons.addWidget(self.closeButton) buttons.addWidget(self.runButton) buttons.addWidget(self.saveButton) description = QHBoxLayout() description.addWidget(QLabel(self.tr("Description: "))) description.addWidget(self.snippetDescription) vlayoutWidget = QWidget() vlayout = QVBoxLayout() vlayout.addLayout(description) vlayout.addWidget(self.edit) vlayout.addLayout(buttons) vlayoutWidget.setLayout(vlayout) hsplitter = QSplitter() hsplitter.addWidget(treeWidget) hsplitter.addWidget(vlayoutWidget) hlayout = QHBoxLayout() hlayout.addWidget(hsplitter) self.showNormal() #Fixes bug that maximized windows are "stuck" #Because you can't trust QT to do the right thing here if (sys.platform == "darwin"): self.settings = QSettings("Vector35", "Snippet Editor") else: self.settings = QSettings("Vector 35", "Snippet Editor") if self.settings.contains("ui/snippeteditor/geometry"): self.restoreGeometry( self.settings.value("ui/snippeteditor/geometry")) else: self.edit.setMinimumWidth(80 * font.averageCharWidth()) self.edit.setMinimumHeight(30 * font.lineSpacing()) # Set dialog layout self.setLayout(hlayout) # Add signals self.saveButton.clicked.connect(self.save) self.closeButton.clicked.connect(self.close) self.runButton.clicked.connect(self.run) self.clearHotkeyButton.clicked.connect(self.clearHotkey) self.tree.selectionModel().selectionChanged.connect(self.selectFile) self.newSnippetButton.clicked.connect(self.newFileDialog) self.deleteSnippetButton.clicked.connect(self.deleteSnippet) #self.newFolderButton.clicked.connect(self.newFolder) self.browseButton.clicked.connect(self.browseSnippets) if self.settings.contains("ui/snippeteditor/selected"): selectedName = self.settings.value("ui/snippeteditor/selected") self.tree.selectionModel().select( self.files.index(selectedName), QItemSelectionModel.ClearAndSelect | QItemSelectionModel.Rows) if self.tree.selectionModel().hasSelection(): self.selectFile(self.tree.selectionModel().selection(), None) self.edit.setFocus() cursor = self.edit.textCursor() cursor.setPosition(self.edit.document().characterCount() - 1) self.edit.setTextCursor(cursor) else: self.readOnly(True) else: self.readOnly(True)
class TriageFilePicker(QWidget): def __init__(self, context): super(TriageFilePicker, self).__init__() self.context = context self.actionHandler = UIActionHandler() self.actionHandler.setupActionHandler(self) self.contextMenu = Menu() self.contextMenuManager = ContextMenuManager(self) layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) self.model = QFileSystemModel() self.model.setRootPath("") self.model.setFilter(QDir.AllEntries | QDir.Hidden | QDir.System) self.tree = QTreeView(self) self.tree.setModel(self.model) self.tree.setSelectionMode(QAbstractItemView.ExtendedSelection) self.tree.setColumnWidth(0, 500) layout.addWidget(self.tree, 1) self.setLayout(layout) self.tree.doubleClicked.connect(self.onDoubleClick) recentFile = QSettings().value("triage/recentFile", os.path.expanduser("~")) while len(recentFile) > 0: f = self.model.index(recentFile) if f.isValid(): self.tree.scrollTo(f) self.tree.setExpanded(f, True) break parentDir = os.path.dirname(recentFile) if parentDir == recentFile: break recentFile = parentDir self.actionHandler.bindAction("Open Selected Files", UIAction( lambda context: self.openSelectedFiles(), lambda context: self.areFilesSelected())) self.contextMenu.addAction("Open Selected Files", "Open") def contextMenuEvent(self, event): self.contextMenuManager.show(self.contextMenu, self.actionHandler) def onDoubleClick(self, index): self.openSelectedFiles() def openSelectedFiles(self): failedToOpen = [] files = set() for index in self.tree.selectionModel().selectedIndexes(): if self.model.fileInfo(index).isFile(): files.add(self.model.fileInfo(index).absoluteFilePath()) for filename in files: QSettings().setValue("triage/recentFile", filename) f = FileContext.openFilename(filename) if not f: failedToOpen.append(filename) continue for data in f.getAllDataViews(): Settings().set_string("analysis.mode", Settings().get_string("triage.analysisMode"), data) Settings().set_bool("triage.preferSummaryView", True, data) if data.view_type != "Raw": linearSweepMode = Settings().get_string("triage.linearSweep") if linearSweepMode == "none": Settings().set_bool("analysis.linearSweep.autorun", False, data) elif linearSweepMode == "partial": Settings().set_bool("analysis.linearSweep.autorun", True, data) Settings().set_bool("analysis.linearSweep.controlFlowGraph", False, data) elif linearSweepMode == "full": Settings().set_bool("analysis.linearSweep.autorun", True, data) Settings().set_bool("analysis.linearSweep.controlFlowGraph", True, data) self.context.openFileContext(f) if len(failedToOpen) > 0: QMessageBox.critical(self, "Error", "Unable to open:\n" + "\n".join(failedToOpen)) def areFilesSelected(self): return self.tree.selectionModel().hasSelection()
class Window(QWidget): def __init__(self): super(Window, self).__init__() self.proxyModel = QSortFilterProxyModel() self.proxyModel.setDynamicSortFilter(True) self.sourceGroupBox = QGroupBox("Original Model") self.proxyGroupBox = QGroupBox("Sorted/Filtered Model") self.sourceView = QTreeView() self.sourceView.setRootIsDecorated(False) self.sourceView.setAlternatingRowColors(True) self.proxyView = QTreeView() self.proxyView.setRootIsDecorated(False) self.proxyView.setAlternatingRowColors(True) self.proxyView.setModel(self.proxyModel) self.proxyView.setSortingEnabled(True) self.sortCaseSensitivityCheckBox = QCheckBox("Case sensitive sorting") self.filterCaseSensitivityCheckBox = QCheckBox("Case sensitive filter") self.filterPatternLineEdit = QLineEdit() self.filterPatternLineEdit.setClearButtonEnabled(True) self.filterPatternLabel = QLabel("&Filter pattern:") self.filterPatternLabel.setBuddy(self.filterPatternLineEdit) self.filterSyntaxComboBox = QComboBox() self.filterSyntaxComboBox.addItem("Regular expression", REGULAR_EXPRESSION) self.filterSyntaxComboBox.addItem("Wildcard", WILDCARD) self.filterSyntaxComboBox.addItem("Fixed string", FIXED_STRING) self.filterSyntaxLabel = QLabel("Filter &syntax:") self.filterSyntaxLabel.setBuddy(self.filterSyntaxComboBox) self.filterColumnComboBox = QComboBox() self.filterColumnComboBox.addItem("Subject") self.filterColumnComboBox.addItem("Sender") self.filterColumnComboBox.addItem("Date") self.filterColumnLabel = QLabel("Filter &column:") self.filterColumnLabel.setBuddy(self.filterColumnComboBox) self.filterPatternLineEdit.textChanged.connect(self.filterRegExpChanged) self.filterSyntaxComboBox.currentIndexChanged.connect(self.filterRegExpChanged) self.filterColumnComboBox.currentIndexChanged.connect(self.filterColumnChanged) self.filterCaseSensitivityCheckBox.toggled.connect(self.filterRegExpChanged) self.sortCaseSensitivityCheckBox.toggled.connect(self.sortChanged) sourceLayout = QHBoxLayout() sourceLayout.addWidget(self.sourceView) self.sourceGroupBox.setLayout(sourceLayout) proxyLayout = QGridLayout() proxyLayout.addWidget(self.proxyView, 0, 0, 1, 3) proxyLayout.addWidget(self.filterPatternLabel, 1, 0) proxyLayout.addWidget(self.filterPatternLineEdit, 1, 1, 1, 2) proxyLayout.addWidget(self.filterSyntaxLabel, 2, 0) proxyLayout.addWidget(self.filterSyntaxComboBox, 2, 1, 1, 2) proxyLayout.addWidget(self.filterColumnLabel, 3, 0) proxyLayout.addWidget(self.filterColumnComboBox, 3, 1, 1, 2) proxyLayout.addWidget(self.filterCaseSensitivityCheckBox, 4, 0, 1, 2) proxyLayout.addWidget(self.sortCaseSensitivityCheckBox, 4, 2) self.proxyGroupBox.setLayout(proxyLayout) mainLayout = QVBoxLayout() mainLayout.addWidget(self.sourceGroupBox) mainLayout.addWidget(self.proxyGroupBox) self.setLayout(mainLayout) self.setWindowTitle("Basic Sort/Filter Model") self.resize(500, 450) self.proxyView.sortByColumn(1, Qt.AscendingOrder) self.filterColumnComboBox.setCurrentIndex(1) self.filterPatternLineEdit.setText("Andy|Grace") self.filterCaseSensitivityCheckBox.setChecked(True) self.sortCaseSensitivityCheckBox.setChecked(True) def setSourceModel(self, model): self.proxyModel.setSourceModel(model) self.sourceView.setModel(model) def filterRegExpChanged(self): syntax_nr = self.filterSyntaxComboBox.currentData() pattern = self.filterPatternLineEdit.text() if syntax_nr == WILDCARD: pattern = QRegularExpression.wildcardToRegularExpression(pattern) elif syntax_nr == FIXED_STRING: pattern = QRegularExpression.escape(pattern) regExp = QRegularExpression(pattern) if not self.filterCaseSensitivityCheckBox.isChecked(): options = regExp.patternOptions() options |= QRegularExpression.CaseInsensitiveOption regExp.setPatternOptions(options) self.proxyModel.setFilterRegularExpression(regExp) def filterColumnChanged(self): self.proxyModel.setFilterKeyColumn(self.filterColumnComboBox.currentIndex()) def sortChanged(self): if self.sortCaseSensitivityCheckBox.isChecked(): caseSensitivity = Qt.CaseSensitive else: caseSensitivity = Qt.CaseInsensitive self.proxyModel.setSortCaseSensitivity(caseSensitivity)
def __init__(self): super(Window, self).__init__() self.proxyModel = QSortFilterProxyModel() self.proxyModel.setDynamicSortFilter(True) self.sourceGroupBox = QGroupBox("Original Model") self.proxyGroupBox = QGroupBox("Sorted/Filtered Model") self.sourceView = QTreeView() self.sourceView.setRootIsDecorated(False) self.sourceView.setAlternatingRowColors(True) self.proxyView = QTreeView() self.proxyView.setRootIsDecorated(False) self.proxyView.setAlternatingRowColors(True) self.proxyView.setModel(self.proxyModel) self.proxyView.setSortingEnabled(True) self.sortCaseSensitivityCheckBox = QCheckBox("Case sensitive sorting") self.filterCaseSensitivityCheckBox = QCheckBox("Case sensitive filter") self.filterPatternLineEdit = QLineEdit() self.filterPatternLineEdit.setClearButtonEnabled(True) self.filterPatternLabel = QLabel("&Filter pattern:") self.filterPatternLabel.setBuddy(self.filterPatternLineEdit) self.filterSyntaxComboBox = QComboBox() self.filterSyntaxComboBox.addItem("Regular expression", REGULAR_EXPRESSION) self.filterSyntaxComboBox.addItem("Wildcard", WILDCARD) self.filterSyntaxComboBox.addItem("Fixed string", FIXED_STRING) self.filterSyntaxLabel = QLabel("Filter &syntax:") self.filterSyntaxLabel.setBuddy(self.filterSyntaxComboBox) self.filterColumnComboBox = QComboBox() self.filterColumnComboBox.addItem("Subject") self.filterColumnComboBox.addItem("Sender") self.filterColumnComboBox.addItem("Date") self.filterColumnLabel = QLabel("Filter &column:") self.filterColumnLabel.setBuddy(self.filterColumnComboBox) self.filterPatternLineEdit.textChanged.connect(self.filterRegExpChanged) self.filterSyntaxComboBox.currentIndexChanged.connect(self.filterRegExpChanged) self.filterColumnComboBox.currentIndexChanged.connect(self.filterColumnChanged) self.filterCaseSensitivityCheckBox.toggled.connect(self.filterRegExpChanged) self.sortCaseSensitivityCheckBox.toggled.connect(self.sortChanged) sourceLayout = QHBoxLayout() sourceLayout.addWidget(self.sourceView) self.sourceGroupBox.setLayout(sourceLayout) proxyLayout = QGridLayout() proxyLayout.addWidget(self.proxyView, 0, 0, 1, 3) proxyLayout.addWidget(self.filterPatternLabel, 1, 0) proxyLayout.addWidget(self.filterPatternLineEdit, 1, 1, 1, 2) proxyLayout.addWidget(self.filterSyntaxLabel, 2, 0) proxyLayout.addWidget(self.filterSyntaxComboBox, 2, 1, 1, 2) proxyLayout.addWidget(self.filterColumnLabel, 3, 0) proxyLayout.addWidget(self.filterColumnComboBox, 3, 1, 1, 2) proxyLayout.addWidget(self.filterCaseSensitivityCheckBox, 4, 0, 1, 2) proxyLayout.addWidget(self.sortCaseSensitivityCheckBox, 4, 2) self.proxyGroupBox.setLayout(proxyLayout) mainLayout = QVBoxLayout() mainLayout.addWidget(self.sourceGroupBox) mainLayout.addWidget(self.proxyGroupBox) self.setLayout(mainLayout) self.setWindowTitle("Basic Sort/Filter Model") self.resize(500, 450) self.proxyView.sortByColumn(1, Qt.AscendingOrder) self.filterColumnComboBox.setCurrentIndex(1) self.filterPatternLineEdit.setText("Andy|Grace") self.filterCaseSensitivityCheckBox.setChecked(True) self.sortCaseSensitivityCheckBox.setChecked(True)
#!/usr/bin/env python3 """ 【简介】 PySide6中 QTreeView 例子 """ import sys from PySide6.QtWidgets import QApplication, QTreeView, QFileSystemModel from PySide6.QtCore import QDir from PySide6.QtGui import * if __name__ == '__main__': app = QApplication(sys.argv) # Window系统提供的模式 model = QFileSystemModel() # QFileSystemModel 只有设置了setRootPath后才会起作用。 model.setRootPath('') # 创建一个QtreeView部件 tree = QTreeView() # 为部件添加模式 tree.setModel(model) tree.setWindowTitle("QTreeView 例子") tree.resize(500, 310) tree.show() sys.exit(app.exec())
def _setup_gui(self): # setup 3 widget model view : QTreeView - QListView - QListView self.dataset_tree_view, self.dataset_count_label, dataset_widget = self._setup_view_widget( QTreeView(), 'Dataset', self.dataset_model, self.select_dataset, -1) self.image_label_list_view, self.image_label_count_label, image_label_widget = self._setup_view_widget( QListView(), 'Label', self.label_model, self.select_label) self.image_list_view, self.image_count_label, image_widget = self._setup_view_widget( QListView(), 'Image', self.image_model, self.select_image) # configure QTreeView self.dataset_tree_view.header_hidden = False self.dataset_tree_view.horizontal_scroll_mode = QTreeView.ScrollPerPixel self.dataset_tree_view.horizontal_scroll_bar_policy = Qt.ScrollBarAsNeeded self.dataset_tree_view.selection_mode = QTreeView.SingleSelection self.dataset_tree_view.edit_triggers = QtWidgets.QAbstractItemView.NoEditTriggers # setup image view widget self.image_info_widget = KlustRImageInfoWidget() # layouting main widget view_widget = QWidget() view_layout = QHBoxLayout(view_widget) view_layout.add_widget(dataset_widget) view_layout.add_widget(image_label_widget) view_layout.add_widget(image_widget) view_splitter = QSplitter() view_splitter.orientation = Qt.Horizontal view_splitter.add_widget(view_widget) view_splitter.add_widget(self.image_info_widget) view_splitter.size_policy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.MinimumExpanding) # setup transformation filter widget self.filter_box = QGroupBox('Filter') self.filter_box.enabled = False self.translation_checkbox = QCheckBox('Translation') self.rotation_checkbox = QCheckBox('Rotation') self.scaling_checkbox = QCheckBox('Scaling') self.exclusive_checkbox = QCheckBox('Exclusive') self.translation_checkbox.checked = True self.rotation_checkbox.checked = True self.scaling_checkbox.checked = True self.exclusive_checkbox.checked = False # setup transformation filter widget filter_layout = QHBoxLayout(self.filter_box) filter_layout.add_widget(self.translation_checkbox) filter_layout.add_widget(self.rotation_checkbox) filter_layout.add_widget(self.scaling_checkbox) filter_layout.add_widget(self.exclusive_checkbox) filter_layout.add_stretch() # connect transformation filter widget self.translation_checkbox.stateChanged.connect(self._update_models) self.rotation_checkbox.stateChanged.connect(self._update_models) self.scaling_checkbox.stateChanged.connect(self._update_models) self.exclusive_checkbox.stateChanged.connect(self._update_models) # main layouting layout = QVBoxLayout(self) layout.add_widget(view_splitter) layout.add_widget(self.filter_box)
source_model.invisibleRootItem().appendRow(row) list.append("FancyTextNumber {}".format(i)) # Needed by QMLModelViewClient role_names = { Qt.DisplayRole: QByteArray(b'_text'), Qt.BackgroundRole: QByteArray(b'_color') } source_model.setItemRoleNames(role_names) roles = [Qt.DisplayRole, Qt.BackgroundRole] print("Creating registry host") node = QRemoteObjectRegistryHost(QUrl("local:registry")) node2 = QRemoteObjectHost(QUrl("local:replica"), QUrl("local:registry")) node2.enableRemoting(source_model, "RemoteModel", roles) view = QTreeView() view.setWindowTitle("SourceView") view.setModel(source_model) view.show() handler = TimerHandler(source_model) QTimer.singleShot(5000, handler.change_data) QTimer.singleShot(10000, handler.insert_data) QTimer.singleShot(11000, handler.change_flags) QTimer.singleShot(12000, handler.remove_data) QTimer.singleShot(13000, handler.move_data) sys.exit(app.exec_())
def setupUi(self, tfm): if not tfm.objectName(): tfm.setObjectName(u"tfm") tfm.resize(800, 600) tfm.setContextMenuPolicy(Qt.NoContextMenu) tfm.setLocale(QLocale(QLocale.English, QLocale.UnitedStates)) self.action_menu = QAction(tfm) self.action_menu.setObjectName(u"action_menu") self.action_new_dir = QAction(tfm) self.action_new_dir.setObjectName(u"action_new_dir") self.action_new_file = QAction(tfm) self.action_new_file.setObjectName(u"action_new_file") self.action_back = QAction(tfm) self.action_back.setObjectName(u"action_back") self.action_up = QAction(tfm) self.action_up.setObjectName(u"action_up") self.action_home = QAction(tfm) self.action_home.setObjectName(u"action_home") self.action_go = QAction(tfm) self.action_go.setObjectName(u"action_go") self.action_forward = QAction(tfm) self.action_forward.setObjectName(u"action_forward") self.action_copy = QAction(tfm) self.action_copy.setObjectName(u"action_copy") self.action_paste = QAction(tfm) self.action_paste.setObjectName(u"action_paste") self.action_cut = QAction(tfm) self.action_cut.setObjectName(u"action_cut") self.action_show_hidden = QAction(tfm) self.action_show_hidden.setObjectName(u"action_show_hidden") self.action_show_hidden.setCheckable(True) self.action_delete = QAction(tfm) self.action_delete.setObjectName(u"action_delete") self.action_rename = QAction(tfm) self.action_rename.setObjectName(u"action_rename") self.action_add_to_bookmarks = QAction(tfm) self.action_add_to_bookmarks.setObjectName(u"action_add_to_bookmarks") self.action_remove_bookmark = QAction(tfm) self.action_remove_bookmark.setObjectName(u"action_remove_bookmark") self.action_copy_path = QAction(tfm) self.action_copy_path.setObjectName(u"action_copy_path") self.action_extract_here = QAction(tfm) self.action_extract_here.setObjectName(u"action_extract_here") self.action_mount_iso = QAction(tfm) self.action_mount_iso.setObjectName(u"action_mount_iso") self.centralwidget = QWidget(tfm) self.centralwidget.setObjectName(u"centralwidget") self.horizontalLayout = QHBoxLayout(self.centralwidget) self.horizontalLayout.setObjectName(u"horizontalLayout") self.vsplit = QSplitter(self.centralwidget) self.vsplit.setObjectName(u"vsplit") self.vsplit.setOrientation(Qt.Horizontal) self.hsplit = QSplitter(self.vsplit) self.hsplit.setObjectName(u"hsplit") self.hsplit.setOrientation(Qt.Vertical) self.fs_tree = QTreeView(self.hsplit) self.fs_tree.setObjectName(u"fs_tree") sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth( self.fs_tree.sizePolicy().hasHeightForWidth()) self.fs_tree.setSizePolicy(sizePolicy) self.fs_tree.setTabKeyNavigation(True) self.fs_tree.setProperty("showDropIndicator", True) self.fs_tree.setDragEnabled(False) self.fs_tree.setDragDropMode(QAbstractItemView.DropOnly) self.fs_tree.setDefaultDropAction(Qt.MoveAction) self.fs_tree.setRootIsDecorated(False) self.hsplit.addWidget(self.fs_tree) self.fs_tree.header().setVisible(False) self.bookmark_view = QListView(self.hsplit) self.bookmark_view.setObjectName(u"bookmark_view") self.bookmark_view.setContextMenuPolicy(Qt.ActionsContextMenu) self.bookmark_view.setEditTriggers(QAbstractItemView.DoubleClicked | QAbstractItemView.EditKeyPressed | QAbstractItemView.SelectedClicked) self.bookmark_view.setTabKeyNavigation(True) self.bookmark_view.setDragDropOverwriteMode(True) self.bookmark_view.setDragDropMode(QAbstractItemView.DropOnly) self.bookmark_view.setDefaultDropAction(Qt.CopyAction) self.bookmark_view.setAlternatingRowColors(True) self.hsplit.addWidget(self.bookmark_view) self.mounts_view = QListView(self.hsplit) self.mounts_view.setObjectName(u"mounts_view") self.mounts_view.setTabKeyNavigation(True) self.mounts_view.setAlternatingRowColors(True) self.hsplit.addWidget(self.mounts_view) self.vsplit.addWidget(self.hsplit) self.table_view = QTableView(self.vsplit) self.table_view.setObjectName(u"table_view") sizePolicy1 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy1.setHorizontalStretch(1) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth( self.table_view.sizePolicy().hasHeightForWidth()) self.table_view.setSizePolicy(sizePolicy1) self.table_view.viewport().setProperty("cursor", QCursor(Qt.ArrowCursor)) self.table_view.setContextMenuPolicy(Qt.ActionsContextMenu) self.table_view.setAcceptDrops(True) self.table_view.setToolTipDuration(-3) self.table_view.setEditTriggers(QAbstractItemView.AnyKeyPressed | QAbstractItemView.EditKeyPressed | QAbstractItemView.SelectedClicked) self.table_view.setDragEnabled(True) self.table_view.setDragDropMode(QAbstractItemView.DragDrop) self.table_view.setDefaultDropAction(Qt.MoveAction) self.table_view.setAlternatingRowColors(True) self.table_view.setSelectionMode(QAbstractItemView.ExtendedSelection) self.table_view.setSelectionBehavior(QAbstractItemView.SelectRows) self.table_view.setTextElideMode(Qt.ElideMiddle) self.table_view.setShowGrid(False) self.table_view.setSortingEnabled(True) self.table_view.setWordWrap(False) self.vsplit.addWidget(self.table_view) self.table_view.horizontalHeader().setDefaultSectionSize(150) self.table_view.horizontalHeader().setHighlightSections(False) self.table_view.horizontalHeader().setStretchLastSection(True) self.table_view.verticalHeader().setVisible(False) self.horizontalLayout.addWidget(self.vsplit) tfm.setCentralWidget(self.centralwidget) self.statusbar = QStatusBar(tfm) self.statusbar.setObjectName(u"statusbar") self.statusbar.setContextMenuPolicy(Qt.NoContextMenu) self.statusbar.setSizeGripEnabled(False) tfm.setStatusBar(self.statusbar) self.toolbar = QToolBar(tfm) self.toolbar.setObjectName(u"toolbar") self.toolbar.setContextMenuPolicy(Qt.PreventContextMenu) self.toolbar.setMovable(False) tfm.addToolBar(Qt.TopToolBarArea, self.toolbar) self.toolbar.addAction(self.action_back) self.toolbar.addAction(self.action_forward) self.toolbar.addAction(self.action_up) self.toolbar.addAction(self.action_home) self.toolbar.addAction(self.action_go) self.retranslateUi(tfm) QMetaObject.connectSlotsByName(tfm)
class Snippets(QDialog): def __init__(self, context, parent=None): super(Snippets, self).__init__(parent) # Create widgets self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) self.title = QLabel(self.tr("Snippet Editor")) self.saveButton = QPushButton(self.tr("&Save")) self.saveButton.setShortcut(QKeySequence(self.tr("Ctrl+S"))) self.runButton = QPushButton(self.tr("&Run")) self.runButton.setShortcut(QKeySequence(self.tr("Ctrl+R"))) self.closeButton = QPushButton(self.tr("Close")) self.clearHotkeyButton = QPushButton(self.tr("Clear Hotkey")) self.setWindowTitle(self.title.text()) #self.newFolderButton = QPushButton("New Folder") self.browseButton = QPushButton("Browse Snippets") self.browseButton.setIcon(QIcon.fromTheme("edit-undo")) self.deleteSnippetButton = QPushButton("Delete") self.newSnippetButton = QPushButton("New Snippet") indentation = Settings().get_string("snippets.indentation") if Settings().get_bool("snippets.syntaxHighlight"): self.edit = QCodeEditor(SyntaxHighlighter=Pylighter, delimeter=indentation) else: self.edit = QCodeEditor(SyntaxHighlighter=None, delimeter=indentation) self.edit.setPlaceholderText("python code") self.resetting = False self.columns = 3 self.context = context self.keySequenceEdit = QKeySequenceEdit(self) self.currentHotkey = QKeySequence() self.currentHotkeyLabel = QLabel("") self.currentFileLabel = QLabel() self.currentFile = "" self.snippetDescription = QLineEdit() self.snippetDescription.setPlaceholderText("optional description") #Set Editbox Size font = getMonospaceFont(self) self.edit.setFont(font) font = QFontMetrics(font) self.edit.setTabStopDistance( 4 * font.horizontalAdvance(' ')) #TODO, replace with settings API #Files self.files = QFileSystemModel() self.files.setRootPath(snippetPath) self.files.setNameFilters(["*.py"]) #Tree self.tree = QTreeView() self.tree.setModel(self.files) self.tree.setSortingEnabled(True) self.tree.hideColumn(2) self.tree.sortByColumn(0, Qt.AscendingOrder) self.tree.setRootIndex(self.files.index(snippetPath)) for x in range(self.columns): #self.tree.resizeColumnToContents(x) self.tree.header().setSectionResizeMode( x, QHeaderView.ResizeToContents) treeLayout = QVBoxLayout() treeLayout.addWidget(self.tree) treeButtons = QHBoxLayout() #treeButtons.addWidget(self.newFolderButton) treeButtons.addWidget(self.browseButton) treeButtons.addWidget(self.newSnippetButton) treeButtons.addWidget(self.deleteSnippetButton) treeLayout.addLayout(treeButtons) treeWidget = QWidget() treeWidget.setLayout(treeLayout) # Create layout and add widgets buttons = QHBoxLayout() buttons.addWidget(self.clearHotkeyButton) buttons.addWidget(self.keySequenceEdit) buttons.addWidget(self.currentHotkeyLabel) buttons.addWidget(self.closeButton) buttons.addWidget(self.runButton) buttons.addWidget(self.saveButton) description = QHBoxLayout() description.addWidget(QLabel(self.tr("Description: "))) description.addWidget(self.snippetDescription) vlayoutWidget = QWidget() vlayout = QVBoxLayout() vlayout.addLayout(description) vlayout.addWidget(self.edit) vlayout.addLayout(buttons) vlayoutWidget.setLayout(vlayout) hsplitter = QSplitter() hsplitter.addWidget(treeWidget) hsplitter.addWidget(vlayoutWidget) hlayout = QHBoxLayout() hlayout.addWidget(hsplitter) self.showNormal() #Fixes bug that maximized windows are "stuck" #Because you can't trust QT to do the right thing here if (sys.platform == "darwin"): self.settings = QSettings("Vector35", "Snippet Editor") else: self.settings = QSettings("Vector 35", "Snippet Editor") if self.settings.contains("ui/snippeteditor/geometry"): self.restoreGeometry( self.settings.value("ui/snippeteditor/geometry")) else: self.edit.setMinimumWidth(80 * font.averageCharWidth()) self.edit.setMinimumHeight(30 * font.lineSpacing()) # Set dialog layout self.setLayout(hlayout) # Add signals self.saveButton.clicked.connect(self.save) self.closeButton.clicked.connect(self.close) self.runButton.clicked.connect(self.run) self.clearHotkeyButton.clicked.connect(self.clearHotkey) self.tree.selectionModel().selectionChanged.connect(self.selectFile) self.newSnippetButton.clicked.connect(self.newFileDialog) self.deleteSnippetButton.clicked.connect(self.deleteSnippet) #self.newFolderButton.clicked.connect(self.newFolder) self.browseButton.clicked.connect(self.browseSnippets) if self.settings.contains("ui/snippeteditor/selected"): selectedName = self.settings.value("ui/snippeteditor/selected") self.tree.selectionModel().select( self.files.index(selectedName), QItemSelectionModel.ClearAndSelect | QItemSelectionModel.Rows) if self.tree.selectionModel().hasSelection(): self.selectFile(self.tree.selectionModel().selection(), None) self.edit.setFocus() cursor = self.edit.textCursor() cursor.setPosition(self.edit.document().characterCount() - 1) self.edit.setTextCursor(cursor) else: self.readOnly(True) else: self.readOnly(True) @staticmethod def registerAllSnippets(): for action in list( filter(lambda x: x.startswith("Snippets\\"), UIAction.getAllRegisteredActions())): if action == "Snippets\\Snippet Editor...": continue UIActionHandler.globalActions().unbindAction(action) Menu.mainMenu("Tools").removeAction(action) UIAction.unregisterAction(action) for snippet in includeWalk(snippetPath, ".py"): snippetKeys = None (snippetDescription, snippetKeys, snippetCode) = loadSnippetFromFile(snippet) actionText = actionFromSnippet(snippet, snippetDescription) if snippetCode: if snippetKeys == None: UIAction.registerAction(actionText) else: UIAction.registerAction(actionText, snippetKeys) UIActionHandler.globalActions().bindAction( actionText, UIAction(makeSnippetFunction(snippetCode, actionText))) Menu.mainMenu("Tools").addAction(actionText, "Snippets") def clearSelection(self): self.keySequenceEdit.clear() self.currentHotkey = QKeySequence() self.currentHotkeyLabel.setText("") self.currentFileLabel.setText("") self.snippetDescription.setText("") self.edit.clear() self.tree.clearSelection() self.currentFile = "" def askSave(self): return QMessageBox.question( self, self.tr("Save?"), self.tr("Do you want to save changes to {}?").format( self.currentFileLabel.text()), QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel) def reject(self): self.settings.setValue("ui/snippeteditor/geometry", self.saveGeometry()) if self.snippetChanged(): save = self.askSave() if save == QMessageBox.Yes: self.save() elif save == QMessageBox.No: self.loadSnippet() elif save == QMessageBox.Cancel: return self.accept() def browseSnippets(self): url = QUrl.fromLocalFile(snippetPath) QDesktopServices.openUrl(url) def newFolder(self): (folderName, ok) = QInputDialog.getText(self, self.tr("Folder Name"), self.tr("Folder Name: ")) if ok and folderName: index = self.tree.selectionModel().currentIndex() selection = self.files.filePath(index) if QFileInfo(selection).isDir(): QDir(selection).mkdir(folderName) else: QDir(snippetPath).mkdir(folderName) def selectFile(self, new, old): if (self.resetting): self.resetting = False return if len(new.indexes()) == 0: self.clearSelection() self.currentFile = "" self.readOnly(True) return newSelection = self.files.filePath(new.indexes()[0]) self.settings.setValue("ui/snippeteditor/selected", newSelection) if QFileInfo(newSelection).isDir(): self.readOnly(True) self.clearSelection() self.currentFile = "" return if old and old.length() > 0: oldSelection = self.files.filePath(old.indexes()[0]) if not QFileInfo(oldSelection).isDir() and self.snippetChanged(): save = self.askSave() if save == QMessageBox.Yes: self.save() elif save == QMessageBox.No: pass elif save == QMessageBox.Cancel: self.resetting = True self.tree.selectionModel().select( old, QItemSelectionModel.ClearAndSelect | QItemSelectionModel.Rows) return False self.currentFile = newSelection self.loadSnippet() def loadSnippet(self): self.currentFileLabel.setText(QFileInfo(self.currentFile).baseName()) (snippetDescription, snippetKeys, snippetCode) = loadSnippetFromFile(self.currentFile) self.snippetDescription.setText( snippetDescription ) if snippetDescription else self.snippetDescription.setText("") self.keySequenceEdit.setKeySequence( snippetKeys ) if snippetKeys else self.keySequenceEdit.setKeySequence( QKeySequence("")) self.edit.setPlainText( snippetCode) if snippetCode else self.edit.setPlainText("") self.readOnly(False) def newFileDialog(self): (snippetName, ok) = QInputDialog.getText(self, self.tr("Snippet Name"), self.tr("Snippet Name: "), flags=self.windowFlags()) if ok and snippetName: if not snippetName.endswith(".py"): snippetName += ".py" index = self.tree.selectionModel().currentIndex() selection = self.files.filePath(index) if QFileInfo(selection).isDir(): path = os.path.join(selection, snippetName) else: path = os.path.join(snippetPath, snippetName) self.readOnly(False) open(path, "w").close() self.tree.setCurrentIndex(self.files.index(path)) log_debug("Snippet %s created." % snippetName) def readOnly(self, flag): self.keySequenceEdit.setEnabled(not flag) self.snippetDescription.setReadOnly(flag) self.edit.setReadOnly(flag) if flag: self.snippetDescription.setDisabled(True) self.edit.setDisabled(True) else: self.snippetDescription.setEnabled(True) self.edit.setEnabled(True) def deleteSnippet(self): selection = self.tree.selectedIndexes()[::self.columns][ 0] #treeview returns each selected element in the row snippetName = self.files.fileName(selection) question = QMessageBox.question( self, self.tr("Confirm"), self.tr("Confirm deletion: ") + snippetName) if (question == QMessageBox.StandardButton.Yes): log_debug("Deleting snippet %s." % snippetName) self.clearSelection() self.files.remove(selection) self.registerAllSnippets() def snippetChanged(self): if (self.currentFile == "" or QFileInfo(self.currentFile).isDir()): return False (snippetDescription, snippetKeys, snippetCode) = loadSnippetFromFile(self.currentFile) if snippetKeys == None and not self.keySequenceEdit.keySequence( ).isEmpty(): return True if snippetKeys != None and snippetKeys != self.keySequenceEdit.keySequence( ).toString(): return True return self.edit.toPlainText() != snippetCode or \ self.snippetDescription.text() != snippetDescription def save(self): log_debug("Saving snippet %s" % self.currentFile) outputSnippet = codecs.open(self.currentFile, "w", "utf-8") outputSnippet.write("#" + self.snippetDescription.text() + "\n") outputSnippet.write("#" + self.keySequenceEdit.keySequence().toString() + "\n") outputSnippet.write(self.edit.toPlainText()) outputSnippet.close() self.registerAllSnippets() def run(self): if self.context == None: log_warn("Cannot run snippets outside of the UI at this time.") return if self.snippetChanged(): self.save() actionText = actionFromSnippet(self.currentFile, self.snippetDescription.text()) UIActionHandler.globalActions().executeAction(actionText, self.context) log_debug("Saving snippet %s" % self.currentFile) outputSnippet = codecs.open(self.currentFile, "w", "utf-8") outputSnippet.write("#" + self.snippetDescription.text() + "\n") outputSnippet.write("#" + self.keySequenceEdit.keySequence().toString() + "\n") outputSnippet.write(self.edit.toPlainText()) outputSnippet.close() self.registerAllSnippets() def clearHotkey(self): self.keySequenceEdit.clear()
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ## ## $QT_END_LICENSE$ ## ############################################################################# """PySide6 port of the remoteobjects/modelviewclient example from Qt v5.x""" import sys from PySide6.QtCore import QUrl from PySide6.QtWidgets import (QApplication, QTreeView) from PySide6.QtRemoteObjects import QRemoteObjectNode if __name__ == '__main__': app = QApplication(sys.argv) node = QRemoteObjectNode(QUrl("local:registry")) node.setHeartbeatInterval(1000) view = QTreeView() view.setWindowTitle("RemoteView") view.resize(640,480) model = node.acquireModel("RemoteModel") view.setModel(model) view.show() sys.exit(app.exec_())
def setupUi(self, ReferenceDataDialog): if not ReferenceDataDialog.objectName(): ReferenceDataDialog.setObjectName(u"ReferenceDataDialog") ReferenceDataDialog.resize(869, 300) self.verticalLayout = QVBoxLayout(ReferenceDataDialog) self.verticalLayout.setObjectName(u"verticalLayout") self.verticalLayout.setContentsMargins(2, 2, 2, 2) self.EditFrame = QFrame(ReferenceDataDialog) self.EditFrame.setObjectName(u"EditFrame") sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.EditFrame.sizePolicy().hasHeightForWidth()) self.EditFrame.setSizePolicy(sizePolicy) self.EditFrame.setFrameShape(QFrame.Panel) self.EditFrame.setFrameShadow(QFrame.Plain) self.EditFrame.setLineWidth(0) self.edit_layout = QHBoxLayout(self.EditFrame) self.edit_layout.setObjectName(u"edit_layout") self.edit_layout.setContentsMargins(0, 0, 0, 0) self.GroupLbl = QLabel(self.EditFrame) self.GroupLbl.setObjectName(u"GroupLbl") self.edit_layout.addWidget(self.GroupLbl) self.GroupCombo = QComboBox(self.EditFrame) self.GroupCombo.setObjectName(u"GroupCombo") self.edit_layout.addWidget(self.GroupCombo) self.Toggle = QCheckBox(self.EditFrame) self.Toggle.setObjectName(u"Toggle") self.Toggle.setChecked(False) self.edit_layout.addWidget(self.Toggle) self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.edit_layout.addItem(self.horizontalSpacer) self.AddBtn = QPushButton(self.EditFrame) self.AddBtn.setObjectName(u"AddBtn") self.edit_layout.addWidget(self.AddBtn) self.AddChildBtn = QPushButton(self.EditFrame) self.AddChildBtn.setObjectName(u"AddChildBtn") self.edit_layout.addWidget(self.AddChildBtn) self.RemoveBtn = QPushButton(self.EditFrame) self.RemoveBtn.setObjectName(u"RemoveBtn") self.edit_layout.addWidget(self.RemoveBtn) self.CommitBtn = QPushButton(self.EditFrame) self.CommitBtn.setObjectName(u"CommitBtn") self.CommitBtn.setEnabled(False) self.edit_layout.addWidget(self.CommitBtn) self.RevertBtn = QPushButton(self.EditFrame) self.RevertBtn.setObjectName(u"RevertBtn") self.RevertBtn.setEnabled(False) self.edit_layout.addWidget(self.RevertBtn) self.verticalLayout.addWidget(self.EditFrame) self.SearchFrame = QFrame(ReferenceDataDialog) self.SearchFrame.setObjectName(u"SearchFrame") self.SearchFrame.setFrameShape(QFrame.Panel) self.SearchFrame.setFrameShadow(QFrame.Plain) self.SearchFrame.setLineWidth(0) self.search_layout = QHBoxLayout(self.SearchFrame) self.search_layout.setObjectName(u"search_layout") self.search_layout.setContentsMargins(0, 0, 0, 0) self.SearchLbl = QLabel(self.SearchFrame) self.SearchLbl.setObjectName(u"SearchLbl") self.search_layout.addWidget(self.SearchLbl) self.SearchString = QLineEdit(self.SearchFrame) self.SearchString.setObjectName(u"SearchString") self.search_layout.addWidget(self.SearchString) self.verticalLayout.addWidget(self.SearchFrame) self.DataView = QTableView(ReferenceDataDialog) self.DataView.setObjectName(u"DataView") self.DataView.setEditTriggers(QAbstractItemView.AnyKeyPressed | QAbstractItemView.EditKeyPressed | QAbstractItemView.SelectedClicked) self.DataView.setAlternatingRowColors(True) self.DataView.setSelectionBehavior(QAbstractItemView.SelectRows) self.DataView.verticalHeader().setVisible(True) self.DataView.verticalHeader().setMinimumSectionSize(20) self.DataView.verticalHeader().setDefaultSectionSize(20) self.verticalLayout.addWidget(self.DataView) self.TreeView = QTreeView(ReferenceDataDialog) self.TreeView.setObjectName(u"TreeView") self.TreeView.setEditTriggers(QAbstractItemView.AnyKeyPressed | QAbstractItemView.EditKeyPressed | QAbstractItemView.SelectedClicked) self.TreeView.setTabKeyNavigation(True) self.TreeView.setAlternatingRowColors(True) self.TreeView.setSelectionMode(QAbstractItemView.ExtendedSelection) self.TreeView.setExpandsOnDoubleClick(False) self.TreeView.header().setStretchLastSection(False) self.verticalLayout.addWidget(self.TreeView) self.retranslateUi(ReferenceDataDialog) QMetaObject.connectSlotsByName(ReferenceDataDialog)