Python sublime_plugin 模块,WindowCommand() 实例源码

我们从Python开源项目中,提取了以下12个代码示例,用于说明如何使用sublime_plugin.WindowCommand()

项目:.sublime    作者:cxdongjack    | 项目源码 | 文件源码
def run(self):
        old = self.old
        new = self.new
        key = self.key
        window_set_status(key, 'Duplicating…')

        item = SideBarItem(old, os.path.isdir(old))
        try:
            if not item.copy(new):
                window_set_status(key, '')
                if SideBarItem(new, os.path.isdir(new)).overwrite():
                    self.run()
                else:
                    SideBarDuplicateCommand(sublime_plugin.WindowCommand).run([old], new)
                return
        except:
            window_set_status(key, '')
            sublime.error_message("Unable to copy:\n\n"+old+"\n\nto\n\n"+new)
            SideBarDuplicateCommand(sublime_plugin.WindowCommand).run([old], new)
            return
        item = SideBarItem(new, os.path.isdir(new))
        if item.isFile():
            item.edit();
        SideBarProject().refresh();
        window_set_status(key, '')
项目:.sublime    作者:cxdongjack    | 项目源码 | 文件源码
def run(self):
        old = self.old
        new = self.new
        key = self.key
        window_set_status(key, 'Moving…')

        item = SideBarItem(old, os.path.isdir(old))
        try:
            if not item.move(new):
                if SideBarItem(new, os.path.isdir(new)).overwrite():
                    self.run()
                else:
                    window_set_status(key, '')
                    SideBarMoveCommand(sublime_plugin.WindowCommand).run([old], new)
                return
        except:
            window_set_status(key, '')
            sublime.error_message("Unable to move:\n\n"+old+"\n\nto\n\n"+new)
            SideBarMoveCommand(sublime_plugin.WindowCommand).run([old], new)
            raise
            return
        SideBarProject().refresh();
        window_set_status(key, '')
项目:NeoVintageous    作者:NeoVintageous    | 项目源码 | 文件源码
def _view(self):
        """Return the view that should receive any actions."""
        view = None
        try:
            view = self.view
        except AttributeError:
            try:
                view = self.window.active_view()
            except AttributeError:
                raise AttributeError(
                    'ViCommandMixin must be used with a TextCommand or a WindowCommand class')
        return view
项目:NeoVintageous    作者:NeoVintageous    | 项目源码 | 文件源码
def _window(self):
        """Return the view that should receive any actions."""
        window = None
        try:
            window = self.window
        except AttributeError:
            try:
                window = self.view.window()
            except AttributeError:
                raise AttributeError(
                    'ViCommandMixin must be used with a TextCommand or a WindowCommand class')
        return window
项目:.sublime    作者:cxdongjack    | 项目源码 | 文件源码
def on_load_async(self, view):
        if view and view.file_name() and not view.settings().get('open_with_edit'):
            item = SideBarItem(os.path.join(sublime.packages_path(), 'User', 'SideBarEnhancements', 'Open With', 'Side Bar.sublime-menu'), False)
            if item.exists():
                settings = sublime.decode_value(item.contentUTF8())
                selection = SideBarSelection([view.file_name()])
                for item in settings[0]['children']:
                    try:
                        if item['open_automatically'] and selection.hasFilesWithExtension(item['args']['extensions']):
                            SideBarFilesOpenWithCommand(sublime_plugin.WindowCommand).run([view.file_name()], item['args']['application'], item['args']['extensions'])
                            view.window().run_command('close')
                            break
                    except:
                        pass
项目:.sublime    作者:cxdongjack    | 项目源码 | 文件源码
def run(self, paths = [], name = ""):
        import functools
        Window().run_command('hide_panel');
        Window().show_input_panel("File Name:", name, functools.partial(SideBarNewFileCommand(sublime_plugin.WindowCommand).on_done, paths, True), None, None)
项目:.sublime    作者:cxdongjack    | 项目源码 | 文件源码
def run(self, paths = [], name = ""):
        import functools
        Window().run_command('hide_panel');
        Window().show_input_panel("Folder Name:", name, functools.partial(SideBarNewDirectoryCommand(sublime_plugin.WindowCommand).on_done, paths, True), None, None)
项目:.sublime    作者:cxdongjack    | 项目源码 | 文件源码
def run(self):
        SideBarPasteCommand2(sublime_plugin.WindowCommand).run(self.paths, self.in_parent, self.test, self.replace, self.key)
项目:.sublime    作者:cxdongjack    | 项目源码 | 文件源码
def run(self):
        SideBarDeleteCommand(sublime_plugin.WindowCommand)._delete_threaded(self.paths)
项目:VintageousPlus    作者:trishume    | 项目源码 | 文件源码
def _view(self):
        '''
        Returns the view that should receive any actions.
        '''
        view = None
        try:
            view = self.view
        except AttributeError:
            try:
                view = self.window.active_view()
            except AttributeError:
                raise AttributeError(
                    'ViCommandMixin must be used with a TextCommand or a WindowCommand class')
        return view
项目:VintageousPlus    作者:trishume    | 项目源码 | 文件源码
def _window(self):
        '''
        Returns the view that should receive any actions.
        '''
        window = None
        try:
            window = self.window
        except AttributeError:
            try:
                window = self.view.window()
            except AttributeError:
                raise AttributeError(
                    'ViCommandMixin must be used with a TextCommand or a WindowCommand class')
        return window
项目:VintageousPlus    作者:trishume    | 项目源码 | 文件源码
def __init__(self, window):
        sublime_plugin.WindowCommand.__init__(self, window)