本文整理汇总了Python中gi.repository.GLib.markup_escape_text方法的典型用法代码示例。如果您正苦于以下问题:Python GLib.markup_escape_text方法的具体用法?Python GLib.markup_escape_text怎么用?Python GLib.markup_escape_text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.GLib
的用法示例。
在下文中一共展示了GLib.markup_escape_text方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generate_commandlist
# 需要导入模块: from gi.repository import GLib [as 别名]
# 或者: from gi.repository.GLib import markup_escape_text [as 别名]
def generate_commandlist(self):
"""Generate a list of internal vimiv commands and store it."""
commands = [cmd.name for cmd in self._app["commandline"].commands
if not cmd.is_hidden]
aliases = list(self._app["commandline"].commands.aliases.keys())
all_commands = sorted(commands + aliases)
infodict = read_info_from_man()
for command in all_commands:
if command in infodict:
info = infodict[command]
elif command in aliases:
info = "Alias to %s" % (
self._app["commandline"].commands.aliases[command])
else:
info = ""
info = "<i>" + GLib.markup_escape_text(info) + "</i>"
self._liststores["internal"][0].append([command, info])
示例2: _get_pango_text
# 需要导入模块: from gi.repository import GLib [as 别名]
# 或者: from gi.repository.GLib import markup_escape_text [as 别名]
def _get_pango_text(self, text):
rv = self._pango_text_cache.get(text, None)
if rv is None:
rv = GLib.markup_escape_text(text or '')
self._pango_text_cache[text] = rv
return rv
示例3: on_connection_changed
# 需要导入模块: from gi.repository import GLib [as 别名]
# 或者: from gi.repository.GLib import markup_escape_text [as 别名]
def on_connection_changed(self, worksheet):
markup = '<small>Connected to</small>\n'
if worksheet.connection is not None:
conn = worksheet.connection.get_label()
else:
conn = 'Not connected.'
markup += '<b>{}</b>'.format(GLib.markup_escape_text(conn))
self.lbl_conn.set_markup(markup)
# update schema
self.browser_model.clear()
if worksheet.connection:
worksheet.connection.schema.connect(
'changed', self._update_browser)
示例4: escape
# 需要导入模块: from gi.repository import GLib [as 别名]
# 或者: from gi.repository.GLib import markup_escape_text [as 别名]
def escape(tooltip):
'''Escape special characters in tooltip text'''
return GLib.markup_escape_text(tooltip)
示例5: __init__
# 需要导入模块: from gi.repository import GLib [as 别名]
# 或者: from gi.repository.GLib import markup_escape_text [as 别名]
def __init__(self, plugin, switch_callback):
super(PluginListRow, self).__init__()
self.plugin = plugin
self._refresh = False
self._switch_callback = switch_callback
label1 = Gtk.Label()
escape = GLib.markup_escape_text(plugin.get_name())
label1.set_markup("<b>" + escape + "</b>")
label1.set_ellipsize(Pango.EllipsizeMode.END)
label1.props.halign = Gtk.Align.START
label1.set_has_tooltip(True)
label1.props.margin_top = 5
label1.connect('query-tooltip', self._display_tooltip)
label2 = Gtk.Label(plugin.get_description())
label2.set_ellipsize(Pango.EllipsizeMode.END)
label2.props.halign = Gtk.Align.START
label2.set_has_tooltip(True)
label2.connect('query-tooltip', self._display_tooltip)
label2.props.margin_bottom = 5
switch = Gtk.Switch.new()
self._switch = switch
switch.props.valign = Gtk.Align.CENTER
sensitive = False
try:
if plugin.is_available():
sensitive = True
switch.set_active(plugin.is_loaded())
except:
pass
box = Gtk.Box()
box.set_orientation(Gtk.Orientation.VERTICAL)
box.pack_start(label1, True, False, 0)
box.pack_start(label2, True, False, 1)
outerbox = Gtk.Box()
outerbox.set_orientation(Gtk.Orientation.HORIZONTAL)
outerbox.pack_start(Gtk.Label(" "), False, False, 0)
outerbox.pack_start(box, False, False, 1)
outerbox.pack_end(switch, False, False, 3)
self.add(outerbox)
self.outerbox = outerbox
if not sensitive:
self.add_error()
switch.connect('notify::active', self._switch_changed)