def __init__(self, parent=None): QsciScintilla.__init__(self, parent) # Set the default font font = QFont() font.setFamily(fontName) font.setFixedPitch(True) font.setPointSize(fontSize) fontmetrics = QFontMetrics(font) # Margin 0 is used for line numbers self.setMarginsFont(font) self.setMarginWidth(1, fontmetrics.width("00000")) self.setMarginLineNumbers(1, True) #self.setMarginsBackgroundColor(QColor("#cccccc")) # Brace matching: enable for a brace immediately before or after the current position self.setBraceMatching(QsciScintilla.SloppyBraceMatch) # Current line visible with special background color self.setCaretLineVisible(True) #self.setCaretLineBackgroundColor(caretBackground) # Set Python lexer self.setLexer(QsciLexerPython()) # override style settings to the same font and size # (python lexer has styles 0 ... 15) for i in range(16): self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, i, fontName) self.SendScintilla(QsciScintilla.SCI_STYLESETSIZE, i, fontSize) # make the source read-only self.SendScintilla(QsciScintilla.SCI_SETREADONLY, True)
def __init__(self, editorId, parent=None, activePyLexer=True, activePropertiesLexer=False, wrappingText=False): """ Python editor based on QsciScintilla @param editorId: @type editorId: @param parent: @type parent: """ QsciScintilla.__init__(self, parent) self.editorId = editorId self.activePyLexer = activePyLexer self.activePropertiesLexer = activePropertiesLexer self.setAcceptDrops(True) self.wrappingText = wrappingText self.opening = ['(', '{', '[', "'", '"'] self.closing = [')', '}', ']', "'", '"'] self.createActions() self.createWidgets() self.createConnections() self.setupContextMenu()
def __init__(self,parent,text,lang,colorStyle): QsciScintilla.__init__(self,parent) self.parent = parent self.lang = lang self.fontSize = fontSize self.colorStyle = colorStyle #self.init() self.setText(text) #self.addAction(QAction("gg",self)) # Clickable margin 1 for showing markers self.setMarginSensitivity(1, True) self.connect(self,SIGNAL('marginClicked(int, int, Qt::KeyboardModifiers)'),self.on_margin_clicked) self.markerDefine(QsciScintilla.RightArrow,self.ARROW_MARKER_NUM) self.registerImage(0,os_pixmap("class_obj")) self.registerImage(1,os_pixmap("method_obj")) self.registerImage(2,os_pixmap("field_public_obj")) # Brace matching: enable for a brace immediately before or after # the current position self.setBraceMatching(QsciScintilla.SloppyBraceMatch) self.setAutoCompletionThreshold(threshold) self.setAutoCompletionSource(QsciScintilla.AcsAPIs) #self.setFolding(QsciScintilla.BoxedTreeFoldStyle) #self.setAutoCompletionSource(QsciScintilla.AcsAll) #self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1, 'Courier') self.init()
def __init__(self, isnewfile, filename, text, parent=None): QsciScintilla.__init__(self, parent) print('Creating TextEdit', isnewfile, filename) self.setObjectName('TextEdit') self.currentfile = filename self.setUtf8(True) self.isnewfile = isnewfile self.nedits = 0 self.bookmarks = {} self.zen = common.Common() self.bookmark = self.markerDefine(QtGui.QPixmap(':/png/bookmark.png')) self.prefs = preferences.Preferences() self.setIndentationsUseTabs(False) self.copyAvailable.connect(self.enable_copy) self.textChanged.connect(self.text_changed) self.setText(text) self.setModified(False) self.lexer_ = None self.set_lexer() self.set_style_and_config() self.marginClicked.connect(self.on_margin_clicked) self.modificationChanged.connect(self.document_was_modified) self.linesChanged.connect(self.lines_changed)
def __init__(self): QsciScintilla.__init__(self) # Configuración de Qscintilla self.setCaretLineVisible(ESettings.get('editor/margen')) self.setIndentationsUseTabs(False) self.setAutoIndent(True) self.setBackspaceUnindents(True) # Scrollbar self.send("sci_sethscrollbar", 0) # Indicadores self.indicador = 0 self.indicador_warning = 1 self.indicador_error = 2 # Estilo de indicadores self.send("sci_indicsetstyle", self.indicador, "indic_container") self.send("sci_indicsetalpha", self.indicador, 100) self.send("sci_indicsetfore", self.indicador, 0x0000ff) self.send("sci_indicsetstyle", self.indicador_warning, "indic_dots") self.send("sci_indicsetfore", self.indicador_warning, QColor('yellow')) self.send("sci_indicsetstyle", self.indicador_error, "indic_dots") self.send("sci_indicsetfore", self.indicador_error, 0x0000ff) # Folding self.setFolding(QsciScintilla.BoxedTreeFoldStyle) self.colorFoldMargen(recursos.TEMA['foldFore'], recursos.TEMA['foldBack']) self._fuente = None self.linesChanged.connect(self.actualizar_sidebar)
def __init__(self, parent=None): QsciScintilla.__init__(self, parent) font = QFont() font.setFamily("courier") font.setFixedPitch(True) font.setPointSize(14) self.setFont(font) self.setMarginsFont(font) fontMetrics = QFontMetrics(font) self.setMarginWidth(0, fontMetrics.width("00000") + 6) self.setMarginLineNumbers(0, True) self.setMarginsBackgroundColor(QColor("#CCCCCC")) self.setMarginSensitivity(1, True) self.marginClicked.connect(self.onMarginClicked) self.markerDefine(QsciScintilla.RightArrow, self.ARROW_MARKER_NUM) self.setMarkerBackgroundColor(QColor("#EE1111"), self.ARROW_MARKER_NUM) self.setBraceMatching(QsciScintilla.SloppyBraceMatch) self.setFolding(QsciScintilla.BoxedTreeFoldStyle) lexer = PythonLexer() print lexer.styleNames() lexer.setDefaultFont(font) self.setLexer(lexer) self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1, "Courier") self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0) self.setMinimumSize(600, 450)
def __init__(self, parent=None): QsciScintilla.__init__(self, parent) font = QFont() font.setFamily('courier') font.setFixedPitch(True) font.setPointSize(14) self.setFont(font) self.setMarginsFont(font) fontMetrics = QFontMetrics(font) self.setMarginWidth(0, fontMetrics.width("00000") + 6) self.setMarginLineNumbers(0, True) self.setMarginsBackgroundColor(QColor('#CCCCCC')) self.setMarginSensitivity(1, True) self.marginClicked.connect(self.onMarginClicked) self.markerDefine(QsciScintilla.RightArrow, self.ARROW_MARKER_NUM) self.setMarkerBackgroundColor(QColor("#EE1111"), self.ARROW_MARKER_NUM) self.setBraceMatching(QsciScintilla.SloppyBraceMatch) self.setFolding(QsciScintilla.BoxedTreeFoldStyle) lexer = PythonLexer() print lexer.styleNames() lexer.setDefaultFont(font) self.setLexer(lexer) self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1, 'Courier') self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0) self.setMinimumSize(600, 450)
def __init__(self, parent=None): QsciScintilla.__init__(self, parent) self.mylexer = None self.api = None self.setCommonOptions() self.initShortcuts()
def __init__(self, parent): QsciScintilla.__init__(self,parent) # self.nrOfLines = 0 # self.line_nr = 0 # self.pos = 0 self.parser = Parser() self.set_up()
def __init__(self, parent, jsonLexer=False): """ Text raw editor """ QsciScintilla.__init__(self, parent) self.jsonLexer = jsonLexer self.createConnections() self.createWidget()
def __init__(self, parent=None): QsciScintilla.__init__(self, parent) ## set the default font of the editor ## and take the same font for line numbers font = CurrentTheme.PYTHON_SOURCE_EDITOR_FONT self.setFont(font) fm = QtGui.QFontMetrics(font) ## Line numbers # conventionally, margin 0 is for line numbers self.setMarginWidth(0, fm.width("0000") + 4) self.setMarginLineNumbers(0, True) self.setAutoIndent(True) ## Edge Mode shows a red vetical bar at 80 chars self.setEdgeMode(QsciScintilla.EdgeLine) self.setEdgeColumn(80) self.setEdgeColor(QtGui.QColor("#CCCCCC")) ## Folding visual : we will use boxes self.setFolding(QsciScintilla.BoxedTreeFoldStyle) ## Braces matching self.setBraceMatching(QsciScintilla.SloppyBraceMatch) ## Editing line color # self.setCaretLineVisible(True) # self.setCaretLineBackgroundColor(QtGui.QColor("#CDA869")) ## Margins colors # line numbers margin self.setMarginsBackgroundColor(QtGui.QColor("#FFFFFF")) self.setMarginsForegroundColor(QtGui.QColor("#000000")) # folding margin colors (foreground,background) self.setFoldMarginColors(QtGui.QColor("#DDDDDD"), QtGui.QColor("#DDDDDD")) # do not use tabs self.setIndentationsUseTabs(False) self.setTabWidth(4) self.setTabIndents(True) ## Choose a lexer lexer = QsciLexerPython() lexer.setDefaultFont(font) lexer.setFont(font) self.setLexer(lexer) # set autocompletion self.setAutoCompletionThreshold(2) self.setAutoCompletionSource(QsciScintilla.AcsDocument) self.setAutoCompletionCaseSensitivity(True) self.setAutoCompletionReplaceWord(True) self.setAutoCompletionFillupsEnabled(True)
def __init__(self, parent=None): QsciScintilla.__init__(self, parent) ## set the default font of the editor ## and take the same font for line numbers font = CurrentTheme.PYTHON_SOURCE_EDITOR_FONT self.setFont(font) fm = QtGui.QFontMetrics(font) ## Line numbers # conventionally, margin 0 is for line numbers self.setMarginWidth(0, fm.width( "0000" ) + 4) self.setMarginLineNumbers(0, True) self.setAutoIndent(True) ## Edge Mode shows a red vetical bar at 80 chars self.setEdgeMode(QsciScintilla.EdgeLine) self.setEdgeColumn(80) self.setEdgeColor(QtGui.QColor("#CCCCCC")) ## Folding visual : we will use boxes self.setFolding(QsciScintilla.BoxedTreeFoldStyle) ## Braces matching self.setBraceMatching(QsciScintilla.SloppyBraceMatch) ## Editing line color # self.setCaretLineVisible(True) # self.setCaretLineBackgroundColor(QtGui.QColor("#CDA869")) ## Margins colors # line numbers margin self.setMarginsBackgroundColor(QtGui.QColor("#FFFFFF")) self.setMarginsForegroundColor(QtGui.QColor("#000000")) # folding margin colors (foreground,background) self.setFoldMarginColors(QtGui.QColor("#DDDDDD"),QtGui.QColor("#DDDDDD")) # do not use tabs self.setIndentationsUseTabs(False) self.setTabWidth(4) self.setTabIndents(True) ## Choose a lexer lexer = QsciLexerPython() lexer.setDefaultFont(font) lexer.setFont(font) self.setLexer(lexer) # set autocompletion self.setAutoCompletionThreshold(2) self.setAutoCompletionSource(QsciScintilla.AcsDocument) self.setAutoCompletionCaseSensitivity(True) self.setAutoCompletionReplaceWord(True) self.setAutoCompletionFillupsEnabled(True)
def __init__(self, parent=None): QsciScintilla.__init__(self, parent) self.setup() # Code completion / calltips self.codecompletion_auto = False self.codecompletion_enter = False self.calltips = True self.completion_text = "" self.calltip_position = None self.connect(self, SIGNAL('userListActivated(int, const QString)'), lambda user_id, text: self.completion_list_selected(text))
def __init__(self, parent=None): QsciScintilla.__init__(self, parent) self.setup() # Code completion / calltips self.codecompletion = True self.codecompletion_enter = False self.calltips = True self.completion_text = "" self.calltip_position = None self.connect(self, SIGNAL('userListActivated(int, const QString)'), lambda user_id, text: self.completion_list_selected(text))
def __init__(self, mainwindow): QsciScintilla.__init__(self, mainwindow) self.mainwindow = mainwindow ## define the font to use font = QFont() font.setFamily("Consolas") font.setFixedPitch(True) font.setPointSize(10) # the font metrics here will help # building the margin width later fm = QFontMetrics(font) ## set the default font of the editor ## and take the same font for line numbers self.setFont(font) self.setMarginsFont(font) ## Line numbers # conventionnaly, margin 0 is for line numbers self.setMarginWidth(0, fm.width( "00000" ) + 5) self.setMarginLineNumbers(0, True) ## Edge Mode shows a red vetical bar at 80 chars self.setEdgeMode(QsciScintilla.EdgeLine) self.setEdgeColumn(80) self.setEdgeColor(QColor("#CCCCCC")) ## Folding visual : we will use boxes self.setFolding(QsciScintilla.BoxedTreeFoldStyle) ## Braces matching self.setBraceMatching(QsciScintilla.SloppyBraceMatch) ## Editing line color #self.setCaretLineVisible(True) #self.setCaretLineBackgroundColor(QColor("#CDA869")) ## Margins colors # line numbers margin self.setMarginsBackgroundColor(QColor("#333333")) self.setMarginsForegroundColor(QColor("#CCCCCC")) # folding margin colors (foreground,background) #self.setFoldMarginColors(QColor("#99CC66"),QColor("#333300")) self.setFoldMarginColors(QColor("#CCCCCC"),QColor("#CCCCCC")) ## Choose a lexer lexer = QsciLexerPython() lexer.setDefaultFont(font) self.setLexer(lexer)
def __init__( self, parent = None ): QsciScintilla.__init__( self, parent ) self.SendScintilla( self.SCI_SETLAYOUTCACHE, self.SC_CACHE_DOCUMENT ) self.zoom = 0 self._charWidth = -1 self._lineHeight = -1 self.__targetSearchFlags = 0 self.__targetSearchExpr = "" self.__targetSearchStart = 0 self.__targetSearchEnd = -1 self.__targetSearchActive = False return
def __init__(self, parent=None): QsciScintilla.__init__(self, parent) self.SendScintilla(self.SCI_SETLAYOUTCACHE, self.SC_CACHE_DOCUMENT) self.zoom = 0 self._charWidth = -1 self._lineHeight = -1 self.__targetSearchFlags = 0 self.__targetSearchExpr = "" self.__targetSearchStart = 0 self.__targetSearchEnd = -1 self.__targetSearchActive = False return
def __init__(self, lexer): QsciScintilla.__init__(self) BaseEdit.__init__(self) self.setMarginWidth(0, 30) self.setMarginLineNumbers(0, True) self.setBraceMatching(QsciScintilla.SloppyBraceMatch) self.setCaretLineVisible(True) self.setCaretLineBackgroundColor(QColor("#CCCCCC")) self.setBackspaceUnindents(True) self.setAutoCompletionSource(QsciScintilla.AcsAll) self.setAutoCompletionThreshold(1) self.setAutoCompletionCaseSensitivity(True) self.setTabIndents(True) self.setTabWidth(4) self.setLexer(lexer) self.edit_id = "source"
def __init__(self, parent = None): """ Constructor @param parent parent widget (QWidget) @param name name of this instance (string or QString) @param flags window flags """ QsciScintilla.__init__(self, parent) self.zoom = 0 self.__targetSearchFlags = 0 self.__targetSearchExpr = QString() self.__targetSearchStart = 0 self.__targetSearchEnd = -1 self.__targetSearchActive = False
def __init__(self, parent=None, syntax=None): """ Constructor Keywords arguments: parent -- parent QWidget syntax -- the syntax highlighter 'python', 'opensesame' or None (default=None) """ self._parent = parent QsciScintilla.__init__(self, parent) self.syntax = syntax self.textChanged.connect(self._parent.setModified) self.refresh_layout = True self.cfg_ver = config.get_config("cfg_ver") self.setUtf8(True)
def __init__(self, weditor): QsciScintilla.__init__(self, weditor) self._weditor = weditor self._indentation = self._weditor._indentation self.setLexer(self._weditor.lexer()) # Configuración Scintilla self.setMouseTracking(True) self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, False) self.SendScintilla(QsciScintilla.SCI_HIDESELECTION, True) self.setFolding(QsciScintilla.NoFoldStyle, 1) self.setReadOnly(True) self.setCaretWidth(0) self.setStyleSheet("background: transparent; border: 0px;") # Opacity self.effect = QGraphicsOpacityEffect() self.setGraphicsEffect(self.effect) self.effect.setOpacity(0.5) # Deslizador self.slider = Slider(self) self.slider.hide()
def __init__(self,parent,text,lang,colorStyle): QsciScintilla.__init__(self,parent) self.parent = parent self.lang = lang self.fontSize = fontSize self.colorStyle = colorStyle self.errorLines = [] self.setText(text) #if(config.encoding() == Encoding.ASCII): # self.setUtf8(False) #else: self.setUtf8(True) if(eol == 0): self.setEolMode(self.EolWindows) elif(eol == 1): self.setEolMode(self.EolUnix) else: self.setEolMode(self.EolMac) self.init() self.setTabWidth(config.tabwidth())
def __init__(self, parent=None): QsciScintilla.__init__(self, parent) self.setTabWidth(4) self.setTabIndents(True) self.setIndentationsUseTabs(False) self._lexer = QsciLexerPython() self._lexer.setFont(QFont('DejaVu Sans Mono')) self._lexer.setIndentationWarning(QsciLexerPython.Tabs) # load current preview to lexer api = QsciAPIs(self._lexer) api.load('/tmp/preview.py') api.prepare() self.setLexer(self._lexer) self.setAutoCompletionSource(QsciScintilla.AcsAll) self.setAutoCompletionThreshold(2) self.setAutoIndent(True) self.setCaretForegroundColor(g.cursor_color) self.zoomTo(5)
def __init__(self, editor=None, parent=None): QsciScintilla.__init__(self, parent) self.editor = editor self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.setCursor(QtCore.Qt.PointingHandCursor) self.viewport().setCursor(QtCore.Qt.PointingHandCursor) self.setMarginWidth(1, 0) font = QtGui.QFont() font.setPointSize(1) self.setFont(font) self.setDocument(self.editor.document()) self.setMaximumWidth(120) self.setMinimumWidth(120) self.editorVericalScrollBar = self.editor.verticalScrollBar() self.handle = Handle(self) self.handle.setMinimumWidth(120) self.turnOn()
def __init__(self, parent=None): QsciScintilla.__init__(self, parent)
def __init__(self, parent): QsciScintilla.__init__(self, parent) self.set_up()
def __init__(self, parent): QsciScintilla.__init__(self, parent) self.__lexer = None self.__do = None
def __init__(self, parent=None): QsciScintilla.__init__(self, parent) self.font = None self.lexer = None
def __init__(self, parent): """ Text raw editor """ QsciScintilla.__init__(self, parent) self.createWidget()
def __init__(self, parent = None): QsciScintilla.__init__(self, parent) # Time that should enlapse for the tool tip to show self.tool_tip_delay = 1 # Whether or not annotations should be displayed self.annotations_active = False # Set python as language lexer = QsciLexerPython() api = Qsci.QsciAPIs(lexer) self.setLexer(lexer) self.lexer = lexer # NOTE: For some reasone self.lexer() doesn't work # Addictional API api.prepare() lexer.setFoldComments(True) lexer.setFoldCompact(False) # QsciScintilla editing defaults self.setAutoCompletionThreshold(1) self.setAutoCompletionSource(QsciScintilla.AcsAll) self.setAutoIndent(True) self.setIndentationsUseTabs(False) self.setTabIndents(True) self.setBackspaceUnindents(True) self.setIndentationWidth(4) # QScintilla code guides self.setIndentationGuides(True) self.setEdgeMode(QsciScintilla.EDGE_LINE) # Margin 0 is used to display problem markers (errors and warnings) self.setMarginType(0, QsciScintilla.SymbolMargin) self.setMarginWidth(0, 16) self.setMarginMarkerMask(0, 8) # Margin 1 is used to display line numbers self.setMarginType(1, QsciScintilla.TextMarginRightJustified) self._adjust_margin_width() self.setMarginLineNumbers(1, True) self.setMarginMarkerMask(1, 0) # Margin 2 is used to display folding commands self.setMarginType(2, QsciScintilla.SymbolMargin) self.setFolding(QsciScintilla.CircledTreeFoldStyle) # Syntax errors highlight symbols crosscircle_icon = QPixmap("images/crosscircle.png") self._syntax_error_marker = self.markerDefine(crosscircle_icon, 3) self._syntax_error_indicator = self.indicatorDefine( QsciScintilla.SquiggleIndicator) self.setIndicatorForegroundColor(Qt.red, self._syntax_error_indicator) # SyntaxError list self._syntax_errors = [] # Ensure the margin width is enough to show line numbers self.linesChanged.connect(self._adjust_margin_width) # Enable mouse tracking for tooltips QsciScintilla.setMouseTracking(self, True) # Line tool tip timer self._tool_tip_timer = QTimer(self) self._tool_tip_timer.setSingleShot(True) self._tool_tip_timer.timeout.connect(self._show_tool_tip) # Keep track of the mouse position self._mouse_position = None self._global_mouse_position = None
def __init__(self,parent,text,nfile): QsciScintilla.__init__(self,parent) self.parent = parent self.errorLines = [] self.setText(text) if(config.encoding() == Encoding.ASCII): self.setUtf8(False) #print "ascii set" else: self.setUtf8(True) #print "unicode set" if(eol == 0): self.setEolMode(self.EolWindows) elif(eol == 1): self.setEolMode(self.EolUnix) else: self.setEolMode(self.EolMac) if(config.whiteSpace()): self.setWhitespaceVisibility(True) self.cursorPositionChanged.connect(self.parent.updateLine) #self.linesChanged.connect(self.changeMarginWidht()) #Indicator #self.setIndicatorForegroundColor(self.colorStyle.color) #self.setIndicatorOutlineColor(self.colorStyle.paper) #Marker self.markerDefine(QsciScintilla.RightArrow,self.ARROW_MARKER_NUM) self.markerDefine(Auto.auto_error,0) self.font = QFont(config.fontName(),config.fontSize()) #self.font.setFixedPitch(True) self.setFont(self.font) self.fontmetrics = QFontMetrics(self.font) self.setMarginsFont(self.font) # Margin 0 is used for line numbers self.setMarginSensitivity(0, True) #self.connect(self,SIGNAL('marginClicked(int, int, Qt::KeyboardModifiers)'),self.on_margin_clicked) self.setCaretLineVisible(True) #Code-Complete self.registerImage(0,Auto.auto_class2) self.registerImage(1,Auto.auto_method) self.registerImage(2,Auto.auto_field) self.registerImage(3,Auto.auto_package) self.setAutoCompletionThreshold(config.thresh()) self.setAutoCompletionSource(QsciScintilla.AcsAPIs) self.setBraceMatching(QsciScintilla.SloppyBraceMatch) self.setBackspaceUnindents(True) self.setAutoCompletionCaseSensitivity(True) self.setIndentationsUseTabs(True) self.setTabIndents(True) self.setAutoIndent(True) self.setMargin(config.margin()) self.setIndent(config.indent()) self.setTabWidth(config.tabwidth()) #self.copyAvailable.connect(self.highlightWord) #self.indicatorClicked.connect(self.indicate) self.setIndicatorOutlineColor(QColor("#000000")) self.indicatorDefine(self.INDIC_BOX) #self.setFolding(QsciScintilla.BoxedTreeFoldStyle) #self.setAutoCompletionSource(QsciScintilla.AcsAll) #self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1, 'Courier') #self.setIndentation(5,25) #self.setSelectionBackgroundColor() #self.setSelectionForegroundColor() #self.SendScintilla(QsciScintilla.SCI_MARKERSETBACK,11,QColor(220,220,220)) self.setLanguage(nfile) self.setEditorStyle() #important must not change this position self.setApi("emo")
def __init__(self): QsciScintilla.__init__(self)
def __init__(self, interpreter, message="", log='', parent=None): """Constructor. @param interpreter : InteractiveInterpreter in which the code will be executed @param message : welcome message string @param 'parent' : specifies the parent widget. If no parent widget has been specified, it is possible to exit the interpreter by Ctrl-D. """ QsciScintilla.__init__(self, parent) self.interpreter = interpreter # user interface setup self.setAutoIndent(True) self.setAutoCompletionThreshold(4) self.setAutoCompletionSource(QsciScintilla.AcsDocument) # Lexer self.setLexer(QsciLexerPython(self)) # Search self.incrementalSearchString = "" self.incrementalSearchActive = False self.inRawMode = False self.echoInput = True # Initialize history self.historyLists = {} self.maxHistoryEntries = 100 self.history = [] self.histidx = -1 # # capture all interactive input/output sys.stdout = self sys.stderr = MultipleRedirection((sys.stderr, self)) sys.stdin = self self.reading = 0 # interpreter prompt. try: sys.ps1 except AttributeError: sys.ps1 = ">>> " try: sys.ps2 except AttributeError: sys.ps2 = "... " #self.completionText = "" # Excecution Status self.more = False # Multi line execution Buffer self.execlines = [] # interpreter banner self.write('The shell running Python %s on %s.\n' % (sys.version, sys.platform)) self.write('Type "copyright", "credits" or "license"' ' for more information on Python.\n') self.write(message + '\n') #self.write("help -> Python help system.\n") self.write(" object? -> Print details about 'object'\n\n") self.write(sys.ps1) #self.standardCommands().clearKeys() self.keymap = { Qt.Key_Backspace: self.__QScintillaDeleteBack, Qt.Key_Delete: self.__QScintillaDelete, Qt.Key_Return: self.__QScintillaNewline, Qt.Key_Enter: self.__QScintillaNewline, Qt.Key_Tab: self.__QScintillaTab, Qt.Key_Left: self.__QScintillaCharLeft, Qt.Key_Right: self.__QScintillaCharRight, Qt.Key_Up: self.__QScintillaLineUp, Qt.Key_Down: self.__QScintillaLineDown, Qt.Key_Home: self.__QScintillaVCHome, Qt.Key_End: self.__QScintillaLineEnd, } self.connect(self, QtCore.SIGNAL('userListActivated(int, const QString)'), self.__completionListSelected)
def __init__(self, interpreter, message="", log='', parent=None): """Constructor. @param interpreter : InteractiveInterpreter in which the code will be executed @param message : welcome message string @param 'parent' : specifies the parent widget. If no parent widget has been specified, it is possible to exit the interpreter by Ctrl-D. """ QsciScintilla.__init__(self, parent) self.interpreter = interpreter # user interface setup self.setAutoIndent(True) self.setAutoCompletionThreshold(4) self.setAutoCompletionSource(QsciScintilla.AcsDocument) # Lexer self.setLexer(QsciLexerPython(self)) # Search self.incrementalSearchString = "" self.incrementalSearchActive = False self.inRawMode = False self.echoInput = True # Initialize history self.historyLists = {} self.maxHistoryEntries = 1000 self.H = History("%s/.ghist"%os.environ['HOME']) # Added by vb self.history = self.H.load(self.maxHistoryEntries) # Added by vb # self.history = [] self.histidx = -1 # # capture all interactive input/output sys.stdout = self sys.stderr = MultipleRedirection((sys.stderr, self)) sys.stdin = self self.reading = 0 # interpreter prompt. try: sys.ps1 except AttributeError: sys.ps1 = ">>> " try: sys.ps2 except AttributeError: sys.ps2 = "... " #self.completionText = "" # Excecution Status self.more = False # Multi line execution Buffer self.execlines = [] # interpreter banner self.write('The shell running Python %s on %s.\n' % (sys.version, sys.platform)) self.write('Type "copyright", "credits" or "license"' ' for more information on Python.\n') self.write(message+'\n\n') self.write(sys.ps1) #self.standardCommands().clearKeys() self.keymap = { Qt.Key_Backspace : self.__QScintillaDeleteBack, Qt.Key_Delete : self.__QScintillaDelete, Qt.Key_Return : self.__QScintillaNewline, Qt.Key_Enter : self.__QScintillaNewline, Qt.Key_Tab : self.__QScintillaTab, Qt.Key_Left : self.__QScintillaCharLeft, Qt.Key_Right : self.__QScintillaCharRight, Qt.Key_Up : self.__QScintillaLineUp, Qt.Key_Down : self.__QScintillaLineDown, Qt.Key_Home : self.__QScintillaVCHome, Qt.Key_End : self.__QScintillaLineEnd, } self.connect(self, QtCore.SIGNAL('userListActivated(int, const QString)'), self.__completionListSelected)