python类status_message()的实例源码

plugin_rename.py 文件源码 项目:GoFeather 作者: frou 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def do_rename(view, byte_offset, new_name, simulate):
    new_name = new_name.strip()
    if new_name == '':
        sublime.status_message('CANNOT RENAME TO EMPTY IDENTIFIER')
        return

    cmd = [
        'gorename',
        # '-v',
        '-offset',
        view.file_name() + ':#' + str(byte_offset),
        '-to',
        new_name
    ]
    if simulate:
        cmd.append('-d')
    cmd_output = run_tool(cmd)
    if not cmd_output:
        simulate = False

    view.window().new_file().run_command("show_refactor_result", {
        "result": cmd_output.decode('utf-8'),
        "is_diff": simulate
    })
plugin_show_docs.py 文件源码 项目:GoFeather 作者: frou 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def get_doc(cmd_wd, cmd_arg):
    # `go doc` (Go 1.5+) has different capabilities to `godoc`.
    cmd = [
        'go',
        'doc',
        '-c',
    ]
    if cmd_arg:
        # Most of the interesting identifiers in the pseudo-package builtin are
        # considered unexported because they start with lowercase.
        if cmd_arg == 'builtin' or cmd_arg.startswith('builtin.'):
            cmd.append('-u')
        cmd.append(cmd_arg)
    try:
        cmd_output = run_tool(cmd, wd=cmd_wd)
    except:
        sublime.status_message('FAILED: ' + ' '.join(cmd))
        return
    return cmd_output.decode('utf-8')
plugin_show_docs.py 文件源码 项目:GoFeather 作者: frou 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def run(self, args):
        view = self.view
        # Show the stdlib documentation on the official site?
        default_docs = False
        non_empty_selections = [sl for sl in view.sel() if not sl.empty()]
        if len(non_empty_selections) == 0:
            default_docs = True
        if len(non_empty_selections) == 1:
            pkg = view.substr(non_empty_selections[0])
            pkg = pkg.strip(' \t\r\n"')
        elif len(non_empty_selections) > 1:
            sublime.status_message('TOO MANY SELECTIONS')
            return
        launcher = 'xdg-open'
        via_shell = False
        if sys.platform == 'darwin':
            launcher = 'open'
        elif sys.platform == 'win32':
            launcher = 'start'
            via_shell=True
        if default_docs:
            run_tool([launcher, 'https://golang.org/pkg/'], wd='.', shell=via_shell)
        else:
            run_tool([launcher, 'https://godoc.org/' + pkg.lower()], wd='.', shell=via_shell)
SingleTrailingNewLine.py 文件源码 项目:sublime-single-trailing-new-line 作者: mattst 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def run(self, edit):

        try:
            settings = sublime.load_settings(SETTINGS_FILE)

            syntax_current_file = self.view.settings().get("syntax")
            enable_for_syntaxes = settings.get(ENABLE_FOR_SYNTAXES_LIST_SETTING, [])

            if syntax_current_file not in enable_for_syntaxes:
                enable_for_syntaxes.append(syntax_current_file)
                enable_for_syntaxes.sort()
                settings.set(ENABLE_FOR_SYNTAXES_LIST_SETTING, enable_for_syntaxes)
                sublime.save_settings(SETTINGS_FILE)
                msg = "Syntax added to the syntax list"
                sublime.status_message(msg)
            else:
                msg = "Syntax already in the syntax list"
                sublime.status_message(msg)

        except Exception:
            msg = "The SingleTrailingNewLine.sublime-settings file is invalid"
            sublime.status_message(msg)
