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


Python sublime.load_settings方法代码示例

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


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

示例1: run

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import load_settings [as 别名]
def run(self, setting, default):
        sksp_options_dict = {
            "ksp_compact_output" : "Remove Indents and Empty Lines",
            "ksp_compact_variables" : "Compact Variables",
            "ksp_extra_checks" : "Extra Syntax Checks",
            "ksp_optimize_code" : "Optimize Compiled Code",
            "ksp_signal_empty_ifcase" : "Raise Error on Empty 'if' or 'case' Statements",
            "ksp_add_compiled_date" : "Add Compilation Date/Time Comment",
            "ksp_comment_inline_functions" : "Insert Comments When Expanding Functions",
            "ksp_play_sound" : "Play Sound When Compilation Finishes"
        }

        s = sublime.load_settings("KSP.sublime-settings")
        s.set(setting, not s.get(setting, False))
        sublime.save_settings("KSP.sublime-settings")

        if s.get(setting, False):
            option_toggle = "enabled!"
        else:
            option_toggle = "disabled!"

        sublime.status_message('SublimeKSP option %s is %s' % (sksp_options_dict[setting], option_toggle)) 
开发者ID:nojanath,项目名称:SublimeKSP,代码行数:24,代码来源:ksp_plugin.py

示例2: run

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import load_settings [as 别名]
def run(self, *args, **kwargs):
        view = sublime.active_window().active_view()

        #settings = sublime.load_settings('KSP.sublime-settings')
        #scheme_file = settings.get('color_scheme', 'Packages/SublimeKSP/KScript Light.tmTheme')
        scheme_file = 'Packages/SublimeKSP/KScript Light.tmTheme'
        plist = readPlistFromBytes(sublime.load_binary_resource(scheme_file))

        result = ['[pre]']
        start, end = view.sel()[0].a, view.sel()[0].b
        if start == end:
            start, end = 0, view.size()
        for a, b, scopes in get_ranges(view.scope_name(i) for i in range(start, end)):
            result.append(self.apply_style(scopes, plist, view.substr(sublime.Region(start+a, start+b))))
        result.append('[/pre]')
        sublime.set_clipboard(''.join(result)) 
开发者ID:nojanath,项目名称:SublimeKSP,代码行数:18,代码来源:bbcode.py

示例3: run

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import load_settings [as 别名]
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') 
开发者ID:kublaios,项目名称:dired,代码行数:19,代码来源:dired.py

示例4: run

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import load_settings [as 别名]
def run(self, edit): 
		selectedcode = ""
		sels = self.view.sel()
		for sel in sels:
			selectedcode = selectedcode + self.view.substr(sel)
		if len(selectedcode) == 0:
			selectedcode = self.view.substr(self.view.line(sel)) 
		selectedcode = selectedcode + "\n"
		dofile_path =tempfile.gettempdir()+'selectedlines_piupiu.do'
		with codecs.open(dofile_path, 'w', encoding='utf-8') as out:  
		    out.write(selectedcode) 
		version, stata_app_id = get_stata_version()
		cmd = """osascript<< END
		 tell application id "{0}"
		    DoCommandAsync "run {1}"  with addToReview
		 end tell
		 END""".format(stata_app_id,dofile_path) 
		progswitch=sublime.load_settings('StataImproved.sublime-settings').get("prog")
		print(cmd)
		print("stata_app_id")
		print(stata_app_id)
		os.system(cmd) 
开发者ID:zizhongyan,项目名称:StataImproved,代码行数:24,代码来源:StataImproved.py

示例5: on_pick_point

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import load_settings [as 别名]
def on_pick_point(self, index):
        if index == -1:
            return
        name, target = self.jump_points[index]
        if isdir(target):
            settings = load_settings('dired.sublime-settings')
            smart_jump = settings.get('dired_smart_jump', False)
            auto = self.new_window == 'auto'
            if self.new_window is True or ((not smart_jump) and auto) or (smart_jump and auto and len(self.view.window().views()) > 0):
                self.view.run_command("dired_open_in_new_window", {"project_folder": [target]})
            else:
                show(self.view.window(), target, view_id=self.view.id())
                status_message(u"Jumping to point '{0}' complete".format(unicodify(name)))
        else:
            # workaround ST3 bug https://github.com/SublimeText/Issues/issues/39
            self.view.window().run_command('hide_overlay')
            msg = u"Can't jump to '{0} → {1}'.\n\nRemove that jump point?".format(name, target)
            if ok_cancel_dialog(msg):
                points = load_jump_points()
                del points[name]
                save_jump_points(points)
                status_message(u"Jump point '{0}' was removed".format(name))
                self.view.run_command('dired_refresh') 
