コード例 #1
0
ファイル: editor.py プロジェクト: sashapolo/SublimeHints
 def render(self, hints_file, **kwargs):
     hints = _get_hints_in_regions(hints_file.hints, self.view.sel())
     hints_file.hints = filter(lambda hint: hint not in hints, hints_file.hints)
     hints_file.dump_json(self.view)
     double_view = DoubleViewHintsCommand.find_by_target_view_id(self.view.id())
     if double_view is not None:
         double_view.reload_hint_file()
コード例 #2
0
    def render(self, hints_file, **kwargs):
        self.hints_file = hints_file
        print hints_file
        commands = {}
        if DoubleViewHintsCommand.find_by_target_view_id(self.view.id()):
            commands[0] = CloseDoubleView()
        else:
            commands[0] = ShowDoubleView()
        commands[1] = ShowBrowser()
        commands[2] = EditAllHints()

        self.view.window().show_quick_panel(commands.values(), lambda x: self.on_done(commands, x))
コード例 #3
0
ファイル: editor.py プロジェクト: sashapolo/SublimeHints
    def run(self, edit):
        id = self.view.id()
        if id in _displayed_hints:
            hints_file = _displayed_hints[id]["file"]
            hint = _displayed_hints[id]["hint"]
            parent_view = _displayed_hints[id]["parent_view"]

            hint.text = self.view.substr(sublime.Region(0, self.view.size()))
            hints_file.dump_json(parent_view)
            self.view.window().run_command("close_file")

            double_view = DoubleViewHintsCommand.find_by_target_view_id(parent_view.id())
            if double_view is not None:
                double_view.reload_hint_file()

            del _displayed_hints[id]
コード例 #4
0
ファイル: editor.py プロジェクト: sashapolo/SublimeHints
 def render(self, hints_file, **kwargs):
     double_view = DoubleViewHintsCommand.find_by_hint_view_id(self.view.id())
     # check if we are editing a double_view panel
     if double_view is None:
         self.hints_file = hints_file
         self.hints = hints_file.hints
         self.set_layout()
         global _edit_all
         if _edit_all:
             self.print_hints(self.hints, self.view)
             _edit_all = False
         else:
             self.print_hints(_get_hints_in_regions(self.hints, self.view.sel()), self.view)
     else:
         self.hints_file = double_view.hints_file
         self.hints = self.hints_file.hints
         hint_set = set()
         for region in self.view.sel():
             hint_set.update(double_view.hints_in_region(region))
         self.print_hints(hint_set, double_view.text_view)