def _setup_modes(self, color_scheme): self.cursor_history = self.modes.append(modes.CursorHistoryMode()) self.extended_selection_mode = self.modes.append( modes.ExtendedSelectionMode()) self.case_converter = self.modes.append(modes.CaseConverterMode()) self.auto_complete = self.modes.append(modes.AutoCompleteMode()) self.outline_mode = self.modes.append(modes.OutlineMode(get_outline)) self.add_separator() self.goto_def_mode = self.modes.append(cobmodes.GoToDefinitionMode()) self.code_completion_mode = self.modes.append( modes.CodeCompletionMode()) self.code_completion_mode.trigger_symbols[:] = [] self.file_watcher = self.modes.append(modes.FileWatcherMode()) self.auto_indent_mode = self.modes.append( cobmodes.CobolAutoIndentMode()) self.caret_line_mode = self.modes.append( modes.CaretLineHighlighterMode()) self.zoom_mode = self.modes.append(modes.ZoomMode()) self.indenter_mode = self.modes.append(cobmodes.IndenterMode()) self.auto_indent_mode = self.modes.append(modes.AutoIndentMode()) self.modes.append( cobmodes.CobolSyntaxHighlighter( self.document(), color_scheme=api.ColorScheme(color_scheme))) self.syntax_highlighter.fold_detector = CobolFoldDetector() self.margins = self.modes.append(cobmodes.MarginsMode()) self.comments_mode = self.modes.append(cobmodes.CommentsMode()) self.offset_calculator = self.modes.append( cobmodes.OffsetCalculatorMode()) self.occurences_highlighter_mode = self.modes.append( modes.OccurrencesHighlighterMode()) self.occurences_highlighter_mode.case_sensitive = False self.backspace_mode = self.modes.append(cobmodes.SmartBackSpaceMode())
def __init__(self, parent=None, color_scheme='qt'): super().__init__(parent=parent) self.setLineWrapMode(self.NoWrap) # install those modes first as they are required by other modes/panels self.modes.append(modes.OutlineMode(defined_names)) # panels self.panels.append(panels.SearchAndReplacePanel(), panels.SearchAndReplacePanel.Position.BOTTOM) self.panels.append(panels.FoldingPanel()) self.panels.append(panels.LineNumberPanel()) self.panels.append(panels.CheckerPanel()) self.panels.append(panels.GlobalCheckerPanel(), panels.GlobalCheckerPanel.Position.RIGHT) # modes # generic self.modes.append(modes.CursorHistoryMode()) self.modes.append(modes.ExtendedSelectionMode()) self.modes.append(modes.CaseConverterMode()) self.modes.append(modes.CaretLineHighlighterMode()) self.modes.append(modes.FileWatcherMode()) self.modes.append(modes.RightMarginMode()) self.modes.append(modes.ZoomMode()) self.modes.append(modes.SymbolMatcherMode()) self.modes.append(modes.CodeCompletionMode()) self.modes.append(modes.OccurrencesHighlighterMode()) self.modes.append(modes.SmartBackSpaceMode()) # python specifics self.modes.append(pymodes.PyAutoIndentMode()) self.modes.append(pymodes.PyAutoCompleteMode()) self.modes.append(pymodes.FrostedCheckerMode()) self.modes.append(pymodes.PEP8CheckerMode()) self.modes.append(pymodes.CalltipsMode()) self.modes.append(pymodes.PyIndenterMode()) self.add_separator() self.modes.append(AddImportMode()) self.modes.append(pymodes.GoToAssignmentsMode()) self.modes.append(pymodes.CommentsMode()) self.modes.append( pymodes.PythonSH(self.document(), color_scheme=ColorScheme(color_scheme))) self.syntax_highlighter.fold_detector = PythonFoldDetector() self.panels.append(pypanels.QuickDocPanel(), pyqode_api.Panel.Position.BOTTOM) self.panels.append(panels.EncodingPanel(), pyqode_api.Panel.Position.TOP) self.breakpoints_panel = self.panels.append(panels.MarkerPanel()) self.line_highlighter = self.modes.append(modes.LineHighlighterMode()) self.restart_backend()
def __init__(self, parent=None, server_script=None, interpreter=sys.executable, args=None, create_default_actions=True, color_scheme='qt', reuse_backend=True): super(RstCodeEdit, self).__init__(parent, create_default_actions) if server_script is None: server_script = self.DEFAULT_SERVER print 'is freezed?', hasattr(sys, 'frozen') print self.DEFAULT_SERVER print sys.executable print os.getcwd() sys.frozen = True self.backend.start(server_script, interpreter, args, reuse=reuse_backend) # append panels self.panels.append(panels.LineNumberPanel()) self.panels.append(panels.SearchAndReplacePanel(), api.Panel.Position.TOP) # append modes self.modes.append(modes.CursorHistoryMode()) self.modes.append(modes.CaseConverterMode()) self.modes.append(modes.FileWatcherMode()) # self.modes.append(modes.CaretLineHighlighterMode()) self.modes.append(modes.RightMarginMode()) self.modes.append(rstmodes.RstSH(self.document(), color_scheme=api.ColorScheme(color_scheme))) self.modes.append(modes.ZoomMode()) cc = modes.CodeCompletionMode() cc.trigger_symbols[:] = [] self.modes.append(cc) self.modes.append(modes.AutoIndentMode()) self.modes.append(modes.IndenterMode()) self.modes.append(modes.OccurrencesHighlighterMode()) self.modes.append(modes.SmartBackSpaceMode()) self.modes.append(modes.CheckerMode(workers.linter)) self.panels.append(panels.EncodingPanel(), api.Panel.Position.TOP) self.panels.append(panels.ReadOnlyPanel(), api.Panel.Position.TOP) self.panels.append(panels.CheckerPanel())
def __init__(self, parent=None, server_script=None, interpreter=sys.executable, args=None, create_default_actions=True, color_scheme='qt', reuse_backend=False): super(GenericCodeEdit, self).__init__(parent, create_default_actions) from pyqode.core import panels from pyqode.core import modes if server_script is None: server_script = GenericCodeEdit.DEFAULT_SERVER self.backend.start(server_script, interpreter, args, reuse=reuse_backend) # append panels self.panels.append(panels.LineNumberPanel()) self.panels.append(panels.SearchAndReplacePanel(), Panel.Position.BOTTOM) self.panels.append(panels.FoldingPanel()) # append modes self.modes.append(modes.CursorHistoryMode()) self.modes.append(modes.AutoCompleteMode()) self.modes.append(modes.ExtendedSelectionMode()) self.modes.append(modes.CaseConverterMode()) self.modes.append(modes.FileWatcherMode()) self.modes.append(modes.CaretLineHighlighterMode()) self.modes.append(modes.RightMarginMode()) self.modes.append( modes.PygmentsSyntaxHighlighter( self.document(), color_scheme=ColorScheme(color_scheme))) self.modes.append(modes.ZoomMode()) self.modes.append(modes.CodeCompletionMode()) self.modes.append(modes.AutoIndentMode()) self.modes.append(modes.IndenterMode()) self.modes.append(modes.SymbolMatcherMode()) self.modes.append(modes.OccurrencesHighlighterMode()) self.modes.append(modes.SmartBackSpaceMode()) self.panels.append(panels.EncodingPanel(), Panel.Position.TOP) self.panels.append(panels.ReadOnlyPanel(), Panel.Position.TOP)