本文整理汇总了Python中PyQt4.Qsci.QsciAPIs.loadPrepared方法的典型用法代码示例。如果您正苦于以下问题:Python QsciAPIs.loadPrepared方法的具体用法?Python QsciAPIs.loadPrepared怎么用?Python QsciAPIs.loadPrepared使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qsci.QsciAPIs
的用法示例。
在下文中一共展示了QsciAPIs.loadPrepared方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ShellScintilla
# 需要导入模块: from PyQt4.Qsci import QsciAPIs [as 别名]
# 或者: from PyQt4.Qsci.QsciAPIs import loadPrepared [as 别名]
#.........这里部分代码省略.........
self.append("from PyQt4.QtCore import *")
elif command == "qtGui":
# import QtGui class
self.append("from PyQt4.QtGui import *")
self.entered()
self.move_cursor_to_end()
self.setFocus()
def setLexers(self):
self.lexer = QsciLexerPython()
loadFont = self.settings.value("pythonConsole/fontfamilytext", "Monospace").toString()
fontSize = self.settings.value("pythonConsole/fontsize", 10).toInt()[0]
font = QFont(loadFont)
font.setFixedPitch(True)
font.setPointSize(fontSize)
font.setStyleHint(QFont.TypeWriter)
font.setStretch(QFont.SemiCondensed)
font.setLetterSpacing(QFont.PercentageSpacing, 87.0)
font.setBold(False)
self.lexer.setDefaultFont(font)
self.lexer.setColor(Qt.red, 1)
self.lexer.setColor(Qt.darkGreen, 5)
self.lexer.setColor(Qt.darkBlue, 15)
self.lexer.setFont(font, 1)
self.lexer.setFont(font, 3)
self.lexer.setFont(font, 4)
self.api = QsciAPIs(self.lexer)
chekBoxAPI = self.settings.value("pythonConsole/preloadAPI", True).toBool()
if chekBoxAPI:
self.api.loadPrepared(QgsApplication.pkgDataPath() + "/python/qsci_apis/pyqgis_master.pap")
else:
apiPath = self.settings.value("pythonConsole/userAPI").toStringList()
for i in range(0, len(apiPath)):
self.api.load(QString(unicode(apiPath[i])))
self.api.prepare()
self.lexer.setAPIs(self.api)
self.setLexer(self.lexer)
## TODO: show completion list for file and directory
def completion_list_selected(self, id, txt):
if id == 1:
txt = unicode(txt)
# get current cursor position
line, pos = self.getCursorPosition()
selCmdLength = self.text(line).length()
# select typed text
self.setSelection(line, 4, line, selCmdLength)
self.removeSelectedText()
self.insert(txt)
def getText(self):
""" Get the text as a unicode string. """
value = self.getBytes().decode("utf-8")
# print (value) printing can give an error because the console font
# may not have all unicode characters
return value
def getBytes(self):
""" Get the text as bytes (utf-8 encoded). This is how
the data is stored internally. """
示例2: ShellScintilla
# 需要导入模块: from PyQt4.Qsci import QsciAPIs [as 别名]
# 或者: from PyQt4.Qsci.QsciAPIs import loadPrepared [as 别名]
#.........这里部分代码省略.........
font = QFont(loadFont)
font.setFixedPitch(True)
font.setPointSize(fontSize)
font.setStyleHint(QFont.TypeWriter)
font.setStretch(QFont.SemiCondensed)
font.setLetterSpacing(QFont.PercentageSpacing, 87.0)
font.setBold(False)
self.lexer.setDefaultFont(font)
self.lexer.setDefaultColor(QColor(self.settings.value("pythonConsole/defaultFontColor", QColor(Qt.black))))
self.lexer.setColor(QColor(self.settings.value("pythonConsole/commentFontColor", QColor(Qt.gray))), 1)
self.lexer.setColor(QColor(self.settings.value("pythonConsole/keywordFontColor", QColor(Qt.darkGreen))), 5)
self.lexer.setColor(QColor(self.settings.value("pythonConsole/classFontColor", QColor(Qt.blue))), 8)
self.lexer.setColor(QColor(self.settings.value("pythonConsole/methodFontColor", QColor(Qt.darkGray))), 9)
self.lexer.setColor(QColor(self.settings.value("pythonConsole/decorFontColor", QColor(Qt.darkBlue))), 15)
self.lexer.setColor(QColor(self.settings.value("pythonConsole/commentBlockFontColor", QColor(Qt.gray))), 12)
self.lexer.setColor(QColor(self.settings.value("pythonConsole/singleQuoteFontColor", QColor(Qt.blue))), 4)
self.lexer.setColor(QColor(self.settings.value("pythonConsole/doubleQuoteFontColor", QColor(Qt.blue))), 3)
self.lexer.setColor(QColor(self.settings.value("pythonConsole/tripleSingleQuoteFontColor", QColor(Qt.blue))), 6)
self.lexer.setColor(QColor(self.settings.value("pythonConsole/tripleDoubleQuoteFontColor", QColor(Qt.blue))), 7)
self.lexer.setFont(font, 1)
self.lexer.setFont(font, 3)
self.lexer.setFont(font, 4)
for style in range(0, 33):
paperColor = QColor(self.settings.value("pythonConsole/paperBackgroundColor", QColor(Qt.white)))
self.lexer.setPaper(paperColor, style)
self.api = QsciAPIs(self.lexer)
chekBoxAPI = self.settings.value("pythonConsole/preloadAPI", True, type=bool)
chekBoxPreparedAPI = self.settings.value("pythonConsole/usePreparedAPIFile", False, type=bool)
if chekBoxAPI:
pap = os.path.join(QgsApplication.pkgDataPath(), "python", "qsci_apis", "pyqgis.pap")
self.api.loadPrepared(pap)
elif chekBoxPreparedAPI:
self.api.loadPrepared(self.settings.value("pythonConsole/preparedAPIFile"))
else:
apiPath = self.settings.value("pythonConsole/userAPI", [])
for i in range(0, len(apiPath)):
self.api.load(unicode(apiPath[i]))
self.api.prepare()
self.lexer.setAPIs(self.api)
self.setLexer(self.lexer)
## TODO: show completion list for file and directory
def getText(self):
""" Get the text as a unicode string. """
value = self.getBytes().decode('utf-8')
# print (value) printing can give an error because the console font
# may not have all unicode characters
return value
def getBytes(self):
""" Get the text as bytes (utf-8 encoded). This is how
the data is stored internally. """
len = self.SendScintilla(self.SCI_GETLENGTH)+1
bb = QByteArray(len,'0')
N = self.SendScintilla(self.SCI_GETTEXT, len, bb)
return bytes(bb)[:-1]
def getTextLength(self):
return self.SendScintilla(QsciScintilla.SCI_GETLENGTH)
def get_end_pos(self):
示例3: ScriptEdit
# 需要导入模块: from PyQt4.Qsci import QsciAPIs [as 别名]
# 或者: from PyQt4.Qsci.QsciAPIs import loadPrepared [as 别名]
#.........这里部分代码省略.........
settings = QSettings()
fontName = settings.value('pythonConsole/fontfamilytext', 'Monospace')
fontSize = int(settings.value('pythonConsole/fontsize', size))
self.defaultFont = QFont(fontName)
self.defaultFont.setFixedPitch(True)
self.defaultFont.setPointSize(fontSize)
self.defaultFont.setStyleHint(QFont.TypeWriter)
self.defaultFont.setStretch(QFont.SemiCondensed)
self.defaultFont.setLetterSpacing(QFont.PercentageSpacing, 87.0)
self.defaultFont.setBold(False)
self.boldFont = QFont(self.defaultFont)
self.boldFont.setBold(True)
self.italicFont = QFont(self.defaultFont)
self.italicFont.setItalic(True)
self.setFont(self.defaultFont)
self.setMarginsFont(self.defaultFont)
def initShortcuts(self):
(ctrl, shift) = (self.SCMOD_CTRL << 16, self.SCMOD_SHIFT << 16)
# Disable some shortcuts
self.SendScintilla(QsciScintilla.SCI_CLEARCMDKEY, ord('D') + ctrl)
self.SendScintilla(QsciScintilla.SCI_CLEARCMDKEY, ord('L') + ctrl)
self.SendScintilla(QsciScintilla.SCI_CLEARCMDKEY, ord('L') + ctrl
+ shift)
self.SendScintilla(QsciScintilla.SCI_CLEARCMDKEY, ord('T') + ctrl)
#self.SendScintilla(QsciScintilla.SCI_CLEARCMDKEY, ord("Z") + ctrl)
#self.SendScintilla(QsciScintilla.SCI_CLEARCMDKEY, ord("Y") + ctrl)
# Use Ctrl+Space for autocompletion
self.shortcutAutocomplete = QShortcut(QKeySequence(Qt.CTRL
+ Qt.Key_Space), self)
self.shortcutAutocomplete.setContext(Qt.WidgetShortcut)
self.shortcutAutocomplete.activated.connect(self.autoComplete)
def autoComplete(self):
self.autoCompleteFromAll()
def setLexerType(self, lexerType):
self.lexerType = lexerType
self.initLexer()
def initLexer(self):
if self.lexerType == self.LEXER_PYTHON:
self.lexer = QsciLexerPython()
colorDefault = QColor('#2e3436')
colorComment = QColor('#c00')
colorCommentBlock = QColor('#3465a4')
colorNumber = QColor('#4e9a06')
colorType = QColor('#4e9a06')
colorKeyword = QColor('#204a87')
colorString = QColor('#ce5c00')
self.lexer.setDefaultFont(self.defaultFont)
self.lexer.setDefaultColor(colorDefault)
self.lexer.setColor(colorComment, 1)
self.lexer.setColor(colorNumber, 2)
self.lexer.setColor(colorString, 3)
self.lexer.setColor(colorString, 4)
self.lexer.setColor(colorKeyword, 5)
self.lexer.setColor(colorString, 6)
self.lexer.setColor(colorString, 7)
self.lexer.setColor(colorType, 8)
self.lexer.setColor(colorCommentBlock, 12)
self.lexer.setColor(colorString, 15)
self.lexer.setFont(self.italicFont, 1)
self.lexer.setFont(self.boldFont, 5)
self.lexer.setFont(self.boldFont, 8)
self.lexer.setFont(self.italicFont, 12)
self.api = QsciAPIs(self.lexer)
settings = QSettings()
useDefaultAPI = bool(settings.value('pythonConsole/preloadAPI',
True))
if useDefaultAPI:
# Load QGIS API shipped with Python console
self.api.loadPrepared(
os.path.join(QgsApplication.pkgDataPath(),
'python', 'qsci_apis', 'pyqgis.pap'))
else:
# Load user-defined API files
apiPaths = settings.value('pythonConsole/userAPI', [])
for path in apiPaths:
self.api.load(path)
self.api.prepare()
self.lexer.setAPIs(self.api)
elif self.lexerType == self.LEXER_R:
# R lexer
self.lexer = LexerR()
self.setLexer(self.lexer)
示例4: Editor
# 需要导入模块: from PyQt4.Qsci import QsciAPIs [as 别名]
# 或者: from PyQt4.Qsci.QsciAPIs import loadPrepared [as 别名]
#.........这里部分代码省略.........
else:
self.markerAdd(nline, self.ARROW_MARKER_NUM)
def setLexers(self):
from qgis.core import QgsApplication
self.lexer = QsciLexerPython()
self.lexer.setIndentationWarning(QsciLexerPython.Inconsistent)
self.lexer.setFoldComments(True)
self.lexer.setFoldQuotes(True)
loadFont = self.settings.value("pythonConsole/fontfamilytextEditor", "Monospace").toString()
fontSize = self.settings.value("pythonConsole/fontsizeEditor", 10).toInt()[0]
font = QFont(loadFont)
font.setFixedPitch(True)
font.setPointSize(fontSize)
font.setStyleHint(QFont.TypeWriter)
font.setStretch(QFont.SemiCondensed)
font.setLetterSpacing(QFont.PercentageSpacing, 87.0)
font.setBold(False)
self.lexer.setDefaultFont(font)
self.lexer.setColor(Qt.red, 1)
self.lexer.setColor(Qt.darkGreen, 5)
self.lexer.setColor(Qt.darkBlue, 15)
self.lexer.setFont(font, 1)
self.lexer.setFont(font, 3)
self.lexer.setFont(font, 4)
self.api = QsciAPIs(self.lexer)
chekBoxAPI = self.settings.value("pythonConsole/preloadAPI", True).toBool()
if chekBoxAPI:
self.api.loadPrepared( QgsApplication.pkgDataPath() + "/python/qsci_apis/pyqgis_master.pap" )
else:
apiPath = self.settings.value("pythonConsole/userAPI").toStringList()
for i in range(0, len(apiPath)):
self.api.load(QString(unicode(apiPath[i])))
self.api.prepare()
self.lexer.setAPIs(self.api)
self.setLexer(self.lexer)
def move_cursor_to_end(self):
"""Move cursor to end of text"""
line, index = self.get_end_pos()
self.setCursorPosition(line, index)
self.ensureCursorVisible()
self.ensureLineVisible(line)
def get_end_pos(self):
"""Return (line, index) position of the last character"""
line = self.lines() - 1
return (line, self.text(line).length())
def contextMenuEvent(self, e):
menu = QMenu(self)
iconRun = QgsApplication.getThemeIcon("console/iconRunConsole.png")
iconCodePad = QgsApplication.getThemeIcon("console/iconCodepadConsole.png")
iconNewEditor = QgsApplication.getThemeIcon("console/iconTabEditorConsole.png")
iconCommentEditor = QgsApplication.getThemeIcon("console/iconCommentEditorConsole.png")
iconUncommentEditor = QgsApplication.getThemeIcon("console/iconUncommentEditorConsole.png")
iconSettings = QgsApplication.getThemeIcon("console/iconSettingsConsole.png")
hideEditorAction = menu.addAction("Hide Editor",
self.hideEditor)
menu.addSeparator()
示例5: PythonEdit
# 需要导入模块: from PyQt4.Qsci import QsciAPIs [as 别名]
# 或者: from PyQt4.Qsci.QsciAPIs import loadPrepared [as 别名]
#.........这里部分代码省略.........
elif command == "qtCore":
"""Import QtCore class"""
self.append('from PyQt4.QtCore import *')
self.move_cursor_to_end()
elif command == "qtGui":
"""Import QtGui class"""
self.append('from PyQt4.QtGui import *')
self.move_cursor_to_end()
self.setFocus()
def setLexers(self):
from qgis.core import QgsApplication
self.lexer = QsciLexerPython()
settings = QSettings()
loadFont = settings.value("pythonConsole/fontfamilytext", "Monospace").toString()
fontSize = settings.value("pythonConsole/fontsize", 10).toInt()[0]
font = QFont(loadFont)
font.setFixedPitch(True)
font.setPointSize(fontSize)
self.lexer.setDefaultFont(font)
self.lexer.setColor(Qt.red, 1)
self.lexer.setColor(Qt.darkGreen, 5)
self.lexer.setColor(Qt.darkBlue, 15)
self.lexer.setFont(font, 1)
self.lexer.setFont(font, 3)
self.lexer.setFont(font, 4)
self.api = QsciAPIs(self.lexer)
chekBoxAPI = settings.value( "pythonConsole/preloadAPI" ).toBool()
if chekBoxAPI:
self.api.loadPrepared( QgsApplication.pkgDataPath() + "/python/qsci_apis/pyqgis_master.pap" )
else:
apiPath = settings.value("pythonConsole/userAPI").toStringList()
for i in range(0, len(apiPath)):
self.api.load(QString(unicode(apiPath[i])))
self.api.prepare()
self.lexer.setAPIs(self.api)
self.setLexer(self.lexer)
## TODO: show completion list for file and directory
def completion_list_selected(self, id, txt):
if id == 1:
txt = unicode(txt)
# get current cursor position
line, pos = self.getCursorPosition()
selCmdLength = self.text(line).length()
# select typed text
self.setSelection(line, 4, line, selCmdLength)
self.removeSelectedText()
self.insert(txt)
def insertInitText(self):
#self.setLexers(False)
txtInit = QCoreApplication.translate("PythonConsole",
"## To access Quantum GIS environment from this console\n"
"## use qgis.utils.iface object (instance of QgisInterface class). Read help for more info.\n\n")
initText = self.setText(txtInit)
def getText(self):
""" Get the text as a unicode string. """
value = self.getBytes().decode('utf-8')
示例6: QsciEditor
# 需要导入模块: from PyQt4.Qsci import QsciAPIs [as 别名]
# 或者: from PyQt4.Qsci.QsciAPIs import loadPrepared [as 别名]
#.........这里部分代码省略.........
# 0: Folding margin
self.setMarginWidth(2, 14)
self.setFolding(QsciScintilla.BoxedFoldStyle)
# Colors
fcol = CONF.get('scintilla', 'margins/foregroundcolor')
bcol = CONF.get('scintilla', 'margins/backgroundcolor')
if fcol:
self.setMarginsForegroundColor(QColor(fcol))
if bcol:
self.setMarginsBackgroundColor(QColor(bcol))
fcol = CONF.get('scintilla', 'foldmarginpattern/foregroundcolor')
bcol = CONF.get('scintilla', 'foldmarginpattern/backgroundcolor')
if fcol and bcol:
self.setFoldMarginColors(QColor(fcol), QColor(bcol))
def setup_api(self):
"""Load and prepare Python API"""
if self.lexer() is None:
return
self.api = QsciAPIs(self.lexer())
is_api_ready = False
api_path = CONF.get('editor', 'api')
if not osp.isfile(api_path):
from spyderlib.config import DATA_PATH
api_path = osp.join(DATA_PATH, 'python.api')
if osp.isfile(api_path):
CONF.set('editor', 'api', api_path)
else:
return False
api_size = CONF.get('editor', 'api_size', None)
current_api_size = os.stat(api_path).st_size
if api_size is not None and api_size == current_api_size:
if self.api.isPrepared():
is_api_ready = self.api.loadPrepared()
else:
CONF.set('editor', 'api_size', current_api_size)
if not is_api_ready:
if self.api.load(api_path):
self.api.prepare()
self.connect(self.api, SIGNAL("apiPreparationFinished()"),
self.api.savePrepared)
return is_api_ready
def set_eol_chars_visible(self, state):
"""Show/hide EOL characters"""
self.setEolVisibility(state)
def remove_trailing_spaces(self):
"""Remove trailing spaces"""
text_before = unicode(self.text())
text_after = sourcecode.remove_trailing_spaces(text_before)
if text_before != text_after:
self.setText(text_after)
def fix_indentation(self):
"""Replace tabs by spaces"""
text_before = unicode(self.text())
text_after = sourcecode.fix_indentation(text_before)
if text_before != text_after:
self.setText(text_after)
def set_eol_mode(self, text):
"""
Set QScintilla widget EOL mode based on *text* EOL characters
"""
if isinstance(text, QString):
示例7: APIs
# 需要导入模块: from PyQt4.Qsci import QsciAPIs [as 别名]
# 或者: from PyQt4.Qsci.QsciAPIs import loadPrepared [as 别名]
class APIs(QObject):
"""
Class implementing an API storage entity.
@signal apiPreparationFinished() emitted after the API preparation has finished
@signal apiPreparationCancelled() emitted after the API preparation has been cancelled
@signal apiPreparationStarted() emitted after the API preparation has started
"""
def __init__(self, language, forPreparation = False, parent = None):
"""
Constructor
@param language language of the APIs object (string)
@param forPreparation flag indicating this object is just needed
for a preparation process (boolean)
@param parent reference to the parent object (QObject)
"""
QObject.__init__(self, parent)
self.setObjectName("APIs_%s" % language)
self.__inPreparation = False
self.__language = language
self.__forPreparation = forPreparation
self.__lexer = Lexers.getLexer(self.__language)
self.__apifiles = Preferences.getEditorAPI(self.__language)
self.__apifiles.sort()
if self.__lexer is None:
self.__apis = None
else:
self.__apis = QsciAPIs(self.__lexer)
self.connect(self.__apis, SIGNAL("apiPreparationFinished()"),
self.__apiPreparationFinished)
self.connect(self.__apis, SIGNAL("apiPreparationCancelled()"),
self.__apiPreparationCancelled)
self.connect(self.__apis, SIGNAL("apiPreparationStarted()"),
self.__apiPreparationStarted)
self.__loadAPIs()
def __loadAPIs(self):
"""
Private method to load the APIs.
"""
if self.__apis.isPrepared():
# load a prepared API file
if not self.__forPreparation and Preferences.getEditor("AutoPrepareAPIs"):
self.prepareAPIs()
self.__apis.loadPrepared()
else:
# load the raw files and prepare the API file
if not self.__forPreparation and Preferences.getEditor("AutoPrepareAPIs"):
self.prepareAPIs(ondemand = True)
def reloadAPIs(self):
"""
Public method to reload the API information.
"""
if not self.__forPreparation and Preferences.getEditor("AutoPrepareAPIs"):
self.prepareAPIs()
self.__loadAPIs()
def getQsciAPIs(self):
"""
Public method to get a reference to QsciAPIs object.
@return reference to the QsciAPIs object (QsciAPIs)
"""
if not self.__forPreparation and Preferences.getEditor("AutoPrepareAPIs"):
self.prepareAPIs()
return self.__apis
def __apiPreparationFinished(self):
"""
Private method called to save an API, after it has been prepared.
"""
res = self.__apis.savePrepared()
self.__inPreparation = False
self.emit(SIGNAL('apiPreparationFinished()'))
def __apiPreparationCancelled(self):
"""
Private method called, after the API preparation process has been cancelled.
"""
self.__inPreparation = False
self.emit(SIGNAL('apiPreparationCancelled()'))
def __apiPreparationStarted(self):
"""
Private method called, when the API preparation process started.
"""
self.__inPreparation = True
self.emit(SIGNAL('apiPreparationStarted()'))
def prepareAPIs(self, ondemand = False, rawList = None):
"""
Public method to prepare the APIs if necessary.
@keyparam ondemand flag indicating a requested preparation (boolean)
@keyparam rawList list of raw API files (QStringList)
"""
if self.__apis is None or self.__inPreparation:
#.........这里部分代码省略.........
示例8: QsciEditor
# 需要导入模块: from PyQt4.Qsci import QsciAPIs [as 别名]
# 或者: from PyQt4.Qsci.QsciAPIs import loadPrepared [as 别名]
#.........这里部分代码省略.........
self.setMarginWidth(0, 14)
self.connect(self,
SIGNAL('marginClicked(int,int,Qt::KeyboardModifiers)'),
self.__margin_clicked)
if code_folding:
# 0: Folding margin
self.setMarginWidth(2, 14)
self.setFolding(QsciScintilla.BoxedFoldStyle)
# Colors
fcol = CONF.get('scintilla', 'margins/foregroundcolor')
bcol = CONF.get('scintilla', 'margins/backgroundcolor')
if fcol:
self.setMarginsForegroundColor(QColor(fcol))
if bcol:
self.setMarginsBackgroundColor(QColor(bcol))
fcol = CONF.get('scintilla', 'foldmarginpattern/foregroundcolor')
bcol = CONF.get('scintilla', 'foldmarginpattern/backgroundcolor')
if fcol and bcol:
self.setFoldMarginColors(QColor(fcol), QColor(bcol))
def setup_api(self):
"""Load and prepare API"""
if self.lexer() is None:
return
self.api = QsciAPIs(self.lexer())
is_api_ready = False
api_path = CONF.get('editor', 'api')
if not os.path.isfile(api_path):
return False
api_stat = CONF.get('editor', 'api_stat', None)
current_api_stat = os.stat(api_path)
if (api_stat is not None) and (api_stat == current_api_stat):
if self.api.isPrepared():
is_api_ready = self.api.loadPrepared()
else:
CONF.set('editor', 'api_stat', current_api_stat)
if not is_api_ready:
if self.api.load(api_path):
self.api.prepare()
self.connect(self.api, SIGNAL("apiPreparationFinished()"),
self.api.savePrepared)
return is_api_ready
def set_whitespace_visible(self, state):
"""Show/hide whitespace"""
if state:
self.setWhitespaceVisibility(QsciScintilla.WsVisible)
else:
self.setWhitespaceVisibility(QsciScintilla.WsInvisible)
def set_eol_chars_visible(self, state):
"""Show/hide EOL characters"""
self.setEolVisibility(state)
def convert_eol_chars(self):
"""Convert EOL characters to current mode"""
self.convertEols(self.eolMode())
def remove_trailing_spaces(self):
"""Remove trailing spaces"""
text_before = unicode(self.text())
text_after = sourcecode.remove_trailing_spaces(text_before)
if text_before != text_after:
self.setText(text_after)
def fix_indentation(self):