def _syncViewAndModel(self): self.view.editor.editor_font = Preferences.getEditorFont() self.view.editor.file_encoding = Preferences.getFileEncoding() self.view.editor.line_endings = Preferences.getLineEndings() self.view.editor.indentation_type = Preferences.getIndentationType() self.view.editor.indentation_size = Preferences.getIndentationSize() self.view.editor.auto_wrap = Preferences.getAutoWrap() self.view.editor.error_markers = Preferences.getShowErrorMarkers() self.view.editor.error_annotations = Preferences.getShowErrorAnnotations( ) self.view.editor.auto_preview = Preferences.getAutoPreview() self.view.editor.preview_threshold = Preferences.getPreviewThreshold() self.view.document.latex_file_template = Preferences.getLatexFileTemplate( ) self.view.document.preamble_template = Preferences.getPreambleTemplate( ) self.view.preview.preview_template = Preferences.getPreviewTemplate() self.view.preview.latex_to_pdf_command = Preferences.getLatexToPDFCommand( ) self.view.preview.pdf_to_image_command = Preferences.getPDFToImageCommand( ) self.view.snippets.snippets = Preferences.getSnippets()
def loadUserPreferences(self): # editor font font = Preferences.getEditorFont() font.setPointSize(12) self.setFont(font) lexer = LexerTikZ() lexer.setDefaultFont(font) self.setLexer(lexer) # margins if self.show_margin: self._setMarginFont(font) else: self._hideMargin() # auto-wrap auto_wrap = Preferences.getAutoWrap() self.setWrapMode(auto_wrap) if auto_wrap: # hide horizontal scrollbar self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0) else: # show horizontal scrollbar self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 1) self.SendScintilla(QsciScintilla.SCI_SETSCROLLWIDTH, 1) self.SendScintilla(QsciScintilla.SCI_SETSCROLLWIDTHTRACKING, 1) # file encoding encoding = Preferences.getFileEncoding() self.setUtf8(encoding == Preferences.ENCODING_UTF8) # line endings line_endings = Preferences.getLineEndings() if line_endings == Preferences.LINE_ENDINGS_WINDOWS: self.setEolMode(EditorView.EolWindows) elif line_endings == Preferences.LINE_ENDINGS_MAC: self.setEolMode(EditorView.EolMac) else: self.setEolMode(EditorView.EolUnix) # indentation type indentation_type = Preferences.getIndentationType() self.setIndentationsUseTabs(indentation_type == Preferences.INDENT_TAB) # indentation size self.setTabWidth(Preferences.getIndentationSize())
def loadUserPreferences(self): # editor font font = Preferences.getEditorFont() self.setFont(font) lexer = LexerTikZ() lexer.setDefaultFont(font) self.setLexer(lexer) # margins if self.show_margin: self._setMarginFont(font) else: self._hideMargin() # auto-wrap auto_wrap = Preferences.getAutoWrap() self.setWrapMode(auto_wrap) if auto_wrap: # hide horizontal scrollbar self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0) else: # show horizontal scrollbar self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 1) self.SendScintilla(QsciScintilla.SCI_SETSCROLLWIDTH, 1) self.SendScintilla(QsciScintilla.SCI_SETSCROLLWIDTHTRACKING, 1) # file encoding encoding = Preferences.getFileEncoding() self.setUtf8(encoding == Preferences.ENCODING_UTF8) # line endings line_endings = Preferences.getLineEndings() if line_endings == Preferences.LINE_ENDINGS_WINDOWS: self.setEolMode(EditorView.EolWindows) elif line_endings == Preferences.LINE_ENDINGS_MAC: self.setEolMode(EditorView.EolMac) else: self.setEolMode(EditorView.EolUnix) # indentation type indentation_type = Preferences.getIndentationType() self.setIndentationsUseTabs(indentation_type == Preferences.INDENT_TAB) # indentation size self.setTabWidth(Preferences.getIndentationSize())
def _syncViewAndModel(self): self.view.editor.editor_font = Preferences.getEditorFont() self.view.editor.file_encoding = Preferences.getFileEncoding() self.view.editor.line_endings = Preferences.getLineEndings() self.view.editor.indentation_type = Preferences.getIndentationType() self.view.editor.indentation_size = Preferences.getIndentationSize() self.view.editor.auto_wrap = Preferences.getAutoWrap() self.view.editor.error_markers = Preferences.getShowErrorMarkers() self.view.editor.error_annotations = Preferences.getShowErrorAnnotations() self.view.editor.auto_preview = Preferences.getAutoPreview() self.view.editor.preview_threshold = Preferences.getPreviewThreshold() self.view.document.latex_file_template = Preferences.getLatexFileTemplate() self.view.document.preamble_template = Preferences.getPreambleTemplate() self.view.preview.preview_template = Preferences.getPreviewTemplate() self.view.preview.latex_to_pdf_command = Preferences.getLatexToPDFCommand() self.view.preview.pdf_to_image_command = Preferences.getPDFToImageCommand() self.view.snippets.snippets = Preferences.getSnippets()