当前位置: 首页>>代码示例>>Python>>正文


Python view_collection.ViewCollection类代码示例

本文整理汇总了Python中GitGutter.view_collection.ViewCollection的典型用法代码示例。如果您正苦于以下问题:Python ViewCollection类的具体用法?Python ViewCollection怎么用?Python ViewCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ViewCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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',
                'HEAD:' + 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:frantic,项目名称:GitGutter,代码行数:30,代码来源:git_gutter_handler.py

示例2: __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:wuub,项目名称:GitGutter,代码行数:8,代码来源:git_gutter_handler.py

示例3: __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:frantic,项目名称:GitGutter,代码行数:11,代码来源:git_gutter_handler.py

示例4: on_modified

 def on_modified(self, view):
     if not self.live_mode:
         return None
     if not self.non_blocking:
         if not self.live_delay:
             ViewCollection.add(view)
         elif not self.delayed_update_scheduled:
             if self.allow_instant_update:
                 self.allow_instant_update = False
                 sublime.set_timeout(lambda: self.delayed_update(view), 10)
                 sublime.set_timeout(lambda: self.enable_instant_update(), self.live_instant_interval)
             else:
                 self.delayed_update_scheduled = True
                 sublime.set_timeout(lambda: self.delayed_update(view), self.live_continuous_delay)
开发者ID:yesbox,项目名称:GitGutter,代码行数:14,代码来源:git_gutter_events.py

示例5: 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:Mondego,项目名称:pyreco,代码行数:7,代码来源:allPythonContent.py

示例6: 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()
     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
         inserted, modified, deleted = ViewCollection.diff(self.view)
         self.lines_removed(deleted)
         self.bind_icons('inserted', inserted)
         self.bind_icons('changed', modified)
开发者ID:brunosabot,项目名称:GitGutter,代码行数:17,代码来源:git_gutter.py

示例7: 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:3on,项目名称:GitGutter,代码行数:8,代码来源:git_gutter.py

示例8: 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(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:wuub,项目名称:GitGutter,代码行数:17,代码来源:git_gutter_handler.py

示例9: add

 def add(view):
     key = ViewCollection.get_key(view)
     try:
         from GitGutter.git_gutter_handler import GitGutterHandler
     except ImportError:
         from git_gutter_handler import GitGutterHandler
     handler = ViewCollection.views[key] = GitGutterHandler(view)
     handler.reset()
     return handler
开发者ID:Mondego,项目名称:pyreco,代码行数:9,代码来源:allPythonContent.py

示例10: 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.lines_added(inserted)
     self.lines_modified(modified)
开发者ID:Blueprint-Marketing,项目名称:sublime-config,代码行数:11,代码来源:git_gutter.py

示例11: 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:Mondego,项目名称:pyreco,代码行数:8,代码来源:allPythonContent.py

示例12: 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_helper.git_command(self.view),
             '--git-dir=' + self.git_dir,
             '--work-tree=' + self.git_tree,
             'show',
             'HEAD:' + 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:dizzyone,项目名称:GitGutter,代码行数:23,代码来源:git_gutter_handler.py

示例13: run

 def run(self):
     self.view = self.window.active_view()
     if not self.view:
         # Sometimes GitGutter tries to run when there is no active window
         # and it throws an error because self.view is None.
         # I have only been able to reproduce this in the following scenario:
         # you clicked on FileA in the sidebar (FileA is not previously open)
         # not to open it but to preview it. While previewing it you press
         # ctrl+` to open a console. With the console selected and the
         # unopened FileA preview showing in the window you click on another
         # unopened file, FileB to preview that file. There will be no active
         # window at this time and GitGutter will throw an error. So we can
         # just skip running this time because immediately after selecting
         # FileB, focus will shift from the console to its preview. This will
         # cause GitGutter to run again on the FileB preview.
         # Wow that was a really long explanation.
         return
     self.clear_all()
     inserted, modified, deleted = ViewCollection.diff(self.view)
     self.lines_removed(deleted)
     self.lines_added(inserted)
     self.lines_modified(modified)
开发者ID:toonnevelsteen,项目名称:sublime_settings,代码行数:22,代码来源:git_gutter.py

示例14: ignored

 def ignored(view):
     key = ViewCollection.get_key(view)
     return ViewCollection.views[key].ignored()
开发者ID:Mondego,项目名称:pyreco,代码行数:3,代码来源:allPythonContent.py

示例15: buf_tmp_file

 def buf_tmp_file(view):
     key = ViewCollection.get_key(view)
     if not key in ViewCollection.buf_files:
         ViewCollection.buf_files[key] = tempfile.NamedTemporaryFile()
         ViewCollection.buf_files[key].close()
     return ViewCollection.buf_files[key]
开发者ID:Mondego,项目名称:pyreco,代码行数:6,代码来源:allPythonContent.py


注:本文中的GitGutter.view_collection.ViewCollection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。