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): super().__init__() self.show_context_menu = False self.sh = self.modes.append( modes.PygmentsSH(self.document(), DiffLexer())) self.lines = self.panels.append(panels.LineNumberPanel(), panels.LineNumberPanel.Position.LEFT) self.setReadOnly(True) self.syntax_highlighter.color_scheme = api.ColorScheme( settings.color_scheme())
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 update_preview(self): cs = api.ColorScheme(self.ui.combo_color_schemes.currentText()) self.ui.edit_preview.syntax_highlighter.color_scheme = cs font = self.ui.fontComboBox.currentFont().family() self.ui.edit_preview.font_size = self.ui.spinbox_font_size.value() self.ui.edit_preview.font_name = font
def __init__(self): super(scripteditoritem, self).__init__() # starts the default pyqode.python server (which enable the jedi code # completion worker). self.backend.start(server.__file__) # some other modes/panels require the analyser mode, the best is to # install it first # self.modes.append(pymodes.DocumentAnalyserMode()) # --- core panels self.panels.append(panels.FoldingPanel()) self.panels.append(panels.LineNumberPanel()) self.panels.append(panels.CheckerPanel()) self.panels.append(panels.SearchAndReplacePanel(), panels.SearchAndReplacePanel.Position.BOTTOM) self.panels.append(panels.EncodingPanel(), api.Panel.Position.TOP) # add a context menu separator between editor's # builtin action and the python specific actions self.add_separator() # --- python specific panels self.panels.append(pypanels.QuickDocPanel(), api.Panel.Position.BOTTOM) # --- core modes self.modes.append(modes.CaretLineHighlighterMode()) self.modes.append(modes.CodeCompletionMode()) self.modes.append(modes.ExtendedSelectionMode()) self.modes.append(modes.FileWatcherMode()) self.modes.append(modes.OccurrencesHighlighterMode()) self.modes.append(modes.RightMarginMode()) self.modes.append(modes.SmartBackSpaceMode()) self.modes.append(modes.SymbolMatcherMode()) self.modes.append(modes.ZoomMode()) self.modes.append(modes.PygmentsSyntaxHighlighter(self.document())) # --- python specific modes self.modes.append(pymodes.CommentsMode()) self.modes.append(pymodes.CalltipsMode()) self.modes.append(pymodes.FrostedCheckerMode()) self.modes.append(pymodes.PEP8CheckerMode()) self.modes.append(pymodes.PyAutoCompleteMode()) self.modes.append(pymodes.PyAutoIndentMode()) self.modes.append(pymodes.PyIndenterMode()) self.syntax_highlighter.color_scheme = api.ColorScheme('darcula') QApplication.instance().aboutToQuit.connect( self.cleanup) # TODO: use this approach in Xi-cam # self.file.open('test.py') self.insertPlainText(''' # Required to allow controls manipulation in background import asyncio loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) # Setup RunEngine from bluesky import RunEngine from bluesky.plans import inner_product_scan RE = RunEngine({}) # Set up simulated hardware. from ophyd.sim import det4, motor1, motor2, motor3 # The 'det4' example detector a 2D Gaussian function of motor1, motor2. # Move motor1 from 1-5 while moving motor2 from 10-50 -- both in 5 steps. RE(inner_product_scan([det4], 5, motor1, 1, 5, motor2, 10, 50)) ''')
def __init__(self): super(scripteditoritem, self).__init__() # starts the default pyqode.python server (which enable the jedi code # completion worker). self.backend.start(server.__file__) # some other modes/panels require the analyser mode, the best is to # install it first # self.modes.append(pymodes.DocumentAnalyserMode()) # --- core panels self.panels.append(panels.FoldingPanel()) self.panels.append(panels.LineNumberPanel()) self.panels.append(panels.CheckerPanel()) # self.panels.append(panels.SearchAndReplacePanel(), # panels.SearchAndReplacePanel.Position.BOTTOM) # self.panels.append(panels.EncodingPanel(), api.Panel.Position.TOP) # add a context menu separator between editor's # builtin action and the python specific actions self.add_separator() # --- python specific panels self.panels.append(pypanels.QuickDocPanel(), api.Panel.Position.BOTTOM) # --- core modes self.modes.append(modes.CaretLineHighlighterMode()) self.modes.append(modes.CodeCompletionMode()) self.modes.append(modes.ExtendedSelectionMode()) self.modes.append(modes.FileWatcherMode()) self.modes.append(modes.OccurrencesHighlighterMode()) self.modes.append(modes.RightMarginMode()) self.modes.append(modes.SmartBackSpaceMode()) self.modes.append(modes.SymbolMatcherMode()) self.modes.append(modes.ZoomMode()) self.modes.append(modes.PygmentsSyntaxHighlighter(self.document())) # --- python specific modes self.modes.append(pymodes.CommentsMode()) self.modes.append(pymodes.CalltipsMode()) self.modes.append(pymodes.FrostedCheckerMode()) self.modes.append(pymodes.PEP8CheckerMode()) self.modes.append(pymodes.PyAutoCompleteMode()) self.modes.append(pymodes.PyAutoIndentMode()) self.modes.append(pymodes.PyIndenterMode()) self.syntax_highlighter.color_scheme = api.ColorScheme('darcula') QApplication.instance().aboutToQuit.connect(self.cleanup) # TODO: use this approach in Xi-cam # self.file.open('test.py') self.insertPlainText('''from bluesky.plans import scan from ophyd.sim import det4, motor1, motor2, motor3 from pyqtgraph.parametertree.parameterTypes import SimpleParameter from xicam.gui.utils import ParameterizablePlan min1 = SimpleParameter(name='Axis 1 Min', type='float') min2 = SimpleParameter(name='Axis 2 Min', type='float') max2 = SimpleParameter(name='Axis 2 Max', type='float') max1 = SimpleParameter(name='Axis 1 Max', type='float') steps = SimpleParameter(name='Steps', type='int') scan = ParameterizablePlan(scan) plan = scan([det4], motor1, min1, max1, motor2, min2, max2, steps) ''')