本文整理汇总了Python中view_collection.ViewCollection类的典型用法代码示例。如果您正苦于以下问题:Python ViewCollection类的具体用法?Python ViewCollection怎么用?Python ViewCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ViewCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: update_git_file
def update_git_file(self):
# the git repo won't change that often
# so we can easily wait 5 seconds
# between updates for performance
if ViewCollection.git_time(self.view) > 5:
open(self.git_temp_file.name, 'w').close()
if self.view.get_status('remote'):
base_path = self.view.file_name() + '.base'
if os.path.exists(base_path):
shutil.copyfile(base_path, self.git_temp_file.name)
return
args = [
self.git_binary_path,
'--git-dir=' + self.git_dir,
'--work-tree=' + self.git_tree,
'show',
ViewCollection.get_compare() + ':' + self.git_path,
]
try:
contents = self.run_command(args)
contents = contents.replace(b'\r\n', b'\n')
contents = contents.replace(b'\r', b'\n')
f = open(self.git_temp_file.name, 'wb')
f.write(contents)
f.close()
ViewCollection.update_git_time(self.view)
except Exception:
pass
开发者ID:pieterv,项目名称:GitGutter,代码行数:30,代码来源:git_gutter_handler.py
示例2: update_git_file
def update_git_file(self):
# the git repo won't change that often
# so we can easily wait 5 seconds
# between updates for performance
if ViewCollection.git_time(self.view) > 5:
with open(self.git_temp_file, 'w'):
pass
args = [
self.git_binary_path,
'--git-dir=' + self.git_dir,
'--work-tree=' + self.git_tree,
'show',
ViewCollection.get_compare(self.view) + ':' + self.git_path,
]
try:
contents = self.run_command(args)
contents = contents.replace(b'\r\n', b'\n')
contents = contents.replace(b'\r', b'\n')
with open(self.git_temp_file, 'wb') as f:
f.write(contents)
ViewCollection.update_git_time(self.view)
except Exception:
pass
开发者ID:adder10,项目名称:GitGutter,代码行数:25,代码来源:git_gutter_handler.py
示例3: update_vcs_file
def update_vcs_file(self):
# the git repo won't change that often
# so we can easily wait 5 seconds
# between updates for performance
if ViewCollection.vcs_time(self.view) > 5:
open(self.vcs_temp_file.name, 'w').close()
status_args = self.get_status_args()
status = None
try:
contents, errors = self.run_command(status_args)
status = self.process_status_line(contents)
ViewCollection.update_vcs_status(self.view, status)
except Exception as e:
# print e
pass
args = self.get_diff_args()
try:
if status == 'M':
contents, errors = self.run_command(args)
contents = VcsGutterHandler._to_unix(contents)
VcsGutterHandler._write(self.vcs_temp_file.name, contents)
ViewCollection.update_vcs_time(self.view)
except Exception as e:
print ("Unable to write file for diff ", e)
开发者ID:dichlofos,项目名称:VcsGutter,代码行数:25,代码来源:gutter_handlers.py
示例4: __init__
def __init__(self, view):
self.load_settings()
self.view = view
self.git_temp_file = ViewCollection.git_tmp_file(self.view)
self.buf_temp_file = ViewCollection.buf_tmp_file(self.view)
self.git_tree = None
self.git_dir = None
self.git_path = None
开发者ID:adder10,项目名称:GitGutter,代码行数:8,代码来源:git_gutter_handler.py
示例5: __init__
def __init__(self, view):
self.view = view
self.git_temp_file = ViewCollection.git_tmp_file(self.view)
self.buf_temp_file = ViewCollection.buf_tmp_file(self.view)
if self.on_disk():
self.git_tree = git_helper.git_tree(self.view)
self.git_dir = git_helper.git_dir(self.git_tree)
self.git_path = git_helper.git_file_path(self.view, self.git_tree)
开发者ID:cromulus,项目名称:sublimesettings,代码行数:8,代码来源:git_gutter_handler.py
示例6: __init__
def __init__(self, view):
self.view = view
self.vcs_temp_file = ViewCollection.vcs_tmp_file(self.view)
self.buf_temp_file = ViewCollection.buf_tmp_file(self.view)
vcs_helper = self.get_vcs_helper()
if self.on_disk():
self.vcs_tree = vcs_helper.vcs_tree(self.view)
self.vcs_dir = vcs_helper.vcs_dir(self.vcs_tree)
self.vcs_path = vcs_helper.vcs_file_path(self.view, self.vcs_tree)
开发者ID:cristianciofu,项目名称:VcsGutter,代码行数:10,代码来源:gutter_handlers.py
示例7: run
def run(self, force_refresh=False):
self.view = self.window.active_view()
if not self.view:
# View is not ready yet, try again later.
sublime.set_timeout(self.run, 1)
return
self.clear_all()
if ViewCollection.untracked(self.view):
self.bind_files('untracked')
elif ViewCollection.ignored(self.view):
self.bind_files('ignored')
else:
# If the file is untracked there is no need to execute the diff
# update
if force_refresh:
ViewCollection.clear_git_time(self.view)
inserted, modified, deleted = ViewCollection.diff(self.view)
self.lines_removed(deleted)
self.bind_icons('inserted', inserted)
self.bind_icons('changed', modified)
if(ViewCollection.show_status(self.view) != "none"):
if(ViewCollection.show_status(self.view) == 'all'):
branch = ViewCollection.current_branch(
self.view).decode("utf-8").strip()
else:
branch = ""
self.update_status(len(inserted),
len(modified),
len(deleted),
ViewCollection.get_compare(self.view), branch)
else:
self.update_status(0, 0, 0, "", "")
开发者ID:Itsme72002,项目名称:GitGutter,代码行数:34,代码来源:git_gutter.py
示例8: __init__
def __init__(self, view):
self.load_settings()
self.view = view
self.git_temp_file = ViewCollection.git_tmp_file(self.view)
self.buf_temp_file = ViewCollection.buf_tmp_file(self.view)
if self.on_disk():
self.git_tree = git_helper.git_tree(self.view)
self.git_dir = git_helper.git_dir(self.git_tree)
self.git_path = git_helper.git_file_path(self.view, self.git_tree)
if self.view.get_status('remote'):
self.git_path = self.view.get_status('remote')
开发者ID:pieterv,项目名称:GitGutter,代码行数:11,代码来源:git_gutter_handler.py
示例9: update_git_file
def update_git_file(self):
# the git repo won't change that often
# so we can easily wait 5 seconds
# between updates for performance
if ViewCollection.git_time(self.view) > 5:
self.git_temp_file.truncate()
args = ['git','--git-dir='+self.git_dir,'--work-tree='+self.git_tree,'show','head:'+self.git_path]
try:
subprocess.call(args, stdout=self.git_temp_file)
ViewCollection.update_git_time(self.view)
except Exception:
pass
开发者ID:bencevans,项目名称:GitGutter,代码行数:12,代码来源:git_gutter_handler.py
示例10: run
def run(self):
self.view = self.window.active_view()
self.handler = ViewCollection.get_handler(self.view)
self.results = self.commit_list()
if self.results:
self.window.show_quick_panel(self.results, self.on_select)
开发者ID:ArtakManukyan,项目名称:config,代码行数:7,代码来源:git_gutter_compare.py
示例11: on_modified
def on_modified(self, view):
if view.settings().get('git_gutter_live_mode', True):
# Sublime Text is very strict on the amount of time plugin
# uses in performance-critical events. Sometimes invoking plugin
# from this event causes Sublime warning to appear, so we need to
# schedule its run for future.
sublime.set_timeout(lambda: ViewCollection.add(view), 1)
开发者ID:okonomi,项目名称:GitGutter,代码行数:7,代码来源:git_gutter_events.py
示例12: run
def run(self):
self.view = self.window.active_view()
self.clear_all()
inserted, modified, deleted = ViewCollection.diff(self.view)
self.lines_removed(deleted)
self.lines_added(inserted)
self.lines_modified(modified)
开发者ID:cromulus,项目名称:sublimesettings,代码行数:7,代码来源:git_gutter.py
示例13: update_vcs_file
def update_vcs_file(self):
# the git repo won't change that often
# so we can easily wait 5 seconds
# between updates for performance
if ViewCollection.vcs_time(self.view) > 5:
open(self.vcs_temp_file.name, "w").close()
args = self.get_diff_args()
try:
contents = self.run_command(args)
contents = contents.replace(b"\r\n", b"\n")
contents = contents.replace(b"\r", b"\n")
f = open(self.vcs_temp_file.name, "wb")
f.write(contents)
f.close()
ViewCollection.update_vcs_time(self.view)
except Exception as e:
print("Unable to write file for diff ", e)
开发者ID:borissamardzija,项目名称:VcsGutter,代码行数:17,代码来源:gutter_handlers.py
示例14: bind_files
def bind_files(self, event):
lines = []
lineCount = ViewCollection.total_lines(self.view)
i = 0
while i < lineCount:
lines += [i + 1]
i = i + 1
self.bind_icons(event, lines)
开发者ID:ArtakManukyan,项目名称:config,代码行数:8,代码来源:git_gutter.py
示例15: update_vcs_file
def update_vcs_file(self):
# the git repo won't change that often
# so we can easily wait 5 seconds
# between updates for performance
if ViewCollection.vcs_time(self.view) > 5:
open(self.vcs_temp_file.name, 'w').close()
args = self.get_diff_args()
try:
contents = self.run_command(args)
contents = contents.replace('\r\n', '\n')
contents = contents.replace('\r', '\n')
f = open(self.vcs_temp_file.name, 'w')
f.write(contents)
f.close()
ViewCollection.update_vcs_time(self.view)
except Exception:
pass
开发者ID:cristianciofu,项目名称:VcsGutter,代码行数:17,代码来源:gutter_handlers.py
示例16: run
def run(self, edit):
self.clear_all()
(inserted, modified, deleted) = ViewCollection.diff(self.view)
self.lines_removed(deleted)
self.lines_added(inserted)
self.lines_modified(modified)
开发者ID:bencevans,项目名称:GitGutter,代码行数:8,代码来源:git_gutter.py
示例17: run
def run(self):
self.view = self.window.active_view()
if not self.view:
# View is not ready yet, try again later.
sublime.set_timeout(self.run, 1)
return
self.clear_all()
inserted, modified, deleted = ViewCollection.diff(self.view)
self.lines_removed(deleted)
self.bind_icons('inserted', inserted)
self.bind_icons('changed', modified)
开发者ID:bmwang,项目名称:VcsGutter,代码行数:11,代码来源:vcs_gutter.py
示例18: run
def run(self, force_refresh=False):
self.view = self.window.active_view()
if not self.view:
# View is not ready yet, try again later.
sublime.set_timeout(self.run, 1)
return
self.clear_all()
if ViewCollection.untracked(self.view):
self.bind_files('untracked')
elif ViewCollection.ignored(self.view):
self.bind_files('ignored')
else:
# If the file is untracked there is no need to execute the diff
# update
if force_refresh:
ViewCollection.clear_git_time(self.view)
inserted, modified, deleted = ViewCollection.diff(self.view)
self.lines_removed(deleted)
self.bind_icons('inserted', inserted)
self.bind_icons('changed', modified)
开发者ID:ArtakManukyan,项目名称:config,代码行数:20,代码来源:git_gutter.py
示例19: on_select
def on_select(self, selected):
if 0 > selected < len(self.results):
return
item = self.results[selected]
commit = self.item_to_commit(item)
ViewCollection.set_compare(commit)
ViewCollection.clear_git_time(self.view)
ViewCollection.add(self.view)
开发者ID:ArtakManukyan,项目名称:config,代码行数:8,代码来源:git_gutter_compare.py
示例20: update_git_file
def update_git_file(self):
# the git repo won't change that often
# so we can easily wait 5 seconds
# between updates for performance
if ViewCollection.git_time(self.view) > 5:
open(self.git_temp_file.name, 'w').close()
args = [
'git',
'--git-dir=' + self.git_dir,
'--work-tree=' + self.git_tree,
'show',
'HEAD:' + self.git_path,
]
try:
contents = self.run_command(args)
contents = contents.replace('\r\n', '\n')
contents = contents.replace('\r', '\n')
f = open(self.git_temp_file.name, 'w')
f.write(contents)
f.close()
ViewCollection.update_git_time(self.view)
except Exception:
pass
开发者ID:cromulus,项目名称:sublimesettings,代码行数:23,代码来源:git_gutter_handler.py
注:本文中的view_collection.ViewCollection类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论