Ejemplo n.º 1
0
    def is_enabled(self, clipboard=False, external=False, paths=[], group=-1, index=-1):
        """Check if command is enabled."""

        if clipboard:
            enabled = (
                bool(load_settings().get("use_clipboard", True)) and
                (get_target(paths, group, index) is not None if len(paths) or index != -1 else True)
            )
        else:
            enabled = (
                LEFT is not None and
                (get_target(paths, group, index) is not None if len(paths) or index != -1 else True)
            )
        return enabled
Ejemplo n.º 2
0
    def check_enabled(self, paths=[], group=-1, index=-1):
        """Check if command is enabled."""

        valid_path = get_target(
            paths, group,
            index) is not None if len(paths) or index != -1 else True
        return bool(load_settings().get("use_clipboard", True)) and valid_path
Ejemplo n.º 3
0
    def is_enabled(self,
                   clipboard=False,
                   external=False,
                   paths=[],
                   group=-1,
                   index=-1):
        """Check if command is enabled."""

        if clipboard:
            enabled = (bool(load_settings().get("use_clipboard", True))
                       and (get_target(paths, group, index) is not None
                            if len(paths) or index != -1 else True))
        else:
            enabled = (LEFT is not None
                       and (get_target(paths, group, index) is not None
                            if len(paths) or index != -1 else True))
        return enabled
Ejemplo n.º 4
0
    def is_enabled(self, external=False, paths=[], group=-1, index=-1):
        """Check if command is enabled."""

        return (
            LEFT is not None and
            (get_target(paths, group, index) is not None if len(paths) or index != -1 else True) and
            self.check_enabled()
        )
Ejemplo n.º 5
0
 def set_view(self, paths, group=-1, index=-1, open_file=True):
     if len(paths):
         file_path = get_target(paths)
         if file_path is None:
             return
         if open_file:
             self.view = self.window.open_file(file_path)
     elif index != -1:
         self.view = self.window.views_in_group(group)[index]
     else:
         self.view = self.window.active_view()
Ejemplo n.º 6
0
    def set_view(self, paths, group=-1, index=-1, open_file=True):
        """Set view."""

        if len(paths):
            file_path = get_target(paths)
            if file_path is None:
                return
            if open_file:
                self.view = self.window.open_file(file_path)
        elif index != -1:
            self.view = get_group_view(self.window, group, index)
        else:
            self.view = self.window.active_view()
Ejemplo n.º 7
0
    def set_view(self, paths, group=-1, index=-1, open_file=True):
        """Set view."""

        if len(paths):
            file_path = get_target(paths)
            if file_path is None:
                return
            if open_file:
                self.view = self.window.open_file(file_path)
        elif index != -1:
            self.view = get_group_view(self.window, group, index)
        else:
            self.view = self.window.active_view()
Ejemplo n.º 8
0
    def is_enabled(self, paths=[], group=-1, index=-1, **kwargs):
        """Check if command is enabled."""

        if len(paths) or index != -1:
            name = get_target(paths, group, index)
        else:
            self.view = self.window.active_view()
            if self.view is None:
                return False
            name = self.view.file_name() if self.view is not None else None

        if name is None:
            return False

        return self.vc_is_enabled(name)
    def is_enabled(self, paths=[], group=-1, index=-1, **kwargs):
        """Check if command is enabled."""

        if len(paths) or index != -1:
            name = get_target(paths, group, index)
        else:
            self.view = self.window.active_view()
            if self.view is None:
                return False
            name = self.view.file_name() if self.view is not None else None

        if name is None:
            return False

        return self.vc_is_enabled(name)
Ejemplo n.º 10
0
    def run(self, paths=[], group=-1, index=-1, **kwargs):
        """Run command."""

        if len(paths):
            name = get_target(paths)
        elif index != -1:
            self.view = get_group_view(sublime.active_window(), group, index)
            name = self.view.file_name()
        else:
            self.view = self.window.active_view()
            if self.view is None:
                return False
            name = self.view.file_name() if self.view is not None else None

        if name is None:
            return False

        if len(paths):
            self.view = self.window.open_file(name)

        self.vc_run(**kwargs)
    def run(self, paths=[], group=-1, index=-1, **kwargs):
        """Run command."""

        if len(paths):
            name = get_target(paths)
        elif index != -1:
            self.view = get_group_view(sublime.active_window(), group, index)
            name = self.view.file_name()
        else:
            self.view = self.window.active_view()
            if self.view is None:
                return False
            name = self.view.file_name() if self.view is not None else None

        if name is None:
            return False

        if len(paths):
            self.view = self.window.open_file(name)

        self.vc_run(**kwargs)
Ejemplo n.º 12
0
    def is_enabled(self, external=False, paths=[], group=-1, index=-1):
        """Check if command is enabled."""

        return get_target(
            paths, group,
            index) is not None if len(paths) or index != -1 else True
Ejemplo n.º 13
0
 def check_enabled(self, paths=[], group=-1, index=-1):
     valid_path = get_target(paths, group, index) is not None if len(paths) or index != -1 else True
     return bool(load_settings().get("use_clipboard", True)) and valid_path
Ejemplo n.º 14
0
 def is_enabled(self, paths=[], group=-1, index=-1):
     return get_target(paths, group, index) is not None if len(paths) or index != -1 else True
Ejemplo n.º 15
0
    def is_enabled(self, paths=[], group=-1, index=-1):
        """Check if command is enabled."""

        return get_target(paths, group, index) is not None if len(paths) or index != -1 else True