当前位置: 首页>>代码示例>>Python>>正文


Python sublime.version方法代码示例

本文整理汇总了Python中sublime.version方法的典型用法代码示例。如果您正苦于以下问题:Python sublime.version方法的具体用法?Python sublime.version怎么用?Python sublime.version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sublime的用法示例。


在下文中一共展示了sublime.version方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: communicate

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import version [as 别名]
def communicate(self, cmd, code=None):
        """Run an external executable using stdin to pass code and return its output."""

        if '__RELATIVE_TO_FOLDER__' in cmd:

            relfilename = self.filename
            window = self.view.window()

            # can't get active folder, it will work only if there is one folder in project
            if int(sublime.version()) >= 3080 and len(window.folders()) < 2:

                vars = window.extract_variables()

                if 'folder' in vars:
                    relfilename = os.path.relpath(self.filename, vars['folder'])

            cmd[cmd.index('__RELATIVE_TO_FOLDER__')] = relfilename

        elif not code:
            cmd.append(self.filename)

        return super().communicate(cmd, code) 
开发者ID:roadhump,项目名称:SublimeLinter-contrib-eslint_d,代码行数:24,代码来源:linter.py

示例2: write_to_cache_without_js

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import version [as 别名]
def write_to_cache_without_js(self):
        process = CrossPlatformProcess(self.working_dir)
        (stdout, stderr) = process.run_sync(r'gulp -v')

        if process.failed or not GulpVersion(stdout).supports_tasks_simple():
            raise Exception("Gulp: Could not get the current gulp version or your gulp CLI version is lower than 3.7.0")

        (stdout, stderr) = process.run_sync(r'gulp --tasks-simple')

        gulpfile = self.get_gulpfile_path(self.working_dir)

        if not stdout:
            raise Exception("Gulp: The result of `gulp --tasks-simple` was empty")

        CacheFile(self.working_dir).write({
            gulpfile: {
                "sha1": Hasher.sha1(gulpfile),
                "tasks": dict((task, { "name": task, "dependencies": "" }) for task in stdout.split("\n") if task)
            }
        }) 
开发者ID:nicosantangelo,项目名称:sublime-gulp,代码行数:22,代码来源:gulp.py

示例3: plugin_loaded

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import version [as 别名]
def plugin_loaded():
	log().info("Loading plugin")
	log().info("Sublime version '" + sublime.version() + "'")
	log().info("Fuse plugin version '" + VERSION + "'")
	global gFuse
	gFuse = Fuse()
	fix_osx_path()

	s = sublime.load_settings("Preferences.sublime-settings")
	if getSetting("fuse_open_files_in_same_window"):
		s.set("open_files_in_new_window", False)
	else:
		s.set("open_files_in_new_window", True)

	if getSetting("fuse_show_user_guide_on_start", True):
		sublime.active_window().run_command("open_file", {"file":"${packages}/Fuse/UserGuide.txt"})
		setSetting("fuse_show_user_guide_on_start", False)
	log().info("Plugin loaded successfully") 
开发者ID:fuse-open,项目名称:Fuse.SublimePlugin,代码行数:20,代码来源:fuse.py

示例4: _osx_focus

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import version [as 别名]
def _osx_focus(self):
        name = 'Sublime Text'
        if int(sublime.version()) < 3000:
            name = 'Sublime Text 2'

        # This is some magic. I spent many many hours trying to find a
        # workaround for the Sublime Text bug. I found a bunch of ugly
        # solutions, but this was the simplest one I could figure out.
        #
        # Basically you have to activate an application that is not Sublime
        # then wait and then activate sublime. I picked "Dock" because it
        # is always running in the background so it won't screw up your
        # command+tab order. The delay of 1/60 of a second is the minimum
        # supported by Applescript.
        cmd = """
            tell application "System Events"
                activate application "Dock"
                delay 1/60
                activate application "%s"
            end tell""" % name

        Popen(['/usr/bin/osascript', "-e", cmd], stdout=PIPE, stderr=PIPE)

    # Focus a Sublime window using wmctrl. wmctrl takes the title of the window
    # that will be focused, or part of it. 
开发者ID:ccampbell,项目名称:sublime-goto-window,代码行数:27,代码来源:GotoWindow.py

