def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(531, 382) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.tabWidget = TabWidget(self.centralwidget) self.tabWidget.setGeometry(QtCore.QRect(20, 20, 491, 321)) self.tabWidget.setTabPosition(QtWidgets.QTabWidget.West) self.tabWidget.setObjectName("tabWidget") self.tab = QtWidgets.QWidget() self.tab.setObjectName("tab") self.tabWidget.addTab(self.tab, "") self.tab_2 = QtWidgets.QWidget() self.tab_2.setObjectName("tab_2") self.tabWidget.addTab(self.tab_2, "") MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 531, 21)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def __init__(self): super(MainWindow, self).__init__() # variable declaration self.m_tabWidget = TabWidget() self.m_fileMenu = None self.m_fileOpenFileAction = None self.m_reloadAction = None self.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) self.setUpMenu() centralWidget = QtGui.QWidget(self) layout = QtGui.QVBoxLayout() layout.setSpacing(0) layout.addWidget(self.m_tabWidget) centralWidget.setLayout(layout) self.m_tabWidget.newTab() self.setCentralWidget(centralWidget) self.retranslate()
def __init__(self, parent: QWidget = None, flags: Qt.WindowFlags = Qt.Widget): super().__init__(parent, flags) self.m_tabWidget = TabWidget(self) self.m_progressBar = QProgressBar(self) self.m_historyBackAction = None self.m_historyForwardAction = None self.m_stopAction = None self.m_reloadAction = None self.m_stopReloadAction = None self.m_urlLineEdit = UrlLineEdit(self) self.setToolButtonStyle(Qt.ToolButtonFollowStyle) self.setAttribute(Qt.WA_DeleteOnClose, True) toolbar = self.createToolBar() self.addToolBar(toolbar) # self.menuBar().addMenu(self.createFileMenu(self.m_tabWidget)) # TODO: menu not created if done like this? self.createFileMenu(self.m_tabWidget) # self.menuBar().addMenu(self.createViewMenu(toolbar)) self.createViewMenu(toolbar) # self.menuBar().addMenu(self.createWindowMenu(self.m_tabWidget)) self.createWindowMenu(self.m_tabWidget) # self.menuBar().addMenu(self.createHelpMenu()) self.createHelpMenu() centralWidget = QWidget(self) layout = QVBoxLayout() layout.setSpacing(0) # layout.setMargin(0) self.addToolBarBreak() self.m_progressBar.setMaximumHeight(1) self.m_progressBar.setTextVisible(False) self.m_progressBar.setStyleSheet( "QProgressBar {border: 0px } QProgressBar.chunk { background-color: red }" ) layout.addWidget(self.m_progressBar) layout.addWidget(self.m_tabWidget) centralWidget.setLayout(layout) self.setCentralWidget(centralWidget) self.m_tabWidget.titleChanged.connect(self.handleWebViewTitleChanged) self.m_tabWidget.linkHovered.connect(self._link_hovered) self.m_tabWidget.loadProgress.connect(self.handleWebViewLoadProgress) self.m_tabWidget.urlChanged.connect(self.handleWebViewUrlChanged) self.m_tabWidget.iconChanged.connect(self.handleWebViewIconChanged) self.m_tabWidget.webActionEnabledChanged.connect( self.handleWebActionEnabledChanged) self.m_urlLineEdit.returnPressed.connect(self._return_pressed) self.m_urlLineEdit.setFavIcon(QIcon(":defaulticon.png")) self.handleWebViewTitleChanged(self.tr("Qt Simple Browser")) self.m_tabWidget.createTab()
def __init__(self): super().__init__() wd1 = Widget1("Button 1") wd2 = Widget2("Button 2") wd3 = Widget3("Button 3") self.tw = TabWidget() self.tw.tabEmptySignal.connect(self.tabIsEmpty) self.tw.attachWidget(wd1, "WD1") self.tw.attachWidget(wd2, "WD2") self.tw.attachWidget(wd3, "WD3") self.tw.show()
def setupUi(self, CedulaPadronDialogBase): CedulaPadronDialogBase.setObjectName("CedulaPadronDialogBase") CedulaPadronDialogBase.resize(931, 746) self.tabWidget = TabWidget(CedulaPadronDialogBase) self.tabWidget.setGeometry(QtCore.QRect(20, 20, 891, 711)) self.tabWidget.setLayoutDirection(QtCore.Qt.LeftToRight) self.tabWidget.setTabPosition(QtWidgets.QTabWidget.West) self.tabWidget.setTabShape(QtWidgets.QTabWidget.Rounded) self.tabWidget.setElideMode(QtCore.Qt.ElideRight) self.tabWidget.setTabsClosable(False) self.tabWidget.setObjectName("tabWidget") self.tab = QtWidgets.QWidget() self.tab.setObjectName("tab") self.tabWidget.addTab(self.tab, "") self.tab_2 = QtWidgets.QWidget() self.tab_2.setObjectName("tab_2") self.tabWidget.addTab(self.tab_2, "") self.retranslateUi(CedulaPadronDialogBase) self.tabWidget.setCurrentIndex(1) QtCore.QMetaObject.connectSlotsByName(CedulaPadronDialogBase)
def initUI(self): self.setGeometry(300, 300, 1200, 600) self.setWindowTitle('CrossCobra - Python IDE') # splitters splitter1 = QSplitter(Qt.Vertical) splitter2 = QSplitter(Qt.Horizontal) # widgets self.notebook = TabWidget(self) self.codeView = CodeView(self, self.notebook) self.notebook.newTab(codeView=self.codeView) self.textPad = self.notebook.textPad self.fileBrowser = FileBrowser(self, self.textPad, self.notebook, self.codeView) self.textPad.fileBrowser = self.fileBrowser # add widgets to splitters splitter1.addWidget(self.fileBrowser) splitter1.addWidget(self.codeView) w = splitter1.width() splitter1.setSizes([w//2, w//2]) splitter2.addWidget(splitter1) splitter2.addWidget(self.notebook) hbox = QHBoxLayout() hbox.addWidget(splitter2) splitter1.setStretchFactor(1, 1) splitter2.setStretchFactor(1, 10) self.setCentralWidget(splitter2) # actions newAction = QAction(QIcon(self.HOME + 'images/new.png'), 'New', self) newAction.setShortcut('Ctrl+N') newAction.triggered.connect(self.new) openAction = QAction(QIcon(self.HOME + 'images/open.png'), 'Open', self) openAction.setShortcut('Ctrl+O') openAction.triggered.connect(self.open) saveAction = QAction(QIcon(self.HOME + 'images/save.png'), 'Save', self) saveAction.setShortcut('Ctrl+S') saveAction.triggered.connect(self.save) saveAsAction = QAction(QIcon(self.HOME + 'images/saveAs.png'), 'Save As', self) saveAsAction.setShortcut('Ctrl+Shift+S') saveAsAction.triggered.connect(self.saveAs) printAction = QAction(QIcon(self.HOME + 'images/print.png'), 'Print', self) printAction.setShortcut('Ctrl+P') printAction.triggered.connect(self.onPrint) undoAction = QAction(QIcon(self.HOME + 'images/undo.png'), 'Undo', self) undoAction.setShortcut('Ctrl+Z') undoAction.triggered.connect(self.undo) redoAction = QAction(QIcon(self.HOME + 'images/redo.png'), 'Redo', self) redoAction.setShortcut('Ctrl+Shift+Z') redoAction.triggered.connect(self.redo) zoomInAction = QAction(QIcon(self.HOME + 'images/zoomIn.png'), 'ZoomIn', self) zoomInAction.setShortcut('Ctrl++') zoomInAction.triggered.connect(self.zoomIn) zoomOutAction = QAction(QIcon(self.HOME + 'images/zoomOut.png'), 'ZoomOut', self) zoomOutAction.setShortcut('Ctrl+-') zoomOutAction.triggered.connect(self.zoomOut) settingsAction = QAction(QIcon(self.HOME + 'images/settings.png'), 'Settings', self) settingsAction.setShortcut('F9') settingsAction.triggered.connect(self.showSettings) interpreterAction = QAction(QIcon(self.HOME + 'images/interpreter.png'), 'Start Python Interpreter', self) interpreterAction.setShortcut('F10') interpreterAction.triggered.connect(self.interpreter) terminalAction = QAction(QIcon(self.HOME + 'images/terminal.png'), 'Start Terminal', self) terminalAction.setShortcut('F11') terminalAction.triggered.connect(self.terminal) runAction = QAction(QIcon(self.HOME + 'images/run.png'), 'Run File', self) runAction.setShortcut('F12') runAction.triggered.connect(self.run) searchShortcut = QShortcut(self) searchShortcut.setKey('Ctrl+F') searchShortcut.activated.connect(self.onSearch) spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) # make toolbar self.toolbar = QToolBar() self.toolbar.setStyleSheet(''' QToolButton::hover { background-color: darkgreen;} ''') self.toolbar.setContextMenuPolicy(Qt.PreventContextMenu) self.addToolBar(Qt.RightToolBarArea, self.toolbar) self.toolbar.addSeparator() self.toolbar.addAction(newAction) self.toolbar.addSeparator() self.toolbar.addAction(openAction) self.toolbar.addSeparator() self.toolbar.addAction(saveAction) self.toolbar.addSeparator() self.toolbar.addAction(saveAsAction) self.toolbar.addSeparator() self.toolbar.addAction(printAction) self.toolbar.addSeparator() self.toolbar.addAction(undoAction) self.toolbar.addSeparator() self.toolbar.addAction(redoAction) self.toolbar.addSeparator() self.toolbar.addAction(zoomInAction) self.toolbar.addSeparator() self.toolbar.addAction(zoomOutAction) self.toolbar.addSeparator() self.toolbar.addAction(settingsAction) self.toolbar.addSeparator() self.toolbar.addWidget(spacer) self.toolbar.addAction(interpreterAction) self.toolbar.addSeparator() self.toolbar.addAction(terminalAction) self.toolbar.addSeparator() self.toolbar.addAction(runAction) # make statusbar self.statusBar = QStatusBar() self.searchEdit = QLineEdit() spacer2 = QWidget() self.searchEdit.setStyleSheet( ''' background-color: white; color: black; ''') self.searchEdit.returnPressed.connect(self.onSearch) self.searchButton = QPushButton(QIcon(self.HOME + 'images/search.png'), 'Search', self) self.searchButton.setStyleSheet( ''' QPushButton::hover { background-color: darkgreen;} ''') self.searchButton.clicked.connect(self.onSearch) self.statusBar.addPermanentWidget(spacer2) self.statusBar.addPermanentWidget(self.searchEdit) self.statusBar.addPermanentWidget(self.searchButton) self.setStatusBar(self.statusBar) # show all self.textPad.setFocus() self.show()
def __init__(self, parent=None): super().__init__(parent) self.mLayout = QVBoxLayout(self) self.mLayout.setContentsMargins(0, 0, 0, 0) self.mLayout.setSpacing(0) self.mHLayout = QHBoxLayout() self.mHLayout.setSpacing(20) self.mVLayout = QVBoxLayout() self.mVLayout.setContentsMargins(5, 5, 5, 5) self.mNavigation = NavigationBar(self) self.mNavigation.pushNavigation("Apps", 0) self.mNavigation.pushNavigation( "Neal Analytics SKU Assortment Optimization", 1) self.mNavigation.pushNavigation("Neal Analytics", 2) self.mSidePanel = SidePanel(self) self.mHeaderFrame = QFrame(self) self.mAppName = QLabel(self.mHeaderFrame) self.mAppName.setFont(QFont("SegeoUI", 20)) self.mAppName.setText("Neal Analytics SKU Assortment Optimization") self.mAppNameBrief = QLabel(self.mHeaderFrame) self.mAppNameBrief.setFont(QFont("SegeoUI", 14)) self.mAppNameBrief.setText("Neal Analytics") self.mHeaderLayout = QVBoxLayout(self.mHeaderFrame) self.mHeaderLayout.addWidget(self.mAppName, 0, Qt.AlignLeft) self.mHeaderLayout.addWidget(self.mAppNameBrief, 0, Qt.AlignLeft) self.mTab = TabWidget(self) self.mTab.addItemByText("Overview", 0) self.mTab.addItemByText("Reviews", 1) self.mTab.tabChanged.connect(self.onTabChanged) self.mOverviewFrame = QFrame(self) self.mIntroFrame = IntroFrame(self.mOverviewFrame) self.mIntroFrame.setIntroDescHtmlFile("./html/example.html") self.mImageView = ImageView(self.mOverviewFrame) self.mImageView.setPresenterSize(640, 480) self.mImageView.addThumbnail("./img/phantom.jpg") self.mImageView.addThumbnail("./img/spectre.jpg") self.mImageView.addThumbnail( "./img/deeplearning.png", "https://www.youtube.com/embed/b99UVkWzYTQ?rel=0&showinfo=0", 1) self.mImageView.addThumbnail("./img/large.png") self.mImageView.addThumbnail("./img/microsoft_preferred.png") self.mImageView.addThumbnail("./img/phantom.jpg") self.mImageView.addThumbnail("./img/spectre.jpg") self.mOverviewLayout = QHBoxLayout(self.mOverviewFrame) self.mOverviewLayout.setSpacing(40) self.mOverviewLayout.setContentsMargins(0, 0, 0, 0) self.mOverviewLayout.addWidget(self.mIntroFrame) self.mOverviewLayout.addWidget(self.mImageView) self.mReviewFrame = ReviewContainer(self) self.mVLayout.addWidget(self.mHeaderFrame, 0) self.mVLayout.addWidget(self.mTab, 0) self.mVLayout.addWidget(self.mReviewFrame, 10) self.mVLayout.addWidget(self.mOverviewFrame, 10) self.mHLayout.addWidget(self.mSidePanel) self.mHLayout.addLayout(self.mVLayout) self.mLayout.addWidget(self.mNavigation, 0, Qt.AlignLeft) self.mLayout.addLayout(self.mHLayout) self.mSidePanel.adjustFixedWidth(200) self.mTab.setActiveItemByIndex(0) self.setObjectName("DetailPage") self.setStyleSheet("#DetailPage{background-color: white;}") self.setAutoFillBackground(True) self.onTabChanged(0)