def showHomePage(self, home=True): self.menuBar.setVisible(Settings().displayMenuBar) if home: _logger().debug('going to home page') if self.stackedWidget.currentIndex() == 1: s = Settings() s.navigationPanelVisible = self.dockWidgetNavPanel.isVisible() s.logPanelVisible = self.dockWidgetLogs.isVisible() self.consoleOutput.clear() self.stackedWidget.setCurrentIndex(0) self.toolBarFile.hide() self.toolBarCode.hide() self.dockWidgetLogs.hide() self.statusBar().setVisible(Settings().displayStatusBar) self.dockWidgetNavPanel.hide() self.dockWidgetOffsets.hide() self.lblEncoding.setText('') self.lblFilename.setText('OpenCobolIDE v.%s' % __version__) self.lblCursorPos.setText('') else: _logger().debug('going to editor page') if self.stackedWidget.currentIndex() == 0: self.stackedWidget.setCurrentIndex(1) self.dockWidgetNavPanel.show() s = Settings() self.statusBar().setVisible(Settings().displayStatusBar) self.dockWidgetNavPanel.setVisible(s.navigationPanelVisible) self.dockWidgetLogs.setVisible(s.logPanelVisible) if s.displayToolBar: self.toolBarFile.setVisible(True) self.toolBarCode.setVisible(True)
def on_rbLightStyle_clicked(self, checked): app = QtGui.QApplication.instance() if checked: app.setStyleSheet("") self.editorStyle = pyqode.core.QGenericCodeEdit().style self.homePageColorScheme = 0 s = Settings() s.appStyle = constants.WHITE_STYLE
def on_actionPreferences_triggered(self): s = Settings() dlg = DlgPreferences(self) dlg.homePageColorScheme = s.homePageColorScheme dlg.editorSettings = s.editorSettings dlg.editorStyle = s.editorStyle dlg.consoleBackground = s.consoleBackground dlg.consoleUserInput = s.consoleUserInput dlg.consoleForeground = s.consoleForeground dlg.consoleAppOutput = s.consoleAppOutput dlg.console.runProcess("python") if dlg.exec_() == dlg.Accepted: s.editorSettings = dlg.editorSettings s.editorStyle = dlg.editorStyle s.consoleBackground = dlg.consoleBackground s.consoleForeground = dlg.consoleForeground s.consoleUserInput = dlg.consoleUserInput s.consoleAppOutput = dlg.consoleAppOutput s.homePageColorScheme = dlg.homePageColorScheme s.runInExternalTerminal = dlg.checkBoxExtTerm.isChecked() self.setHomePageColorScheme(s.homePageColorScheme) self.tabWidgetEditors.resetSettings(dlg.editorSettings) self.tabWidgetEditors.resetStyle(dlg.editorStyle) self.tabWidgetEditors.refreshIcons(useTheme=dlg.rbLightStyle.isChecked()) self.consoleOutput.backgroundColor = dlg.consoleBackground self.consoleOutput.processOutputColor = dlg.consoleForeground self.consoleOutput.usrInputColor = dlg.consoleUserInput self.consoleOutput.appMessageColor = dlg.consoleAppOutput self.setupIcons()
def showHomePage(self, home=True): if home: if self.stackedWidget.currentIndex() == 1: self.prevSize = self.size() self.wasMaximised = self.isMaximized() s = Settings() s.navigationPanelVisible = self.dockWidgetNavPanel.isVisible() s.logPanelVisible = self.dockWidgetLogs.isVisible() self.setMinimumWidth(700) self.setMinimumHeight(400) self.resize(700, 400) if not self.isFullScreen(): self.showCentered() self.consoleOutput.clear() self.setMinimumWidth(700) self.setMinimumHeight(400) self.resize(700, 400) self.stackedWidget.setCurrentIndex(0) self.menuBar.hide() self.toolBarFile.hide() self.toolBarCode.hide() self.dockWidgetLogs.hide() self.dockWidgetNavPanel.hide() self.dockWidgetOffsets.hide() self.lblEncoding.setText("") self.lblFilename.setText("OpenCobolIDE v.%s" % __version__) self.lblCursorPos.setText("") else: if self.stackedWidget.currentIndex() == 0: self.stackedWidget.setCurrentIndex(1) self.menuBar.show() self.toolBarFile.show() self.toolBarCode.show() self.dockWidgetNavPanel.show() self.setMinimumWidth(900) self.setMinimumHeight(700) if not self.isFullScreen(): if self.wasMaximised: self.showMaximized() else: if self.prevSize.width() < 900: self.prevSize.setWidth(900) if self.prevSize.height() < 700: self.prevSize.setHeight(700) self.resize(self.prevSize) self.showCentered() s = Settings() self.dockWidgetNavPanel.setVisible(s.navigationPanelVisible) self.dockWidgetLogs.setVisible(s.logPanelVisible)
def saveSettings(self): if self.stackedWidget.currentIndex() == 1: s = Settings() s.geometry = self.saveGeometry() s.state = self.saveState() s.maximised = self.isMaximized() s.size = self.size() s.navigationPanelVisible = self.dockWidgetNavPanel.isVisible() s.logPanelVisible = self.dockWidgetLogs.isVisible() s.fullscreen = self.isFullScreen()
def on_rbDarkStyle_clicked(self, checked): app = QtGui.QApplication.instance() if checked: app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=False)) style = self.editorStyle style.setValue("pygmentsStyle", "monokai") style.setValue("selectionBackground", "monokai") style.setValue("background", QtGui.QColor("#272822")) style.setValue("caretLineBackground", QtGui.QColor("#272822")) style.setValue("selectionBackground", QtGui.QColor("#353d44")) style.setValue("whiteSpaceForeground", QtGui.QColor("#393939")) style.setValue("nativeFoldingIndicator", False) self.homePageColorScheme = 1 # force grid refresh self.editorStyle = style s = Settings() s.appStyle = constants.DARK_STYLE
def editSettings(cls, parent): dlg = cls(parent) if dlg.exec_() != dlg.Accepted: raise DlgRejectedError() settings = Settings() settings.displayLineNumbers = dlg.checkBoxViewLineNumber.isChecked() settings.displayMargins = dlg.checkBoxViewMargins.isChecked() settings.displayStatusBar = dlg.checkBoxViewStatus.isChecked() settings.highlightCurrentLine = dlg.checkBoxHighlightCurrentLine.isChecked() settings.highlightMatchingBraces = dlg.checkBoxHighlightBraces.isChecked() settings.highlightWhitespaces = dlg.checkBoxHighlightWhitespaces.isChecked() settings.tabWidth = dlg.spinBoxEditorTabLen.value() settings.enableAutoIndent = dlg.checkBoxEditorAutoIndent.isChecked() settings.saveOnFocusOut = dlg.checkBoxEditorSaveOnFocusOut.isChecked() settings.ccTriggerLen = dlg.spinBoxEditorCCTriggerLen.value() settings.globalStyle = 'white' if dlg.radioButtonColorWhite.isChecked() else 'dark' settings.fontName = dlg.fontComboBox.currentFont().family() settings.fontSize = dlg.spinBoxFontSize.value() settings.colorScheme = dlg.listWidgetColorSchemes.currentItem().text() settings.runInShell = dlg.checkBoxRunExtTerm.isChecked() settings.shellCommand = dlg.lineEditRunTerm.text() settings.displayControlPanel = dlg.checkBoxViewControlPanel.isChecked() settings.displayToolBar = dlg.checkBoxViewToolBar.isChecked() settings.displayMenuBar = dlg.checkBoxViewMenuBar.isChecked() if dlg.checkBoxCustomPath.isChecked(): settings.customCompilerPath = dlg.lineEditCompilerPath.text() else: settings.customCompilerPath = '' settings.free_format = dlg.checkBoxFreeFormat.isChecked() settings.left_margin = dlg.spinBoxLeftMargin.value() settings.right_margin = dlg.spinBoxRightMargin.value() settings.comment_indicator = dlg.lineEditCommentIndicator.text() settings.cobol_standard = CobolStandard(dlg.comboBoxStandard.currentIndex())
def restoreDefaults(self): settings = Settings() index = self.tabWidget.currentIndex() if index == 0: settings.displayLineNumbers = True settings.displayMargins = True settings.displayStatusBar = True settings.displayMenuBar = False settings.displayControlPanel = True settings.displayToolBar = False settings.highlightCurrentLine = True settings.highlightMatchingBraces = True settings.highlightWhitespaces = False if index == 1: settings.tabWidth = 4 settings.enableAutoIndent = True settings.saveOnFocusOut = True settings.ccTriggerLen = 1 if index == 2: settings.globalStyle = 'white' settings.fontName = None settings.fontSize = 10 settings.colorScheme = 'default' if index == 3: settings.runInShell = False settings.shellCommand = None settings.customCompilerPath = '' if index == 4: settings.free_format = False settings.left_margin = 7 settings.right_margin = 72 settings.cobol_standard = CobolStandard.default settings.comment_indicator = '*>' self.reset()