本文整理汇总了Python中PyQt5.QtGui.QTextCharFormat.setUnderlineColor方法的典型用法代码示例。如果您正苦于以下问题:Python QTextCharFormat.setUnderlineColor方法的具体用法?Python QTextCharFormat.setUnderlineColor怎么用?Python QTextCharFormat.setUnderlineColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui.QTextCharFormat
的用法示例。
在下文中一共展示了QTextCharFormat.setUnderlineColor方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: css2fmt
# 需要导入模块: from PyQt5.QtGui import QTextCharFormat [as 别名]
# 或者: from PyQt5.QtGui.QTextCharFormat import setUnderlineColor [as 别名]
def css2fmt(d, f=None):
"""Convert a css dictionary to a QTextCharFormat."""
if f is None:
f = QTextCharFormat()
v = d.get('font-style')
if v:
f.setFontItalic(v in ('oblique', 'italic'))
v = d.get('font-weight')
if v:
if v == 'bold':
f.setFontWeight(QFont.Bold)
elif v == 'normal':
f.setFontWeight(QFont.Normal)
elif v.isdigit():
f.setFontWeight(int(v) / 10)
v = d.get('color')
if v:
f.setForeground(QColor(v))
v = d.get('background')
if v:
f.setBackground(QColor(v))
v = d.get('text-decoration')
if v:
f.setFontUnderline(v == 'underline')
v = d.get('text-decoration-color')
if v:
f.setUnderlineColor(QColor(v))
return f
示例2: highlightBlock
# 需要导入模块: from PyQt5.QtGui import QTextCharFormat [as 别名]
# 或者: from PyQt5.QtGui.QTextCharFormat import setUnderlineColor [as 别名]
def highlightBlock(self, text):
# Syntax highlighter
if self.docType in self.patternsDict:
for number in self.patternsDict[self.docType]:
pattern = self.patterns[number]
for match in pattern[0].finditer(text):
for i, formatter in enumerate(pattern[1:]):
charFormat = QTextCharFormat()
formatter.format(charFormat)
self.setFormat(QString_length(text[:match.start(i)]),
QString_length(match.group(i)),
charFormat)
for match in reSpacesOnEnd.finditer(text):
charFormat = QTextCharFormat()
charFormat.setBackground(colorScheme['whitespaceOnEnd'])
self.setFormat(QString_length(text[:match.start()]),
QString_length(match.group(0)),
charFormat)
# Spell checker
if self.dictionary:
charFormat = QTextCharFormat()
charFormat.setUnderlineColor(Qt.red)
charFormat.setUnderlineStyle(QTextCharFormat.WaveUnderline)
for match in reWords.finditer(text):
finalFormat = QTextCharFormat()
finalFormat.merge(charFormat)
finalFormat.merge(self.format(match.start()))
if not self.dictionary.check(match.group(0)):
self.setFormat(QString_length(text[:match.start()]),
QString_length(match.group(0)),
finalFormat)
示例3: highlightBlock
# 需要导入模块: from PyQt5.QtGui import QTextCharFormat [as 别名]
# 或者: from PyQt5.QtGui.QTextCharFormat import setUnderlineColor [as 别名]
def highlightBlock(self, text):
patterns = (
# regex, color, font style, italic, underline
(reHtmlTags, 'htmlTags', QFont.Bold), # 0
(reHtmlSymbols, 'htmlSymbols', QFont.Bold), # 1
(reHtmlStrings, 'htmlStrings', QFont.Bold), # 2
(reHtmlComments, 'htmlComments', QFont.Normal), # 3
(reAsterisks, None, QFont.Normal, True), # 4
(reUnderline, None, QFont.Normal, True), # 5
(reDblAsterisks, None, QFont.Bold), # 6
(reDblUnderline, None, QFont.Bold), # 7
(reTrpAsterisks, None, QFont.Bold, True), # 8
(reTrpUnderline, None, QFont.Bold, True), # 9
(reMkdHeaders, None, QFont.Black), # 10
(reMkdLinksImgs, 'markdownLinks', QFont.Normal), # 11
(reMkdLinkRefs, None, QFont.Normal, True, True), # 12
(reBlockQuotes, 'blockquotes', QFont.Normal), # 13
(reReSTDirects, 'restDirectives', QFont.Bold), # 14
(reReSTRoles, 'restRoles', QFont.Bold), # 15
(reTextileHdrs, None, QFont.Black), # 16
(reTextileQuot, 'blockquotes', QFont.Normal), # 17
(reAsterisks, None, QFont.Bold), # 18
(reDblUnderline, None, QFont.Normal, True), # 19
)
patternsDict = {
'Markdown': (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13),
'reStructuredText': (4, 6, 14, 15),
'Textile': (0, 5, 6, 16, 17, 18, 19),
'html': (0, 1, 2, 3)
}
# Syntax highlighter
if self.docType in patternsDict:
for number in patternsDict[self.docType]:
pattern = patterns[number]
charFormat = QTextCharFormat()
charFormat.setFontWeight(pattern[2])
if pattern[1] != None:
charFormat.setForeground(colorScheme[pattern[1]])
if len(pattern) >= 4:
charFormat.setFontItalic(pattern[3])
if len(pattern) >= 5:
charFormat.setFontUnderline(pattern[4])
for match in pattern[0].finditer(text):
self.setFormat(match.start(), match.end() - match.start(), charFormat)
for match in reSpacesOnEnd.finditer(text):
charFormat = QTextCharFormat()
charFormat.setBackground(colorScheme['whitespaceOnEnd'])
self.setFormat(match.start(), match.end() - match.start(), charFormat)
# Spell checker
if self.dictionary:
charFormat = QTextCharFormat()
charFormat.setUnderlineColor(Qt.red)
charFormat.setUnderlineStyle(QTextCharFormat.SpellCheckUnderline)
for match in reWords.finditer(text):
finalFormat = QTextCharFormat()
finalFormat.merge(charFormat)
finalFormat.merge(self.format(match.start()))
if not self.dictionary.check(match.group(0)):
self.setFormat(match.start(), match.end() - match.start(), finalFormat)
示例4: make_format
# 需要导入模块: from PyQt5.QtGui import QTextCharFormat [as 别名]
# 或者: from PyQt5.QtGui.QTextCharFormat import setUnderlineColor [as 别名]
def make_format( self, ul_index, qc ) :
qtcf = QTextCharFormat()
qtcf.setUnderlineStyle( ul_index )
if ul_index == QTextCharFormat.NoUnderline :
qtcf.setBackground(QBrush(qc))
else :
qtcf.setUnderlineColor(qc) # underline color gets a QColor
qtcf.clearBackground()
return qtcf
示例5: highlightBlock
# 需要导入模块: from PyQt5.QtGui import QTextCharFormat [as 别名]
# 或者: from PyQt5.QtGui.QTextCharFormat import setUnderlineColor [as 别名]
def highlightBlock(self, text):
patterns = (
# regex, color, font style, italic, underline
(reHtmlTags, colorScheme[0], QFont.Bold),
(reHtmlSymbols, colorScheme[1], QFont.Bold),
(reHtmlStrings, colorScheme[2], QFont.Bold),
(reHtmlComments, colorScheme[3], QFont.Normal),
(reItalics1, None, QFont.Normal, True),
(reItalics2, None, QFont.Normal, True),
(reBold1, None, QFont.Bold),
(reBold2, None, QFont.Bold),
(reBoldItalics1, None, QFont.Bold, True),
(reBoldItalics2, None, QFont.Bold, True),
(reMkdHeaders, None, QFont.Black),
(reMkdLinksImgs, colorScheme[4], QFont.Normal),
(reMkdLinkRefs, None, QFont.Normal, True, True),
(reBlockQuotes, colorScheme[5], QFont.Normal),
(reReSTDirects, colorScheme[6], QFont.Normal),
(reReSTRoles, colorScheme[7], QFont.Normal)
)
patternsDict = {
DOCTYPE_NONE: (),
DOCTYPE_MARKDOWN: (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13),
DOCTYPE_REST: (4, 6, 14, 15),
DOCTYPE_HTML: (0, 1, 2, 3)
}
# Syntax highlighter
if self.docType in patternsDict:
for number in patternsDict[self.docType]:
pattern = patterns[number]
charFormat = QTextCharFormat()
charFormat.setFontWeight(pattern[2])
if pattern[1] != None:
charFormat.setForeground(pattern[1])
if len(pattern) >= 4:
charFormat.setFontItalic(pattern[3])
if len(pattern) >= 5:
charFormat.setFontUnderline(pattern[4])
for match in pattern[0].finditer(text):
self.setFormat(match.start(), match.end() - match.start(), charFormat)
# Spell checker
if self.dictionary:
charFormat = QTextCharFormat()
charFormat.setUnderlineColor(Qt.red)
charFormat.setUnderlineStyle(QTextCharFormat.SpellCheckUnderline)
for match in reWords.finditer(text):
finalFormat = QTextCharFormat()
finalFormat.merge(charFormat)
finalFormat.merge(self.format(match.start()))
if not self.dictionary.check(match.group(0)):
self.setFormat(match.start(), match.end() - match.start(), finalFormat)
示例6: eltToStyle
# 需要导入模块: from PyQt5.QtGui import QTextCharFormat [as 别名]
# 或者: from PyQt5.QtGui.QTextCharFormat import setUnderlineColor [as 别名]
def eltToStyle(elt):
fmt = QTextCharFormat()
if elt.get('bold'):
fmt.setFontWeight(QFont.Bold if toBool(elt.get('bold')) else QFont.Normal)
if elt.get('italic'):
fmt.setFontItalic(toBool(elt.get('italic')))
if elt.get('underline'):
fmt.setFontUnderline(toBool(elt.get('underline')))
if elt.get('textColor'):
fmt.setForeground(QColor(elt.get('textColor')))
if elt.get('backgroundColor'):
fmt.setBackground(QColor(elt.get('backgroundColor')))
if elt.get('underlineColor'):
fmt.setUnderlineColor(QColor(elt.get('underlineColor')))
return fmt
示例7: DNAHighlighter
# 需要导入模块: from PyQt5.QtGui import QTextCharFormat [as 别名]
# 或者: from PyQt5.QtGui.QTextCharFormat import setUnderlineColor [as 别名]
class DNAHighlighter(QSyntaxHighlighter):
def __init__(self, parent):
QSyntaxHighlighter.__init__(self, parent)
self.parent = parent
self.format = QTextCharFormat()
self.format.setForeground(QBrush(styles.INVALID_DNA_COLOR))
if styles.UNDERLINE_INVALID_DNA:
self.format.setFontUnderline(True)
self.format.setUnderlineColor(styles.INVALID_DNA_COLOR)
def highlightBlock(self, text):
index = dnapattern.indexIn(text)
while index >= 0:
length = dnapattern.matchedLength()
self.setFormat(index, length, self.format)
index = text.indexOf(dnapattern, index + length)
self.setCurrentBlockState(0)
示例8: __init__
# 需要导入模块: from PyQt5.QtGui import QTextCharFormat [as 别名]
# 或者: from PyQt5.QtGui.QTextCharFormat import setUnderlineColor [as 别名]
def __init__(self, parent):
super(OutputWidget, self).__init__(parent)
self._parent = parent
self.setWordWrapMode(0)
self.setMouseTracking(True)
self.setFrameShape(0)
self.setUndoRedoEnabled(False)
# Traceback pattern
self.patLink = re.compile(r'(\s)*File "(.*?)", line \d.+')
# For user input
self.__input = []
self.setFont(settings.FONT)
# Formats
plain_format = QTextCharFormat()
normal_format = QTextCharFormat()
normal_format.setForeground(
QColor(resources.COLOR_SCHEME.get("editor.foreground")))
error_format = QTextCharFormat()
error_format.setForeground(QColor('#ff6c6c'))
error_format2 = QTextCharFormat()
error_format2.setToolTip(translations.TR_CLICK_TO_SHOW_SOURCE)
error_format2.setUnderlineStyle(QTextCharFormat.DashUnderline)
error_format2.setForeground(QColor('#ff6c6c'))
error_format2.setUnderlineColor(QColor('#ff6c6c'))
self._text_formats = {
self.Format.NORMAL: normal_format,
self.Format.PLAIN: plain_format,
self.Format.ERROR: error_format,
self.Format.ERROR_UNDERLINE: error_format2
}
self.blockCountChanged[int].connect(
lambda: self.moveCursor(QTextCursor.End))
# Style
palette = self.palette()
palette.setColor(
palette.Base,
QColor(resources.COLOR_SCHEME.get('editor.background')))
self.setPalette(palette)
示例9: spellCheck
# 需要导入模块: from PyQt5.QtGui import QTextCharFormat [as 别名]
# 或者: from PyQt5.QtGui.QTextCharFormat import setUnderlineColor [as 别名]
def spellCheck(self, text, Rule1, Rule2):
"""
Method defines to underline text if word not in Rules
Args:
text (str): current text block to search
Rule1 (list): GROMHighlighter.Red_Rules contains all words
Rule2 (list ) GROMHighlighter.Algorithm_Rules only Algorithm rules
"""
#: Underline words color yellow
format_under = QTextCharFormat()
format_under.setUnderlineColor(Qt.yellow)
format_under.setUnderlineStyle(QTextCharFormat.SpellCheckUnderline)
#: Underlines word if not in Rules
for word_object in re.finditer(self.WORDS, text, re.IGNORECASE):
comment_location = text.find(";")
word = word_object.group()
if word not in Rule1 or word in Rule2 or text[:comment_location].count(str(word)) > 1:
self.setFormat(word_object.start(), word_object.end() - word_object.start(), format_under)
示例10: mk_txt_fmt
# 需要导入模块: from PyQt5.QtGui import QTextCharFormat [as 别名]
# 或者: from PyQt5.QtGui.QTextCharFormat import setUnderlineColor [as 别名]
def mk_txt_fmt(derive=None, fg=None, bg=None, bold=False, ul=None, ul_color=None):
text_format = QTextCharFormat(derive) if derive is not None else QTextCharFormat()
if fg is not None:
text_format.setForeground(QBrush(parse_qcolor(fg)))
if bg is not None:
text_format.setBackground(QBrush(parse_qcolor(bg)))
if bold:
text_format.setFontWeight(QFont.Bold)
if ul is not None:
if ul is True:
text_format.setUnderlineStyle(QTextCharFormat.SingleUnderline)
elif ul in UNDERLINE_STYLES:
text_format.setUnderlineStyle(UNDERLINE_STYLES[ul])
else:
raise ValueError("Unsupported underline style: '{0}'".format(ul))
if ul_color is not None:
text_format.setUnderlineColor(parse_qcolor(ul_color))
return text_format
示例11: DNAHighlighter
# 需要导入模块: from PyQt5.QtGui import QTextCharFormat [as 别名]
# 或者: from PyQt5.QtGui.QTextCharFormat import setUnderlineColor [as 别名]
class DNAHighlighter(QSyntaxHighlighter):
"""Summary
Attributes:
format (TYPE): Description
parent (TYPE): Description
"""
def __init__(self, parent):
"""Summary
Args:
parent (TYPE): Description
"""
QSyntaxHighlighter.__init__(self, parent)
self.parent = parent
self.format = QTextCharFormat()
self.format.setForeground(getBrushObj(Qt.white))
self.format.setBackground(getBrushObj(styles.INVALID_DNA_COLOR))
if styles.UNDERLINE_INVALID_DNA:
self.format.setFontUnderline(True)
self.format.setUnderlineColor(getColorObj(styles.INVALID_DNA_COLOR))
def highlightBlock(self, text):
"""Summary
Args:
text (TYPE): Description
Returns:
TYPE: Description
"""
for match in re.finditer(RE_DNA_PATTERN, text):
index = match.start()
length = match.end() - index
self.setFormat(index, length, self.format)
self.setCurrentBlockState(0)
示例12: type
# 需要导入模块: from PyQt5.QtGui import QTextCharFormat [as 别名]
# 或者: from PyQt5.QtGui.QTextCharFormat import setUnderlineColor [as 别名]
colors.set_current_line_color(QColor('#202020'))
assert SIGCOUNT == 2
qb = colors.get_current_line_brush()
assert type(qb) == type(QBrush())
assert '#202020' == qb.color().name()
colors.set_find_range_color(QColor('#303030'))
assert SIGCOUNT == 3
qb = colors.get_find_range_brush()
assert type(qb) == type(QBrush())
assert '#303030' == qb.color().name()
s1cf = QTextCharFormat()
s1cf.setUnderlineStyle(QTextCharFormat.DashDotDotLine)
s1cf.setUnderlineColor(QColor('#303030'))
colors.set_scanno_format(s1cf)
assert SIGCOUNT == 4
s2cf = colors.get_scanno_format()
assert s2cf.underlineStyle() == QTextCharFormat.DashDotDotLine
assert s2cf.underlineColor().name() == '#303030'
s3cf = QTextCharFormat()
s3cf.setUnderlineColor(QColor('#404040'))
s3cf.setUnderlineStyle(QTextCharFormat.DashUnderline)
colors.set_spelling_format(s3cf)
assert SIGCOUNT == 5
s4cf = colors.get_spelling_format()
assert s4cf.underlineStyle() == QTextCharFormat.DashUnderline
assert s4cf.underlineColor().name() == '#404040'
示例13: highlightBlock
# 需要导入模块: from PyQt5.QtGui import QTextCharFormat [as 别名]
# 或者: from PyQt5.QtGui.QTextCharFormat import setUnderlineColor [as 别名]
def highlightBlock(self, text):
patterns = (
# regex, color,
(reHtmlTags, FG('htmlTags') | QFont.Bold), # 0
(reHtmlSymbols, FG('htmlSymbols') | QFont.Bold), # 1
(reHtmlStrings, FG('htmlStrings') | QFont.Bold), # 2
(reHtmlComments, FG('htmlComments')), # 3
(reAsterisks, ITAL), # 4
(reUnderline, ITAL), # 5
(reDblAsterisks, NF | QFont.Bold), # 6
(reDblUnderline, NF | QFont.Bold), # 7
(reTrpAsterisks, ITAL | QFont.Bold), # 8
(reTrpUnderline, ITAL | QFont.Bold), # 9
(reMkdHeaders, NF | QFont.Black), # 10
(reMkdLinksImgs, FG('markdownLinks')), # 11
(reMkdLinkRefs, ITAL | UNDL), # 12
(reBlockQuotes, FG('blockquotes')), # 13
(reReSTDirects, FG('restDirectives') | QFont.Bold), # 14
(reReSTRoles, NF, FG('restRoles') | QFont.Bold, FG('htmlStrings')), # 15
(reTextileHdrs, NF | QFont.Black), # 16
(reTextileQuot, FG('blockquotes')), # 17
(reAsterisks, NF | QFont.Bold), # 18
(reDblUnderline, ITAL), # 19
(reMkdCodeSpans, FG('codeSpans')), # 20
(reReSTCodeSpan, FG('codeSpans')), # 21
(reReSTLinks, NF, NF, ITAL | UNDL, NF), # 22
(reReSTLinkRefs, NF, FG('markdownLinks'), ITAL | UNDL), # 23
(reReSTFldLists, NF, FG('restDirectives')), # 24
(reMkdMathSpans, FG('codeSpans')), # 25
)
patternsDict = {
'Markdown': (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 20, 25),
'reStructuredText': (4, 6, 14, 15, 21, 22, 23, 24),
'Textile': (0, 5, 6, 16, 17, 18, 19),
'html': (0, 1, 2, 3)
}
# Syntax highlighter
if self.docType in patternsDict:
for number in patternsDict[self.docType]:
pattern = patterns[number]
for match in pattern[0].finditer(text):
for i, formatter in enumerate(pattern[1:]):
charFormat = QTextCharFormat()
formatter.format(charFormat)
self.setFormat(match.start(i), match.end(i) - match.start(i), charFormat)
for match in reSpacesOnEnd.finditer(text):
charFormat = QTextCharFormat()
charFormat.setBackground(colorScheme['whitespaceOnEnd'])
self.setFormat(match.start(), match.end() - match.start(), charFormat)
# Spell checker
if self.dictionary:
charFormat = QTextCharFormat()
charFormat.setUnderlineColor(Qt.red)
charFormat.setUnderlineStyle(QTextCharFormat.SpellCheckUnderline)
for match in reWords.finditer(text):
finalFormat = QTextCharFormat()
finalFormat.merge(charFormat)
finalFormat.merge(self.format(match.start()))
if not self.dictionary.check(match.group(0)):
self.setFormat(match.start(), match.end() - match.start(), finalFormat)
示例14: OutputWidget
# 需要导入模块: from PyQt5.QtGui import QTextCharFormat [as 别名]
# 或者: from PyQt5.QtGui.QTextCharFormat import setUnderlineColor [as 别名]
class OutputWidget(QPlainTextEdit):
def __init__(self, parent):
super(OutputWidget, self).__init__(parent)
self._parent = parent
self.setReadOnly(True)
self.maxValue = 0
self.actualValue = 0
#traceback pattern
self.patLink = re.compile(r'(\s)*File "(.*?)", line \d.+')
#formats
font = QFont(settings.FONT_FAMILY, settings.FONT_SIZE)
self.plain_format = QTextCharFormat()
self.plain_format.setFont(font)
self.plain_format.setForeground(QBrush(QColor(
resources.CUSTOM_SCHEME.get("editor-text",
resources.COLOR_SCHEME["editor-text"]))))
self.error_format = QTextCharFormat()
self.error_format.setFont(font)
self.error_format.setAnchor(True)
self.error_format.setFontUnderline(True)
self.error_format.setUnderlineStyle(QTextCharFormat.SingleUnderline)
self.error_format.setUnderlineColor(Qt.red)
self.error_format.setForeground(Qt.blue)
self.error_format.setToolTip(_translate("OutputWidget", "Click to show the source"))
self.blockCountChanged[int].connect(self._scroll_area)
css = 'QPlainTextEdit {color: %s; background-color: %s;' \
'selection-color: %s; selection-background-color: %s;}' \
% (resources.CUSTOM_SCHEME.get('editor-text',
resources.COLOR_SCHEME['editor-text']),
resources.CUSTOM_SCHEME.get('editor-background',
resources.COLOR_SCHEME['editor-background']),
resources.CUSTOM_SCHEME.get('editor-selection-color',
resources.COLOR_SCHEME['editor-selection-color']),
resources.CUSTOM_SCHEME.get('editor-selection-background',
resources.COLOR_SCHEME['editor-selection-background']))
self.setStyleSheet(css)
def _scroll_area(self):
"""When new text is added to the widget, move the scroll to the end."""
if self.actualValue == self.maxValue:
self.moveCursor(QTextCursor.End)
def mousePressEvent(self, event):
"""
When the execution fail, allow to press the links in the traceback,
to go to the line when the error occur.
"""
QPlainTextEdit.mousePressEvent(self, event)
self.go_to_error(event)
def _refresh_output(self):
"""Read the output buffer from the process and append the text."""
#we should decode the bytes!
currentProcess = self._parent.currentProcess
text = currentProcess.readAllStandardOutput().data().decode('utf8')
verticalScroll = self.verticalScrollBar()
self.actualValue = verticalScroll.value()
self.maxValue = verticalScroll.maximum()
self.textCursor().insertText(text, self.plain_format)
def _refresh_error(self):
"""Read the error buffer from the process and append the text."""
#we should decode the bytes!
cursor = self.textCursor()
currentProcess = self._parent.currentProcess
text = currentProcess.readAllStandardError().data().decode('utf8')
text_lines = text.split('\n')
verticalScroll = self.verticalScrollBar()
self.actualValue = verticalScroll.value()
self.maxValue = verticalScroll.maximum()
for t in text_lines:
cursor.insertBlock()
if self.patLink.match(t):
cursor.insertText(t, self.error_format)
else:
cursor.insertText(t, self.plain_format)
def go_to_error(self, event):
"""Resolve the link and take the user to the error line."""
cursor = self.cursorForPosition(event.pos())
text = cursor.block().text()
if self.patLink.match(text):
file_path, lineno = self._parse_traceback(text)
main = main_container.MainContainer()
main.open_file(file_path)
main.editor_jump_to_line(lineno=int(lineno) - 1)
def _parse_traceback(self, text):
"""
Parse a line of python traceback and returns
a tuple with (file_name, lineno)
"""
file_word_index = text.find('File')
comma_min_index = text.find(',')
comma_max_index = text.rfind(',')
file_name = text[file_word_index + 6:comma_min_index - 1]
lineno = text[comma_min_index + 7:comma_max_index]
#.........这里部分代码省略.........