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


Python sublime.load_settings函数代码示例

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


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

示例1: apply_setting

 def apply_setting(self, name):
     """Directly apply the provided theme or color scheme."""
     if any(sublime.find_resources(os.path.basename(name))):
         sublime.load_settings(self.PREFS_FILE).set(self.KEY, name)
         sublime.save_settings(self.PREFS_FILE)
     else:
         sublime.status_message(name + " does not exist!")
开发者ID:chmln,项目名称:sublime-text-theme-switcher-menu,代码行数:7,代码来源:theme_switcher.py

示例2: run

    def run(self, edit, key=None):
        assert(not key is None)
        list_to_map = lambda seq: dict([(el["from"], el["to"]) for el in seq])
        if not hasattr(self, "_settings"):
            default_settings = sublime.load_settings("MetaSubstitution.sublime-settings")
            user_settings = sublime.load_settings("Preferences.sublime-settings")
            meta_substitutions = list_to_map(default_settings.get("meta_substitutions", []))
            meta_substitutions.update(list_to_map(user_settings.get("meta_substitutions", [])))
            setattr(self, "_settings", meta_substitutions)
        selection = self.view.sel()
        stored_cursor_positions = []
        substitute_for = None

        for k, v in self._settings.items():
            if k == key:
                substitute_for = v
        
        if substitute_for is None:
            return
        
        for subselection in selection:
            if subselection.empty():
                self.view.insert(edit, subselection.a, substitute_for)
            else:
                stored_cursor_positions.append(sublime.Region(subselection.begin() + 1))
                self.view.replace(edit, subselection, substitute_for)

        if stored_cursor_positions:
            selection.clear()
            for cursor_position in new_cursor_positions:
                selection.add(cursor_position)
开发者ID:htch,项目名称:SublimeMetaSubstitutionPlugin,代码行数:31,代码来源:MetaSubstitution.py

示例3: is_enabled

 def is_enabled(self, save_to_file=False):
     enabled = True
     if save_to_file and not bool(sublime.load_settings(self.settings).get("enable_save_to_file_commands", False)):
         enabled = False
     elif not save_to_file and not bool(sublime.load_settings(self.settings).get("enable_show_in_buffer_commands", False)):
         enabled = False
     return enabled
开发者ID:MattDMo,项目名称:OSX-sublime2-Packages,代码行数:7,代码来源:plist_json_convert.py

示例4: init

	def init(self, isST2):
		self.isST2 = isST2
		self.projects_index_cache = {}
		self.index_cache_location = os.path.join(
			sublime.packages_path(),
			'User',
			'AngularJS.cache'
		)
		self.is_indexing = False
		self.attributes = []
		self.settings = sublime.load_settings('AngularJS-sublime-package.sublime-settings')
		self.settings_completions = sublime.load_settings('AngularJS-completions.sublime-settings')
		self.settings_js_completions = sublime.load_settings('AngularJS-js-completions.sublime-settings')

		try:
			json_data = open(self.index_cache_location, 'r').read()
			self.projects_index_cache = json.loads(json_data)
			json_data.close()
		except:
			pass

		self.settings_completions.add_on_change('core_attribute_list', self.process_attributes)
		self.settings_completions.add_on_change('extended_attribute_list', self.process_attributes)
		self.settings_completions.add_on_change('AngularUI_attribute_list', self.process_attributes)
		self.settings.add_on_change('enable_data_prefix', self.process_attributes)
		self.settings.add_on_change('enable_AngularUI_directives', self.process_attributes)
		self.process_attributes()
开发者ID:ArtakManukyan,项目名称:config,代码行数:27,代码来源:AngularJS-sublime-package.py

