本文整理汇总了Python中gi.repository.Gedit.utils_escape_underscores方法的典型用法代码示例。如果您正苦于以下问题:Python Gedit.utils_escape_underscores方法的具体用法?Python Gedit.utils_escape_underscores怎么用?Python Gedit.utils_escape_underscores使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gedit
的用法示例。
在下文中一共展示了Gedit.utils_escape_underscores方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _update_window_menu_idle
# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import utils_escape_underscores [as 别名]
def _update_window_menu_idle(self, window, data):
self._clear_window_menu(window, data)
closed_files = self._closed_files
ui_manager = window.get_ui_manager()
if closed_files:
reopen_ui_id = ui_manager.new_merge_id()
action_group = data['reopen_action_group']
max_items = self._max_reopen_items
num = 0
for f in closed_files:
if num >= max_items:
break
location = f['location']
content_type = Gio.content_type_from_mime_type(f['mime_type'])
name = 'NecronomiconPluginReopenFile_%d' % num
label = Gedit.utils_escape_underscores(location.get_basename(), -1)
# Translators: %s is a URI
tooltip = _("Reopen '%s'") % Gedit.utils_replace_home_dir_with_tilde(location.get_parse_name())
action = Gtk.Action(name, label, tooltip, None)
action.set_always_show_image(True)
if content_type:
action.set_gicon(Gio.content_type_get_icon(content_type))
connect_handlers(self, action, ('activate',), 'reopen_action', window, f)
if num == 0:
action_group.add_action_with_accel(action, self.REOPEN_ACCELERATOR)
else:
action_group.add_action(action)
ui_manager.add_ui(reopen_ui_id, self.REOPEN_MENU_PATH, name, name, Gtk.UIManagerItemType.MENUITEM, False)
num += 1
ui_manager.insert_action_group(action_group, -1)
data['menu_action'].set_sensitive(True)
data['reopen_ui_id'] = reopen_ui_id
ui_manager.ensure_update()
data['update_menu_id'] = 0
return False