当前位置: 首页>>代码示例>>Python>>正文


Python GObject.markup_escape_text方法代码示例

本文整理汇总了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)
开发者ID:Januson,项目名称:subscription-manager,代码行数:23,代码来源:utils.py

示例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)
开发者ID:Lorquas,项目名称:subscription-manager,代码行数:15,代码来源:mysubstab.py

示例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)
开发者ID:Januson,项目名称:subscription-manager,代码行数:4,代码来源:utils.py


注:本文中的subscription_manager.ga.GObject.markup_escape_text方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。