示例5: plugin_loaded

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import version [as 别名]
def plugin_loaded() -> None:
    load_settings()
    popups.load_css()
    set_debug_logging(settings.log_debug)
    set_exception_logging(True)
    windows.set_diagnostics_ui(DiagnosticsPresenter)
    windows.set_server_panel_factory(ensure_server_panel)
    windows.set_settings_factory(settings)
    load_handlers()
    sublime.status_message("LSP initialized")
    window = sublime.active_window()
    if window:
        windows.lookup(window).start_active_views()
    if int(sublime.version()) > 4000:
        sublime.error_message(
            """The currently installed version of LSP package is not compatible with Sublime Text 4. """
            """Please remove and reinstall this package to receive a version compatible with ST4. """
            """Remember to restart Sublime Text after.""") 
开发者ID:sublimelsp,项目名称:LSP,代码行数:20,代码来源:main.py

示例6: get_tabnine_path

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import version [as 别名]
def get_tabnine_path(binary_dir):
    def join_path(*args):
        return os.path.join(binary_dir, *args)
    translation = {
        ("linux", "x32"): "i686-unknown-linux-musl/TabNine",
        ("linux", "x64"): "x86_64-unknown-linux-musl/TabNine",
        ("osx", "x32"): "i686-apple-darwin/TabNine",
        ("osx", "x64"): "x86_64-apple-darwin/TabNine",
        ("windows", "x32"): "i686-pc-windows-gnu/TabNine.exe",
        ("windows", "x64"): "x86_64-pc-windows-gnu/TabNine.exe",
    }
    versions = os.listdir(binary_dir)
    versions.sort(key=parse_semver, reverse=True)
    for version in versions:
        key = sublime.platform(), sublime.arch()
        path = join_path(version, translation[key])
        if os.path.isfile(path):
            add_execute_permission(path)
            print("TabNine: starting version", version)
            return path 
开发者ID:codota,项目名称:tabnine-sublime,代码行数:22,代码来源:TabNine.py

示例7: run_tabnine

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import version [as 别名]
def run_tabnine(inheritStdio=False, additionalArgs=[]):
        binary_dir = os.path.join(TabNineProcess.install_directory, "binaries")
        settings = sublime.load_settings(SETTINGS_PATH)
        tabnine_path = settings.get("custom_binary_path")
        if tabnine_path is None:
            tabnine_path = get_tabnine_path(binary_dir)
        args = [tabnine_path, "--client", "sublime"] + additionalArgs
        log_file_path = settings.get("log_file_path")
        if log_file_path is not None:
            args += ["--log-file-path", log_file_path]
        extra_args = settings.get("extra_args")
        if extra_args is not None:
            args += extra_args
        plugin_version = PACK_MANAGER.get_metadata("TabNine").get('version')
        if not plugin_version:
            plugin_version = "Unknown"
        sublime_version = sublime.version()
        args += ["--client-metadata", "clientVersion=" + sublime_version, "clientApiVersion=" + sublime_version, "pluginVersion=" + plugin_version]
        return subprocess.Popen(
            args,
            stdin=None if inheritStdio else subprocess.PIPE,
            stdout=None if inheritStdio else subprocess.PIPE,
            stderr=subprocess.STDOUT,
            startupinfo=get_startup_info(sublime.platform())) 
开发者ID:codota,项目名称:tabnine-sublime,代码行数:26,代码来源:TabNine.py

示例8: file_directory

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import version [as 别名]
def file_directory():
    """Returns the given file directory
    """

    if int(sublime.version()) >= 3080:
        # extract_variables was added to ST3 rev 3080
        return sublime.active_window().extract_variables().get('file_path')

    folders = sublime.active_window().folders()
    if len(folders) > 0:
        return folders[0]

    return tempfile.gettempdir()


# reuse anaconda helper functions 
开发者ID:DamnWidget,项目名称:anaconda_rust,代码行数:18,代码来源:helpers.py

示例9: legacy_parse_global

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import version [as 别名]
def legacy_parse_global(self):
        """
        Parse global settings.

        LEGACY.
        """

        self.csm = ColorSchemeMatcher(self.scheme_file)

        # Get general theme colors from color scheme file
        self.bground = self.csm.special_colors['background']['color_simulated']
        rgba = RGBA(self.bground)
        self.lums = rgba.get_true_luminance()
        is_dark = self.lums <= LUM_MIDPOINT
        self._variables = {
            "is_dark": is_dark,
            "is_light": not is_dark,
            "sublime_version": int(sublime.version()),
            "mdpopups_version": ver.version(),
            "color_scheme": self.scheme_file,
            "use_pygments": self.use_pygments,
            "default_style": self.default_style
        }
        self.html_border = rgba.get_rgb()
        self.fground = self.csm.special_colors['foreground']['color_simulated'] 
开发者ID:facelessuser,项目名称:sublime-markdown-popups,代码行数:27,代码来源:st_scheme_template.py