开发者ID:aziz,项目名称:SublimeFileBrowser,代码行数:25,代码来源:jumping.py

示例6: run

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import load_settings [as 别名]
def run(self, edit):
        pt = self.view.sel()[0].a
        row, col = self.view.rowcol(pt)
        points = [[n, t] for n, t in jump_points()]
        current_project = [points[row - 3][1]]
        settings = load_settings('dired.sublime-settings')
        smart_jump = settings.get('dired_smart_jump', False)
        if smart_jump and len(self.view.window().views()) == 1:
            show(self.view.window(), current_project[0])
        else:
            self.view.run_command("dired_open_in_new_window", {"project_folder": current_project})

        def close_view(view):
            if ST3:
                view.close()
            else:
                view.window().run_command("close_file")

        sublime.set_timeout(close_view(self.view), 100) 
开发者ID:aziz,项目名称:SublimeFileBrowser,代码行数:21,代码来源:jumping.py

示例7: sf_oauth2

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import load_settings [as 别名]
def sf_oauth2(sf_basic_config):
    sublconsole = SublConsole(sf_basic_config)
    settings =  sf_basic_config.get_setting()
    from SalesforceXyTools.libs import auth
    project_setting = settings
    # project_setting = settings["default_project_value"]
    is_sandbox = project_setting["is_sandbox"]

    if refresh_token(sf_basic_config):
        return

    server_info = sublime.load_settings("sfdc.server.sublime-settings")
    client_id = server_info.get("client_id")
    client_secret = server_info.get("client_secret")
    redirect_uri = server_info.get("redirect_uri")
    oauth = auth.SalesforceOAuth2(client_id, client_secret, redirect_uri, is_sandbox)
    authorize_url = oauth.authorize_url()
    sublconsole.debug('authorize_url-->')
    sublconsole.debug(authorize_url)
    start_server()
    open_in_default_browser(sf_basic_config, authorize_url) 
开发者ID:exiahuang,项目名称:SalesforceXyTools,代码行数:23,代码来源:util.py

示例8: run

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import load_settings [as 别名]
def run(self):
        self.sf_basic_config = SfBasicConfig()
        self.settings = self.sf_basic_config.get_setting()
        self.sublconsole = SublConsole(self.sf_basic_config)
        self.window = sublime.active_window()
        self.osutil = util.OsUtil(self.sf_basic_config)

        s = sublime.load_settings(SFDX_SETTINGS)
        tasks = s.get("tasks")
        
        self.env = s.get("custom_env")
        self.env.update(DxEnv().get_env())
        self.env.update(CommandEnv(self.window, self.sf_basic_config.get_project_dir()).get_env())
        self.sel_keys = [task["label"] for task in tasks]
        self.sel_vals = [task for task in tasks]

        self.window.show_quick_panel(self.sel_keys, self.panel_done, sublime.MONOSPACE_FONT) 
开发者ID:exiahuang,项目名称:SalesforceXyTools,代码行数:19,代码来源:sfdx.py

示例9: plugin_loaded

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import load_settings [as 别名]
def plugin_loaded():
    """
    perform some work to set up env correctly.
    """
    global global_path
    global local_path
    global settings
    settings = sublime.load_settings(SETTINGS_FILE)
    view = sublime.active_window().active_view()
    if platform != "windows":
        maybe_path = calculate_user_path()
        if len(maybe_path) > 0:
            global_path = maybe_path[0]
    search_path = generate_search_path(view)
    local_path = search_path
    print_status(global_path, search_path) 
开发者ID:bcomnes,项目名称:sublime-standard-format,代码行数:18,代码来源:standard-format.py

示例10: run

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import load_settings [as 别名]
def run(self, edit):
        settings = sublime.load_settings(SETTINGS_FILE_NAME)
        network_info_on_hover = settings.get(NETWORK_INFO_ON_HOVER_SETTING_NAME, True)
        print(network_info_on_hover)
        settings.set(NETWORK_INFO_ON_HOVER_SETTING_NAME, not network_info_on_hover)
        sublime.save_settings(SETTINGS_FILE_NAME)

        setting_status = 'ON' if not network_info_on_hover else 'OFF'
        set_status = 'Network Info Popup: {}'.format(setting_status)

        def clear_status():
            current_status = self.view.get_status(STATUS_KEY)
            if set_status == current_status:
                self.view.erase_status(STATUS_KEY)

        self.view.set_status(STATUS_KEY, set_status)
        sublime.set_timeout_async(clear_status, 4000) 