SingleTrailingNewLine.py 文件源码 项目:sublime-single-trailing-new-line 作者: mattst 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def run(self, edit):

        try:
            settings = sublime.load_settings(SETTINGS_FILE)

            syntax_current_file = self.view.settings().get("syntax")
            enable_for_syntaxes = settings.get(ENABLE_FOR_SYNTAXES_LIST_SETTING, [])

            if syntax_current_file in enable_for_syntaxes:
                enable_for_syntaxes.remove(syntax_current_file)
                enable_for_syntaxes.sort()
                settings.set(ENABLE_FOR_SYNTAXES_LIST_SETTING, enable_for_syntaxes)
                sublime.save_settings(SETTINGS_FILE)
                msg = "Syntax removed from the syntax list"
                sublime.status_message(msg)
            else:
                msg = "Syntax was not in the syntax list"
                sublime.status_message(msg)

        except Exception:
            msg = "The SingleTrailingNewLine.sublime-settings file is invalid"
            sublime.status_message(msg)
dired.py 文件源码 项目:sublime-dired 作者: Twizzledrizzle 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def run(self, edit, dirs):
        settings = sublime.load_settings('dired.sublime-settings')

        for key_name in ['reuse_view', 'bookmarks']:
            settings.set(key_name, settings.get(key_name))

        bm = bookmarks()
        for path in dirs :
            bm.append(path)
            settings.set('bookmarks', bm)

            # This command makes/writes a sublime-settings file at Packages/User/,
            # and doesn't write into one at Packages/dired/.
            sublime.save_settings('dired.sublime-settings')

            sublime.status_message('Bookmarking succeeded.')
            self.view.erase_regions('marked')
dired.py 文件源码 项目:sublime-dired 作者: Twizzledrizzle 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def run(self, edit):
        settings = sublime.load_settings('dired.sublime-settings')

        for key_name in ['reuse_view', 'bookmarks']:
            settings.set(key_name, settings.get(key_name))

        bm = bookmarks()

        def on_done(select) :
            if not select == -1 :
                bm.pop(select)
                sublime.status_message('Remove selected bookmark.')
                settings.set('bookmarks', bm)
                sublime.save_settings('dired.sublime-settings')

        self.view.window().show_quick_panel(bm, on_done)
ex_commands.py 文件源码 项目:VintageousPlus 作者: trishume 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def run(self, command_line=''):
        assert command_line, 'expected non-empty command line'

        parsed = parse_command_line(command_line)

        # TODO: implement this
        if parsed.command.forced:
            show_not_implemented()
            return
        if self._view.is_read_only():
            sublime.status_message("Can't write a read-only buffer.")
            return
        if not self._view.file_name():
            sublime.status_message("Can't save a file without name.")
            return

        self.window.run_command('save')
        self.window.run_command('ex_quit', {'command_line': 'quit'})
ex_commands.py 文件源码 项目:VintageousPlus 作者: trishume 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def run(self, command_line=''):
        assert command_line, 'expected non-empty command line'

        parsed = parse_command_line(command_line)
        option = parsed.command.option
        value = parsed.command.value

        if option.endswith('?'):
            show_not_implemented()
            return
        try:
            set_local(self._view, option, value)
        except KeyError:
            sublime.status_message("Vintageuos: No such option.")
        except ValueError:
            sublime.status_message("Vintageous: Invalid value for option.")
ex_commands.py 文件源码 项目:VintageousPlus 作者: trishume 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def run(self, command_line=''):
        assert command_line, 'expected non-empty command line'

        parsed = parse_command_line(command_line)

        option = parsed.command.option
        value = parsed.command.value

        print (locals())

        if option.endswith('?'):
            show_not_implemented()
            return
        try:
            set_global(self._view, option, value)
        except KeyError:
            sublime.status_message("Vintageuos: No such option.")
        except ValueError:
            sublime.status_message("Vintageous: Invalid value for option.")
xactions.py 文件源码 项目:VintageousPlus 作者: trishume 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def run(self, edit, insert=False, next_mode=None):
        def on_done(s):
            state = State(self.view)
            try:
                rv = [str(eval(s, None, None)),]
                if not insert:
                    state.registers[REG_EXPRESSION] = rv
                else:
                    self.view.run_command('insert_snippet', {'contents': str(rv[0])})
                    state.reset()
            except:
                sublime.status_message("Vintageous: Invalid expression.")
                on_cancel()

        def on_cancel():
            state = State(self.view)
            state.reset()

        self.view.window().show_input_panel('', '', on_done, None, on_cancel)