示例5: paste

    def paste(self):
        """Paste files."""

        errors = False
        self.to_path = path.join(FuzzyFileNavCommand.cwd, FuzzyPanelText.get_content())
        FuzzyPanelText.clear_content()
        move = (self.cls.action == "cut")
        self.from_path = self.cls.clips[0]
        self.cls.clear_entries()
        multi_file = (
            bool(sublime.load_settings(FUZZY_SETTINGS).get("keep_panel_open_after_action", False)) and
            "paste" not in sublime.load_settings(FUZZY_SETTINGS).get("keep_panel_open_exceptions", [])
        )

        if not multi_file:
            self.window.run_command("hide_overlay")
            FuzzyFileNavCommand.reset()
        else:
            FuzzyFileNavCommand.fuzzy_reload = True

        if path.exists(self.from_path):
            if path.isdir(self.from_path):
                self.action = shutil.copytree if not bool(move) else shutil.move
                errors = self.dir_copy()
            else:
                self.action = shutil.copyfile if not bool(move) else shutil.move
                errors = self.file_copy()
        if multi_file:
            if errors:
                FuzzyFileNavCommand.reset()
            else:
                self.window.run_command("hide_overlay")
                self.window.run_command("fuzzy_file_nav", {"start": FuzzyFileNavCommand.cwd})
开发者ID:sevensky,项目名称:MyST3Data,代码行数:33,代码来源:fuzzy_file_nav.py

示例6: run

    def run(self):
        """Run command."""

        errors = False
        full_name = path.join(FuzzyFileNavCommand.cwd, FuzzyPanelText.get_content())
        FuzzyPanelText.clear_content()
        multi_file = (
            bool(sublime.load_settings(FUZZY_SETTINGS).get("keep_panel_open_after_action", False)) and
            "mkdir" not in sublime.load_settings(FUZZY_SETTINGS).get("keep_panel_open_exceptions", [])
        )
        if not multi_file:
            self.window.run_command("hide_overlay")
            FuzzyFileNavCommand.reset()
        else:
            FuzzyFileNavCommand.fuzzy_reload = True

        try:
            os.makedirs(full_name)
        except Exception:
            errors = True
            error("Could not create %d!" % full_name)

        if multi_file:
            if errors:
                FuzzyFileNavCommand.reset()
            else:
                self.window.run_command("hide_overlay")
                self.window.run_command("fuzzy_file_nav", {"start": FuzzyFileNavCommand.cwd})
开发者ID:sevensky,项目名称:MyST3Data,代码行数:28,代码来源:fuzzy_file_nav.py

示例7: __init__

    def __init__(self, window):
        RdioCommand.__init__(self,window)

        self.just_opened = True
        self.typed = ""
        self.last_content = ""

        self.suggestion_selector = "→"
        self.selected_suggestion_index = None

        self.input_view_width = 0

        # Two way producer / consumer
        self.last_sent_query = ""
        self.query_q = Queue()
        self.suggestion_q = Queue()
        self.suggestions = []
        self.END_OF_SUGGESTIONS = ''
        self.STOP_THREAD_MESSAGE = 'END_OF_THREAD_TIME' # passed as a query to stop the thread

        settings = sublime.load_settings("Preferences.sublime-settings")
        self.user_tab_complete_value = settings.get("tab_completion", None)

        rdio_settings = sublime.load_settings("Rdio.sublime-settings")
        self.enable_search_suggestions = rdio_settings.get("enable_search_suggestions")
开发者ID:smpanaro,项目名称:sublime-rdio,代码行数:25,代码来源:sublime_rdio.py

示例8: run

    def run(self):
        error = False
        full_name = path.join(FuzzyFileNavCommand.cwd, FuzzyPanelText.get_content())
        FuzzyPanelText.clear_content()
        multi_file = (
            bool(sublime.load_settings(FUZZY_SETTINGS).get("keep_panel_open_after_action", False)) and
            "mkfile" not in sublime.load_settings(FUZZY_SETTINGS).get("keep_panel_open_exceptions", [])
        )
        if not multi_file:
            self.window.run_command("hide_overlay")
            FuzzyFileNavCommand.reset()
        else:
            FuzzyFileNavCommand.fuzzy_reload = True

        try:
            with open(full_name, "a"):
                pass
            self.window.open_file(full_name)
        except:
            error = True
            sublime.error_message("Could not create %s!" % full_name)

        if multi_file:
            if error:
                FuzzyFileNavCommand.reset()
            else:
                self.window.run_command("fuzzy_file_nav", {"start": FuzzyFileNavCommand.cwd})
开发者ID:Mondego,项目名称:pyreco,代码行数:27,代码来源:allPythonContent.py

