本文整理汇总了Python中subscription_manager.ga.GObject.markup_escape_text方法的典型用法代码示例。如果您正苦于以下问题:Python GObject.markup_escape_text方法的具体用法?Python GObject.markup_escape_text怎么用?Python GObject.markup_escape_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类subscription_manager.ga.GObject
的用法示例。
在下文中一共展示了GObject.markup_escape_text方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: apply_highlight
# 需要导入模块: from subscription_manager.ga import GObject [as 别名]
# 或者: from subscription_manager.ga.GObject import markup_escape_text [as 别名]
def apply_highlight(text, highlight):
"""
Apply pango markup to highlight a search term in a string
"""
if not highlight:
return ga_GObject.markup_escape_text(text)
regex = re.compile("(" + re.escape(highlight) + ")", re.I)
parts = regex.split(text)
escaped = []
# re.split makes every second result be our split term
on_search_term = False
for part in parts:
if on_search_term:
escaped += "<b>%s</b>" % ga_GObject.markup_escape_text(part)
else:
escaped += ga_GObject.markup_escape_text(part)
on_search_term = not on_search_term
return "".join(escaped)
示例2: unsubscribe_button_clicked
# 需要导入模块: from subscription_manager.ga import GObject [as 别名]
# 或者: from subscription_manager.ga.GObject import markup_escape_text [as 别名]
def unsubscribe_button_clicked(self, widget):
selection = widgets.SelectionWrapper(self.top_view.get_selection(), self.store)
# nothing selected
if not selection.is_valid():
return
# remove all markup, see rh bz#982286
subscription_text = ga_GObject.markup_escape_text(selection['subscription'])
prompt = messageWindow.YesNoDialog(_("Are you sure you want to remove %s?") % subscription_text,
self.content.get_toplevel())
prompt.connect('response', self._on_unsubscribe_prompt_response, selection)
示例3: format_restlib_exception
# 需要导入模块: from subscription_manager.ga import GObject [as 别名]
# 或者: from subscription_manager.ga.GObject import markup_escape_text [as 别名]
def format_restlib_exception(self, restlib_exception, message_template):
return ga_GObject.markup_escape_text(restlib_exception.msg)