python类WindowCommand()的实例源码

SideBar.py 文件源码 项目:.sublime 作者: cxdongjack 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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, '')
SideBar.py 文件源码 项目:.sublime 作者: cxdongjack 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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, '')
core.py 文件源码 项目:NeoVintageous 作者: NeoVintageous 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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
core.py 文件源码 项目:NeoVintageous 作者: NeoVintageous 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
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
SideBar.py 文件源码 项目:.sublime 作者: cxdongjack 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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
SideBar.py 文件源码 项目:.sublime 作者: cxdongjack 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
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)
SideBar.py 文件源码 项目:.sublime 作者: cxdongjack 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
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)
SideBar.py 文件源码 项目:.sublime 作者: cxdongjack 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def run(self):
        SideBarPasteCommand2(sublime_plugin.WindowCommand).run(self.paths, self.in_parent, self.test, self.replace, self.key)
SideBar.py 文件源码 项目:.sublime 作者: cxdongjack 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def run(self):
        SideBarDeleteCommand(sublime_plugin.WindowCommand)._delete_threaded(self.paths)
core.py 文件源码 项目:VintageousPlus 作者: trishume 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
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
core.py 文件源码 项目:VintageousPlus 作者: trishume 项目源码 文件源码 阅读 15 收藏 0 点赞 0 评论 0
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
ex_main.py 文件源码 项目:VintageousPlus 作者: trishume 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def __init__(self, window):
        sublime_plugin.WindowCommand.__init__(self, window)


问题


面经


文章

微信
公众号

扫码关注公众号