示例9: run

    def run(self, edit, parser='markdown', target='browser'):
        settings = sublime.load_settings('MarkdownPreview.sublime-settings')

        # backup parser+target for later saves
        self.view.settings().set('parser', parser)
        self.view.settings().set('target', target)

        html, body = compiler.run(self.view, parser)

        if target in ['disk', 'browser']:
            # check if LiveReload ST2 extension installed and add its script to the resulting HTML
            livereload_installed = ('LiveReload' in os.listdir(sublime.packages_path()))
            # build the html
            if livereload_installed:
                port = sublime.load_settings('LiveReload.sublime-settings').get('port', 35729)
                html += '<script>document.write(\'<script src="http://\' + (location.host || \'localhost\').split(\':\')[0] + \':%d/livereload.js?snipver=1"></\' + \'script>\')</script>' % port
            # update output html file
            tmp_fullpath = getTempMarkdownPreviewPath(self.view)
            save_utf8(tmp_fullpath, html)
            # now opens in browser if needed
            if target == 'browser':
                self.__class__.open_in_browser(tmp_fullpath, settings.get('browser', 'default'))
        elif target == 'sublime':
            # create a new buffer and paste the output HTML
            embed_css = settings.get('embed_css_for_sublime_output', True)
            if embed_css:
                new_scratch_view(self.view.window(), html)
            else:
                new_scratch_view(self.view.window(), body)
            sublime.status_message('Markdown preview launched in sublime')
        elif target == 'clipboard':
            # clipboard copy the full HTML
            sublime.set_clipboard(html)
            sublime.status_message('Markdown export copied to clipboard')
开发者ID:ChristinaLeuci,项目名称:sublimetext-markdown-preview,代码行数:34,代码来源:MarkdownPreview.py

示例10: load_settings

 def load_settings(self):
     self.settings = sublime.load_settings('GitGutter.sublime-settings')
     self.user_settings = sublime.load_settings('Preferences.sublime-settings')
     self.git_binary_path = 'git'
     git_binary = self.user_settings.get('git_binary') or self.settings.get('git_binary')
     if git_binary:
         self.git_binary_path = git_binary
开发者ID:shmup,项目名称:GitGutter,代码行数:7,代码来源:git_gutter_handler.py

示例11: _toggle_debug_mode

def _toggle_debug_mode(setting=None):
    if setting is not None:
        if isinstance(setting, tuple):
            settings_name = setting[0] + '.sublime-settings'
            preferences = load_settings(settings_name)
            setting = setting[1]
        else:
            settings_name = 'Preferences.sublime-settings'
            preferences = load_settings(settings_name)

        flag = not preferences.get(setting)
        if flag:
            preferences.set(setting, True)
        else:
            preferences.erase(setting)

        save_settings(settings_name)

        return flag
    else:
        global _DEBUG
        _DEBUG = not _DEBUG
        _set_debug_mode(_DEBUG)

        return _DEBUG
开发者ID:gerardroche,项目名称:sublimefiles,代码行数:25,代码来源:user_scriptease.py

示例12: update_url_highlights

    def update_url_highlights(self, view, force):
        settings = sublime.load_settings(UrlHighlighter.SETTINGS_FILENAME)
        if not force and not settings.get('auto_find_urls', True):
            return

        should_highlight_urls = settings.get('highlight_urls', True)
        max_url_limit = settings.get('max_url_limit', UrlHighlighter.DEFAULT_MAX_URLS)
        file_folder_regex = settings.get('file_folder_regex', '')
        combined_regex = '({})|({})'.format(UrlHighlighter.URL_REGEX, file_folder_regex) if file_folder_regex else UrlHighlighter.URL_REGEX

        if view.id() in UrlHighlighter.ignored_views:
            return

        urls = view.find_all(combined_regex)

        # Avoid slowdowns for views with too much URLs
        if len(urls) > max_url_limit:
            print("UrlHighlighter: ignoring view with %u URLs" % len(urls))
            UrlHighlighter.ignored_views.append(view.id())
            return

        UrlHighlighter.urls_for_view[view.id()] = urls

        should_highlight_urls = sublime.load_settings(UrlHighlighter.SETTINGS_FILENAME).get('highlight_urls', True)
        if (should_highlight_urls):
            self.highlight_urls(view, urls)
开发者ID:hrichardlee,项目名称:ClickableUrls_SublimeText,代码行数:26,代码来源:clickable_urls.py

