def setup_ui(self): """Load all the components of the ui during the install process.""" vbox = QVBoxLayout(self) vbox.setContentsMargins(0, 0, 0, 0) vbox.setSpacing(0) self.__toolbar = QToolBar() self.__toolbar.setObjectName('custom') hbox = QHBoxLayout() vbox.addLayout(hbox) self.stack = StackedWidget() vbox.addWidget(self.stack) self._console = console_widget.ConsoleWidget() self._runWidget = run_widget.RunWidget() self._web = web_render.WebRender() self._findInFilesWidget = find_in_files.FindInFilesWidget( self.parent()) # Not Configurable Shortcuts shortEscMisc = QShortcut(QKeySequence(Qt.Key_Escape), self) self.connect(shortEscMisc, SIGNAL("activated()"), self.hide) #Toolbar hbox.addWidget(self.__toolbar) self.add_to_stack(self._console, ":img/console", translations.TR_CONSOLE) self.add_to_stack(self._runWidget, ":img/play", translations.TR_OUTPUT) self.add_to_stack(self._web, ":img/web", translations.TR_WEB_PREVIEW) self.add_to_stack(self._findInFilesWidget, ":img/find", translations.TR_FIND_IN_FILES) #Last Element in the Stacked widget self._results = results.Results(self) self.stack.addWidget(self._results) self.__toolbar.addSeparator() hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) btn_close = QPushButton( self.style().standardIcon(QStyle.SP_DialogCloseButton), '') btn_close.setIconSize(QSize(24, 24)) btn_close.setObjectName('navigation_button') btn_close.setToolTip('F4: ' + translations.TR_ALL_VISIBILITY) hbox.addWidget(btn_close) self.connect(btn_close, SIGNAL('clicked()'), self.hide)
def setup_ui(self): """Load all the components of the ui during the install process.""" vbox = QVBoxLayout(self) vbox.setContentsMargins(0, 0, 0, 0) vbox.setSpacing(0) self.__toolbar = QToolBar() self.__toolbar.setObjectName('custom') hbox = QHBoxLayout() vbox.addLayout(hbox) self.stack = StackedWidget() vbox.addWidget(self.stack) self._console = console_widget.ConsoleWidget() self.stack.addWidget(self._console) self._runWidget = run_widget.RunWidget() self.stack.addWidget(self._runWidget) self._web = web_render.WebRender() self.stack.addWidget(self._web) self._findInFilesWidget = find_in_files.FindInFilesWidget( self.parent()) self.stack.addWidget(self._findInFilesWidget) #Last Element in the Stacked widget self._results = results.Results(self) self.stack.addWidget(self._results) self._btnConsole = QPushButton(QIcon(":img/console"), '') self._btnConsole.setToolTip(self.tr("Console")) self._btnRun = QPushButton(QIcon(":img/play"), '') self._btnRun.setToolTip(self.tr("Output")) self._btnWeb = QPushButton(QIcon(":img/web"), '') self._btnWeb.setToolTip(self.tr("Web Preview")) self._btnFind = QPushButton(QIcon(":img/find"), '') self._btnFind.setToolTip(self.tr("Find in Files")) #Toolbar hbox.addWidget(self.__toolbar) self.__toolbar.addWidget(self._btnConsole) self.__toolbar.addWidget(self._btnRun) self.__toolbar.addWidget(self._btnWeb) self.__toolbar.addWidget(self._btnFind) self.__toolbar.addSeparator() hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) btn_close = QPushButton( self.style().standardIcon(QStyle.SP_DialogCloseButton), '') btn_close.setObjectName('navigation_button') btn_close.setToolTip(self.tr('F4: Show/Hide')) hbox.addWidget(btn_close) # Not Configurable Shortcuts shortEscMisc = QShortcut(QKeySequence(Qt.Key_Escape), self) self.connect(shortEscMisc, SIGNAL("activated()"), self.hide) self.connect(self._btnConsole, SIGNAL("clicked()"), lambda: self._item_changed(0)) self.connect(self._btnRun, SIGNAL("clicked()"), lambda: self._item_changed(1)) self.connect(self._btnWeb, SIGNAL("clicked()"), lambda: self._item_changed(2)) self.connect(self._btnFind, SIGNAL("clicked()"), lambda: self._item_changed(3)) self.connect(btn_close, SIGNAL('clicked()'), self.hide)