开发者ID:heyglen,项目名称:network_tech,代码行数:19,代码来源:listener.py

示例11: fix_scheme_in_settings

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import load_settings [as 别名]
def fix_scheme_in_settings(settings_file,current_scheme, new_scheme, regenerate=False):
  """Change the color scheme in the given Settings to a background-corrected one"""
  from os.path import join, normpath, isfile

  settings = load_settings(settings_file)
  settings_scheme = settings.get("color_scheme")
  if current_scheme == settings_scheme:
    new_scheme_path =  join(packages_path(), normpath(new_scheme[len("Packages/"):]))
    if isfile(new_scheme_path) and not regenerate:
      settings.set("color_scheme", new_scheme)
    else:
      generate_scheme_fix(current_scheme, new_scheme_path)
      settings.set("color_scheme", new_scheme)
    save_settings(settings_file)
    return True
  return False 
开发者ID:ggordan,项目名称:GutterColor,代码行数:18,代码来源:gutter_color.py

示例12: __init__

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import load_settings [as 别名]
def __init__(self, *args, **kwargs):
        self.settings = sublime.load_settings('Glue.sublime-settings')
        self.stdout = ""
        self.stderr = ""
        self.exitcode = 1
        self.userpath = self.settings.get('glue_userpath')
        self.shellpath = self.settings.get('glue_shellpath')
        self.original_env_path = os.environ['PATH']
        self.ps1 = self.settings.get('glue_ps1')
        self.start_dirpath = ""
        self.current_dirpath = self.settings.get('glue_working_directory')
        self.current_filepath = ""
        self.attr_lock = threading.Lock() # thread lock for attribute reads/writes
        sublime_plugin.TextCommand.__init__(self, *args, **kwargs)

    #------------------------------------------------------------------------------
    # [ run method ] - plugin start method
    #------------------------------------------------------------------------------ 
开发者ID:chrissimpkins,项目名称:glue,代码行数:20,代码来源:Glue.py

示例13: run

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import load_settings [as 别名]
def run(self, edit):
        self.settings = sublime.load_settings(SETTINGS)
        self.hound_url = self.settings.get("hound_url").rstrip("/")
        self.github_base_url = self.settings.get("github_base_url")
        self.exclude_repos = set(self.settings.get("exclude_repos", []))
        self.custom_headers = self.settings.get("custom_headers", {})
        self.debug = self.settings.get("debug", False)
        if self.debug:
            logger.setLevel(logging.DEBUG)
            http.client.HTTPConnection.debuglevel = 1
        else:
            http.client.HTTPConnection.debuglevel = 0

        if self.hound_url == "" or self.github_base_url == "":
            self.settings.set("hound_url", self.hound_url)
            self.settings.set("github_base_url", self.github_base_url)
            sublime.save_settings(self.SETTINGS)  # save them so we have something to edit
            sublime.error_message("Please set your hound_url and github_base_url.")
            self.open_settings()
            return 
开发者ID:bgreenlee,项目名称:SublimeHound,代码行数:22,代码来源:hound.py

示例14: _detect_language

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import load_settings [as 别名]
def _detect_language(view, settings_name):
  point = view.sel()[0].b
  settings = sublime.load_settings(settings_name + ".sublime-settings")
  selectors = settings.get("scope_selectors")
  def maximal_score(scopes):
    if not scopes:  # validity check
      return 0
    return max(view.score_selector(point, s) for s in scopes)
  # calculate the maximal score for each language
  scores = [(k, maximal_score(v)) for k, v in selectors.items()]
  if not scores:  # validity check
    return
  # get the language with the best score
  scored_lang, score = max(scores, key=lambda item: item[1])
  language = scored_lang if score else ""
  return language 
开发者ID:aronwoost,项目名称:sublime-expand-region,代码行数:18,代码来源:ExpandRegion.py

示例15: is_checked

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import load_settings [as 别名]
def is_checked(self, setting, default):
        return bool(sublime.load_settings("KSP.sublime-settings").get(setting, default)) 
开发者ID:nojanath,项目名称:SublimeKSP,代码行数:4,代码来源:ksp_plugin.py


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