本文整理汇总了Python中gi.repository.Gedit.commands_load_locations方法的典型用法代码示例。如果您正苦于以下问题:Python Gedit.commands_load_locations方法的具体用法?Python Gedit.commands_load_locations怎么用?Python Gedit.commands_load_locations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gedit
的用法示例。
在下文中一共展示了Gedit.commands_load_locations方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __default__
# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import commands_load_locations [as 别名]
def __default__(filename, view):
"""Edit file: edit <filename>"""
doc = view.get_buffer()
cwd = os.getcwd()
if not doc.is_untitled():
cwd = doc.get_file().get_location().get_parent().get_path()
else:
cwd = os.path.expanduser('~/')
if not os.path.isabs(filename):
filename = os.path.join(cwd, filename)
matches = glob.glob(filename)
files = []
if matches:
for match in matches:
files.append(Gio.file_new_for_path(match))
else:
files.append(Gio.file_new_for_path(filename))
if files:
window = view.get_toplevel()
Gedit.commands_load_locations(window, files, None, 0, 0)
return commander.commands.result.HIDE
示例2: _load_session
# 需要导入模块: from gi.repository import Gedit [as 别名]
# 或者: from gi.repository.Gedit import commands_load_locations [as 别名]
def _load_session(self, session, window):
# Note: a session has to stand on its own window.
tab = window.get_active_tab()
if tab is not None and \
not (tab.get_document().is_untouched() and \
tab.get_state() == Gedit.TabState.STATE_NORMAL):
# Create a new gedit window
window = Gedit.App.get_default().create_window(None)
window.show()
Gedit.commands_load_locations(window, session.files, None, 0, 0)