def setCurrentModelIndex(self, index, newTab=False, tabWidget=None): title = self.getIndexTitle(index) if tabWidget is None: tabWidget = self.currentTabWidget() # Checking if tab is already openned for w in self.allTabs(tabWidget): if w.currentIndex == index: tabWidget.setCurrentWidget(w) return if qApp.keyboardModifiers() & Qt.ControlModifier: newTab = True if newTab or not tabWidget.count(): editor = editorWidget(self) editor.setCurrentModelIndex(index) editor._tabWidget = tabWidget i = tabWidget.addTab(editor, editor.ellidedTitle(title)) tabWidget.setTabToolTip(i, title) tabWidget.setCurrentIndex(tabWidget.count() - 1) else: self.currentEditor(tabWidget).setCurrentModelIndex(index)
def setCurrentModelIndex(self, index, newTab=False, tabWidget=None): title = self.getIndexTitle(index) if tabWidget is None: tabWidget = self.currentTabWidget() # Checking if tab is already opened for w in self.allTabs(tabWidget): if w.currentIndex == index: tabWidget.setCurrentWidget(w) return if qApp.keyboardModifiers() & Qt.ControlModifier: newTab = True if newTab or not tabWidget.count(): editor = editorWidget(self) editor.setCurrentModelIndex(index) editor._tabWidget = tabWidget i = tabWidget.addTab(editor, editor.ellidedTitle(title)) tabWidget.setTabToolTip(i, title) tabWidget.setCurrentIndex(tabWidget.count() - 1) else: self.currentEditor(tabWidget).setCurrentModelIndex(index)
def setCurrentModelIndex(self, index, newTab=False): if not index.isValid(): title = self.tr("Root") else: title = index.internalPointer().title() # Checking if tab is already openned for w in self.allTabs(): if w.currentIndex == index: self.tab.setCurrentWidget(w) return if qApp.keyboardModifiers() & Qt.ControlModifier: newTab = True if newTab or not self.tab.count(): editor = editorWidget(self) editor.setCurrentModelIndex(index) self.tab.addTab(editor, title) self.tab.setCurrentIndex(self.tab.count() - 1) else: self.currentEditor().setCurrentModelIndex(index) self.tab.setTabText(self.tab.currentIndex(), title)
def setCurrentModelIndex(self, index, newTab=False): if not index.isValid(): title = self.tr("Root") else: title = index.internalPointer().title() # Checking if tab is already openned for w in self.allTabs(): if w.currentIndex == index: self.tab.setCurrentWidget(w) return if qApp.keyboardModifiers() & Qt.ControlModifier: newTab = True if newTab or not self.tab.count(): editor = editorWidget(self) editor.setCurrentModelIndex(index) self.tab.addTab(editor, title) self.tab.setCurrentIndex(self.tab.count() - 1) else: self.currentEditor().setCurrentModelIndex(index) self.tab.setTabText(self.tab.currentIndex(), title)
def setupUi(self, importer): importer.setObjectName("importer") importer.resize(867, 560) self.verticalLayout = QtWidgets.QVBoxLayout(importer) self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.label = QtWidgets.QLabel(importer) self.label.setObjectName("label") self.horizontalLayout.addWidget(self.label) self.cmbImporters = QtWidgets.QComboBox(importer) self.cmbImporters.setObjectName("cmbImporters") self.horizontalLayout.addWidget(self.cmbImporters) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.btnChoseFile = QtWidgets.QPushButton(importer) icon = QtGui.QIcon.fromTheme("document-import") self.btnChoseFile.setIcon(icon) self.btnChoseFile.setObjectName("btnChoseFile") self.horizontalLayout.addWidget(self.btnChoseFile) self.lblIcon = QtWidgets.QLabel(importer) self.lblIcon.setText("") self.lblIcon.setObjectName("lblIcon") self.horizontalLayout.addWidget(self.lblIcon) self.lblFileName = QtWidgets.QLabel(importer) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.lblFileName.setFont(font) self.lblFileName.setText("") self.lblFileName.setObjectName("lblFileName") self.horizontalLayout.addWidget(self.lblFileName) self.btnClearFileName = QtWidgets.QPushButton(importer) self.btnClearFileName.setText("") icon = QtGui.QIcon.fromTheme("edit-clear") self.btnClearFileName.setIcon(icon) self.btnClearFileName.setFlat(True) self.btnClearFileName.setObjectName("btnClearFileName") self.horizontalLayout.addWidget(self.btnClearFileName) spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem1) self.btnPreview = QtWidgets.QPushButton(importer) icon = QtGui.QIcon.fromTheme("document-print-preview") self.btnPreview.setIcon(icon) self.btnPreview.setFlat(True) self.btnPreview.setObjectName("btnPreview") self.horizontalLayout.addWidget(self.btnPreview) self.btnImport = QtWidgets.QPushButton(importer) icon = QtGui.QIcon.fromTheme("document-import") self.btnImport.setIcon(icon) self.btnImport.setObjectName("btnImport") self.horizontalLayout.addWidget(self.btnImport) self.verticalLayout.addLayout(self.horizontalLayout) self.splitter = QtWidgets.QSplitter(importer) self.splitter.setOrientation(QtCore.Qt.Horizontal) self.splitter.setChildrenCollapsible(False) self.splitter.setObjectName("splitter") self.grpSettings = QtWidgets.QGroupBox(self.splitter) self.grpSettings.setObjectName("grpSettings") self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.grpSettings) self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) self.verticalLayout_3.setSpacing(0) self.verticalLayout_3.setObjectName("verticalLayout_3") self.grpPreview = QtWidgets.QGroupBox(self.splitter) self.grpPreview.setObjectName("grpPreview") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.grpPreview) self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) self.verticalLayout_2.setSpacing(0) self.verticalLayout_2.setObjectName("verticalLayout_2") self.previewSplitter = QtWidgets.QSplitter(self.grpPreview) self.previewSplitter.setOrientation(QtCore.Qt.Horizontal) self.previewSplitter.setObjectName("previewSplitter") self.tree = QtWidgets.QTreeView(self.previewSplitter) self.tree.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) self.tree.setHeaderHidden(True) self.tree.setObjectName("tree") self.editor = editorWidget(self.previewSplitter) self.editor.setObjectName("editor") self.verticalLayout_2.addWidget(self.previewSplitter) self.verticalLayout.addWidget(self.splitter) self.retranslateUi(importer) QtCore.QMetaObject.connectSlotsByName(importer)
def setupUi(self, importer): importer.setObjectName("importer") importer.resize(867, 560) self.verticalLayout = QtWidgets.QVBoxLayout(importer) self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.label = QtWidgets.QLabel(importer) self.label.setObjectName("label") self.horizontalLayout.addWidget(self.label) self.cmbImporters = QtWidgets.QComboBox(importer) self.cmbImporters.setObjectName("cmbImporters") self.horizontalLayout.addWidget(self.cmbImporters) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.btnChoseFile = QtWidgets.QPushButton(importer) icon = QtGui.QIcon.fromTheme("document-import") self.btnChoseFile.setIcon(icon) self.btnChoseFile.setObjectName("btnChoseFile") self.horizontalLayout.addWidget(self.btnChoseFile) self.lblIcon = QtWidgets.QLabel(importer) self.lblIcon.setText("") self.lblIcon.setObjectName("lblIcon") self.horizontalLayout.addWidget(self.lblIcon) self.lblFileName = QtWidgets.QLabel(importer) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.lblFileName.setFont(font) self.lblFileName.setText("") self.lblFileName.setObjectName("lblFileName") self.horizontalLayout.addWidget(self.lblFileName) self.btnClearFileName = QtWidgets.QPushButton(importer) self.btnClearFileName.setText("") icon = QtGui.QIcon.fromTheme("edit-clear") self.btnClearFileName.setIcon(icon) self.btnClearFileName.setFlat(True) self.btnClearFileName.setObjectName("btnClearFileName") self.horizontalLayout.addWidget(self.btnClearFileName) spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem1) self.btnPreview = QtWidgets.QPushButton(importer) icon = QtGui.QIcon.fromTheme("document-print-preview") self.btnPreview.setIcon(icon) self.btnPreview.setFlat(True) self.btnPreview.setObjectName("btnPreview") self.horizontalLayout.addWidget(self.btnPreview) self.btnImport = QtWidgets.QPushButton(importer) icon = QtGui.QIcon.fromTheme("document-import") self.btnImport.setIcon(icon) self.btnImport.setObjectName("btnImport") self.horizontalLayout.addWidget(self.btnImport) self.verticalLayout.addLayout(self.horizontalLayout) self.splitter = QtWidgets.QSplitter(importer) self.splitter.setOrientation(QtCore.Qt.Horizontal) self.splitter.setChildrenCollapsible(False) self.splitter.setObjectName("splitter") self.grpSettings = QtWidgets.QGroupBox(self.splitter) self.grpSettings.setObjectName("grpSettings") self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.grpSettings) self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) self.verticalLayout_3.setSpacing(0) self.verticalLayout_3.setObjectName("verticalLayout_3") self.grpPreview = QtWidgets.QGroupBox(self.splitter) self.grpPreview.setObjectName("grpPreview") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.grpPreview) self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) self.verticalLayout_2.setSpacing(0) self.verticalLayout_2.setObjectName("verticalLayout_2") self.previewSplitter = QtWidgets.QSplitter(self.grpPreview) self.previewSplitter.setOrientation(QtCore.Qt.Horizontal) self.previewSplitter.setObjectName("previewSplitter") self.tree = QtWidgets.QTreeView(self.previewSplitter) self.tree.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) self.tree.setHeaderHidden(True) self.tree.setObjectName("tree") self.editor = editorWidget(self.previewSplitter) self.editor.setObjectName("editor") self.verticalLayout_2.addWidget(self.previewSplitter) self.verticalLayout.addWidget(self.splitter) self.retranslateUi(importer) QtCore.QMetaObject.connectSlotsByName(importer)