示例10: get_variables

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import version [as 别名]
def get_variables(self):
        """Get variables."""

        if not self.legacy_color_matcher:
            is_dark = self.is_dark()
            return {
                "is_dark": is_dark,
                "is_light": not is_dark,
                "sublime_version": int(sublime.version()),
                "mdpopups_version": ver.version(),
                "color_scheme": self.scheme_file,
                "use_pygments": self.use_pygments,
                "default_style": self.default_style
            }
        else:
            return self._variables 
开发者ID:facelessuser,项目名称:sublime-markdown-popups,代码行数:18,代码来源:st_scheme_template.py

示例11: get_selector_style_map

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import version [as 别名]
def get_selector_style_map(view, selectors):
    styles = {}

    if int(sublime.version()) > 3153:
        for s in selectors:
            styles[s] = view.style_for_scope(s)
    else:
        color_scheme = get_color_scheme()
        top_scores = {}
        for s in selectors:
            for scope in color_scheme["scopes"]:
                score = sublime.score_selector(s, scope["scope"])
                top_score = top_scores.get(s, 0)
                if score > 0 and score >= top_score:
                    top_scores[s] = score
                    styles[s] = scope["style"]
    return styles 
开发者ID:jcberquist,项目名称:sublimetext-cfml,代码行数:19,代码来源:minihtml.py

示例12: get_color_scheme

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import version [as 别名]
def get_color_scheme(view=None):
    if int(sublime.version()) > 3153:
        return view.style()

    setting = sublime.load_settings("Preferences.sublime-settings").get("color_scheme")
    color_scheme_bytes = sublime.load_binary_resource(setting)
    color_scheme = {"scopes": []}
    for setting in plistlib.readPlistFromBytes(color_scheme_bytes)["settings"]:
        if "scope" in setting:
            this_scope = {"scope": setting["scope"], "style": {}}
            for key in ["foreground", "background"]:
                if key in setting["settings"]:
                    this_scope["style"][key] = setting["settings"][key]
            for key in ["italic", "bold"]:
                this_scope["style"][key] = (
                    "fontStyle" in setting["settings"]
                    and key in setting["settings"]["fontStyle"].lower()
                )
            color_scheme["scopes"].append(this_scope)
        elif "settings" in setting:
            for key in ["foreground", "background"]:
                if key in setting["settings"]:
                    color_scheme[key] = setting["settings"][key]
    return color_scheme 
开发者ID:jcberquist,项目名称:sublimetext-cfml,代码行数:26,代码来源:minihtml.py

示例13: get

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import version [as 别名]
def get(group):
    base = ""
    extension = ""
    if int(sublime.version()) < 3000:
        base = "/".join(["..", _icon_folder])
    else:
        base = "/".join(["Packages", _icon_folder])
        extension = ".png"

    return "/".join([base, _icons[group] + extension]) 
开发者ID:sascha-wolf,项目名称:sublime-GitConflictResolver,代码行数:12,代码来源:icons.py

示例14: _delete

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import version [as 别名]
def _delete(self, files):
        '''Delete is fast, no need to bother with threads or even status message
        But need to bother with encoding of error messages since they are vary,
        depending on OS and/or version of Python
        '''
        errors = []
        if ST3:
            fail = (PermissionError, FileNotFoundError)
        else:
            fail = OSError
            sys_enc = locale.getpreferredencoding(False)
        for filename in files:
            fqn = join(self.path, filename)
            try:
                if isdir(fqn):
                    shutil.rmtree(fqn)
                else:
                    os.remove(fqn)
            except fail as e:
                e = str(e).split(':')[0].replace('[Error 5] ', 'Access denied')
                if not ST3:
                    try:
                        e = str(e).decode(sys_enc)
                    except:  # failed getpreferredencoding
                        e = 'Unknown error'
                errors.append(u'{0}:\t{1}'.format(e, filename))
        self.view.run_command('dired_refresh')
        if errors:
            sublime.error_message(u'Some files couldn’t be deleted: \n\n' + '\n'.join(errors)) 
开发者ID:aziz,项目名称:SublimeFileBrowser,代码行数:31,代码来源:dired_file_operations.py

示例15: quick_panel_list

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import version [as 别名]
def quick_panel_list(self):
        return [ [plugin.name + ' (' + plugin.version + ')', plugin.description] for plugin in self.plugins ] 
开发者ID:nicosantangelo,项目名称:sublime-gulp,代码行数:4,代码来源:plugins.py


注:本文中的sublime.version方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。