示例13: run

    def run(self, edit):
        sortorder = ''
        self.settings = sublime.load_settings("CSScomb.sublime-settings")
        if not self.settings.has('sorter'):
            self.settings.set('sorter', 'local')
        sublime.save_settings('CSScomb.sublime-settings')

        if self.settings.get('custom_sort_order') == True:
            self.order_settings = sublime.load_settings("Order.sublime-settings")
            sortorder = self.order_settings.get('sort_order')
            sublime.status_message('Sorting with custom sort order...')

        selections = self.get_selections()
        SorterCall = self.get_sorter()

        threads = []
        for sel in selections:
            selbody = self.view.substr(sel)
            selbody = selbody.encode('utf-8')
            thread = SorterCall(sel, selbody, sortorder)

            threads.append(thread)
            thread.start()

        self.handle_threads(edit, threads, selections, offset=0, i=0)
开发者ID:i-akhmadullin,项目名称:Sublime-CSSComb,代码行数:25,代码来源:CSScomb.py

示例14: on_loaded

def on_loaded():
    global hostplatform_settings, host_settings, platform_settings, user_settings
    global _plugin_loaded

    if _plugin_loaded:
        debug.log("Plugin already loaded")
        return

    hostplatform_settings = sublime.load_settings(
        get_hostplatform_settings_filename())

    host_settings = sublime.load_settings(
        get_host_settings_filename())

    platform_settings = sublime.load_settings(
        get_platform_settings_filename())

    user_settings = sublime.load_settings(
        get_settings_filename())

    on_debug_change()

    debug.log('Registering Settings Callbacks')

    hostplatform_settings.add_on_change('debug', on_debug_change)
    user_settings.add_on_change('debug', on_debug_change)
    platform_settings.add_on_change('debug', on_debug_change)
    host_settings.add_on_change('debug', on_debug_change)

    if _on_plugin_loaded_callbacks is not None:
        for callback in _on_plugin_loaded_callbacks:
            callback()

    _plugin_loaded = True
    del _on_plugin_loaded_callbacks[:]
开发者ID:KuttKatrea,项目名称:sublime-toolrunner,代码行数:35,代码来源:settings.py

示例15: run

	def run(self, version="default"):
		AutoHotKeyExePath = ""

		AutoHotKeyExePath = sublime.load_settings("AutoHotkey.sublime-settings").get("AutoHotKeyExePath")[version]

		# Also try old settings format where path is stored as a named-key in a dictionary.
		if not os.path.isfile(AutoHotKeyExePath):
			print("AutoHotkey ahkexec.py run(): Trying default version, because could not find AutoHotKeyExePath for version=" + str(version))
			AutoHotKeyExePath = sublime.load_settings("AutoHotkey.sublime-settings").get("AutoHotKeyExePath")["default"]

		# Also try old settings format where path is stored as a list of paths
		if not os.path.isfile(AutoHotKeyExePath):
			print("AutoHotkey ahkexec.py run(): Trying string list (without dictionary key-pairs old format), because could not find AutoHotKeyExePath for version=" + str(version) + " or version=default")
			AutoHotKeyExePathList = sublime.load_settings("AutoHotkey.sublime-settings").get("AutoHotKeyExePath")
			for AutoHotKeyExePath in AutoHotKeyExePathList:
				if os.path.isfile(AutoHotKeyExePath):
					print ("Not valid AutoHotKeyExePath=" + AutoHotKeyExePath)
					break
				else:
					print ("Not valid AutoHotKeyExePath=" + AutoHotKeyExePath)
					continue

		if not os.path.isfile(AutoHotKeyExePath):
			print(r"ERROR: AutoHotkey ahkexec.py run(): Could not find AutoHotKeyExePath. Please create a Data\Packages\User\AutoHotkey.sublime-settings file to specify your custom path.")
		else:
			filepath = self.window.active_view().file_name()
			cmd = [AutoHotKeyExePath, "/ErrorStdOut", filepath]
			regex = "(.*) \(([0-9]*)\)() : ==> (.*)"
			self.window.run_command("exec", {"cmd": cmd, "file_regex": regex})
开发者ID:ahkscript,项目名称:SublimeAutoHotkey,代码行数:29,代码来源:ahkexec.py


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