本文整理汇总了Python中Utils.Object.content方法的典型用法代码示例。如果您正苦于以下问题:Python Object.content方法的具体用法?Python Object.content怎么用?Python Object.content使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils.Object
的用法示例。
在下文中一共展示了Object.content方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _move_moveView
# 需要导入模块: from Utils import Object [as 别名]
# 或者: from Utils.Object import content [as 别名]
def _move_moveView(self, window, view, location, active_view):
if active_view == view:
is_active_view = True
else:
is_active_view = False
options = Object()
options.scroll = view.viewport_position()
options.selections = []
for sel in view.sel():
line_s, col_s = view.rowcol(sel.a)
line_e, col_e = view.rowcol(sel.b)
options.selections.append([view.text_point(line_s, col_s), view.text_point(line_e, col_e)])
options.marks = []
for sel in view.get_regions("mark"):
line_s, col_s = view.rowcol(sel.a)
line_e, col_e = view.rowcol(sel.b)
options.marks.append([view.text_point(line_s, col_s), view.text_point(line_e, col_e)])
options.bookmarks = []
for sel in view.get_regions("bookmarks"):
line_s, col_s = view.rowcol(sel.a)
line_e, col_e = view.rowcol(sel.b)
options.bookmarks.append([view.text_point(line_s, col_s), view.text_point(line_e, col_e)])
options.folds = []
if int(sublime.version()) >= 2167:
for sel in view.folded_regions():
line_s, col_s = view.rowcol(sel.a)
line_e, col_e = view.rowcol(sel.b)
options.folds.append([view.text_point(line_s, col_s), view.text_point(line_e, col_e)])
else:
for sel in view.unfold(sublime.Region(0, view.size())):
line_s, col_s = view.rowcol(sel.a)
line_e, col_e = view.rowcol(sel.b)
options.folds.append([view.text_point(line_s, col_s), view.text_point(line_e, col_e)])
window.focus_view(view)
if view.is_dirty():
options.content = view.substr(sublime.Region(0, view.size()))
view.window().run_command("revert")
else:
options.content = False
window.run_command("close")
view = window.open_file(location)
sublime.set_timeout(lambda: self._move_restoreView(view, options), 200)
if is_active_view:
window.focus_view(view)
return view
else:
window.focus_view(active_view)
return active_view
示例2: _move_moveView
# 需要导入模块: from Utils import Object [as 别名]
# 或者: from Utils.Object import content [as 别名]
def _move_moveView(self, window, view, location, active_view):
if active_view == view:
is_active_view = True
else:
is_active_view = False
options = Object()
options.scroll = view.viewport_position()
options.selections = [[item.a, item.b] for item in view.sel()]
options.marks = [[item.a, item.b] for item in view.get_regions("mark")]
options.bookmarks = [[item.a, item.b] for item in view.get_regions("bookmarks")]
if int(sublime.version()) >= 2167:
options.folds = [[item.a, item.b] for item in view.folded_regions()]
else:
options.folds = [[item.a, item.b] for item in view.unfold(sublime.Region(0, view.size()))]
options.syntax = view.settings().get('syntax')
try:
_window = window or view.window() or sublime.active_window()
options.position = _window.get_view_index(view)
except:
options.position = False
window.focus_view(view)
if view.is_dirty():
options.content = view.substr(sublime.Region(0, view.size()))
view.window().run_command('revert')
else:
options.content = False
window.run_command('close')
view = window.open_file(location)
sublime.set_timeout(lambda: self._move_restoreView(view, options, window), 200)
if is_active_view:
window.focus_view(view)
return view
else:
window.focus_view(active_view)
return active_view