本文整理汇总了Python中gi.repository.Gedit.utils_replace_home_dir_with_tilde方法的典型用法代码示例。如果您正苦于以下问题:Python Gedit.utils_replace_home_dir_with_tilde方法的具体用法?Python Gedit.utils_replace_home_dir_with_tilde怎么用?Python Gedit.utils_replace_home_dir_with_tilde使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gedit
的用法示例。
在下文中一共展示了Gedit.utils_replace_home_dir_with_tilde方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_open_project
# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import utils_replace_home_dir_with_tilde [as 别名]
def add_open_project(self, titer, projectpath):
open_project_name = []
while titer:
open_project_name.insert(0, self.model[titer][0])
titer = self.model.iter_parent(titer)
open_project_name = '/'.join(open_project_name)
for row in self.model_open:
if projectpath == row[1]:
break
else:
self.model_open.append(
[open_project_name, projectpath, Pango.Weight.NORMAL,
projectpath.lower(), Gedit.utils_replace_home_dir_with_tilde(projectpath)])
示例2: _update_recent_menu
# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import utils_replace_home_dir_with_tilde [as 别名]
def _update_recent_menu(self):
max_recents = self.app_data.config.max_recents
for action in self.actiongroup_recent.list_actions():
i = int(action.props.name.rsplit('_', 1)[1])
if i >= max_recents:
action.props.visible = False
continue
try:
projectpath = self.app_data.config.recent_projects[i]
except IndexError:
projectpath = None
if projectpath:
action.props.label = Gedit.utils_replace_home_dir_with_tilde(projectpath)
action.props.visible = bool(projectpath)
示例3: _update_window_menu_idle
# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import utils_replace_home_dir_with_tilde [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
示例4: _append_path
# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import utils_replace_home_dir_with_tilde [as 别名]
def _append_path(self, titer, path):
titer = self.model.append(titer,
[os.path.basename(path), path, Pango.Weight.NORMAL,
path.lower(), Gedit.utils_replace_home_dir_with_tilde(path)])
return titer