Scraper.py 文件源码 项目:The-Subliming-Of-Isaac 作者: Kapiainen 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def run(self):
        settings = SharedFunctions.get_package_settings()
        if settings:
            path = settings.get("docs_path", None)
            if path and os.path.isdir(path):
                scraped_api = scrape_api(path)
                if scraped_api:
                    SharedFunctions.write_resource_file("The Subliming of Isaac.json", scraped_api)
                    completions = generate_completions(scraped_api,
                        settings.get("completions_scope", "source.lua"))
                    if completions:
                        SharedFunctions.write_resource_file("The Subliming of Isaac.sublime-completions",
                            completions)
                    sublime.status_message("Finished scraping Afterbirth+ API...")
            else:
                if not path:
                    SharedFunctions.error_message("'docs_path' setting is undefined.")
                else:
                    SharedFunctions.error_message(
                        "The value of the 'docs_path' setting is not a path to an existing directory.")
ag.py 文件源码 项目:DroidWatcher 作者: suemi994 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def run(self, i):
        if not self.thread.is_alive():
            if hasattr(self.thread, 'result') and not self.thread.result:
                sublime.status_message('')
                return
            sublime.status_message(self.success_message)
            return

        before = i % self.size
        after = (self.size - 1) - before
        sublime.status_message('%s [%s=%s]' % \
            (self.message, ' ' * before, ' ' * after))
        if not after:
            self.addend = -1
        if not before:
            self.addend = 1
        i += self.addend
        sublime.set_timeout(lambda: self.run(i), 100)
operations.py 文件源码 项目:hyperhelp 作者: OdatNurd 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def _log(message, *args, status=False, dialog=False):
    """
    A simple logic facility to ensure that all console output is prefixed with
    the package name so the source is clear. Can also optionally send the output
    to the status line and/or a message dialog.
    """
    message = message % args
    print("HyperHelp:", message)
    if status:
        sublime.status_message(message)
    if dialog:
        sublime.message_dialog(message)
BaseCommand.py 文件源码 项目:sublime-commandbox 作者: Ortus-Solutions 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def status_message(self, text):
        sublime.status_message("%s: %s" % (self.package_name, text))
ProgressNotifier.py 文件源码 项目:sublime-commandbox 作者: Ortus-Solutions 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def stop(self):
        sublime.status_message(self.success_message)
        self.stopped = True
renderer.py 文件源码 项目:PhaserSublimePackage 作者: PhaserEditor2D 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def _render_impl(self, pfile, view, message):
    sublime.status_message(message.split('\n')[0])
renderer.py 文件源码 项目:PhaserSublimePackage 作者: PhaserEditor2D 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def _clean_impl(self, pfile, view):
    if pfile.showing_arguments:
      sublime.status_message("")
infoprovider.py 文件源码 项目:KodiDevKit 作者: phil65 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def init_addon(self, path):
        """
        scan addon folder and parse skin content etc
        """
        self.addon = None
        addon_xml = os.path.join(path, "addon.xml")
        if os.path.exists(addon_xml):
            logging.info("Kodi project detected: " + addon_xml)
            self.addon = Addon.by_project(path, self.settings)
            # sublime.status_message("KodiDevKit: successfully loaded addon")
BGS_PapyrusF4.py 文件源码 项目:Bethesda_SublimeFO4 作者: Scrivener07 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def checkout(filename, prefs):
    output = BGS_Perforce.checkout(prefs["workspace"], filename)
    sublime.status_message(output)


# Creates a directory for our cache files, if necessary, in the OS's temporary folder
# We don't use the temporary directory creation tools Python supplies because we want the folder to stay the same
# between runs so we can continue to access it.


问题


面经


文章

微信
公众号

扫码关注公众号