本文整理汇总了Python中sublime.load_settings函数的典型用法代码示例。如果您正苦于以下问题:Python load_settings函数的具体用法?Python load_settings怎么用?Python load_settings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了load_settings函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: plugin_loaded
def plugin_loaded():
global settings_base
global Pref
settings = sublime.load_settings('Word Highlight.sublime-settings')
if int(sublime.version()) >= 2174:
settings_base = sublime.load_settings('Preferences.sublime-settings')
else:
settings_base = sublime.load_settings('Base File.sublime-settings')
class Pref:
def load(self):
Pref.color_scope_name = settings.get('color_scope_name', "comment")
Pref.highlight_delay = settings.get('highlight_delay', 0)
Pref.case_sensitive = (not bool(settings.get('case_sensitive', True))) * sublime.IGNORECASE
Pref.draw_outlined = bool(settings.get('draw_outlined', True)) * sublime.DRAW_OUTLINED
Pref.mark_occurrences_on_gutter = bool(settings.get('mark_occurrences_on_gutter', False))
Pref.icon_type_on_gutter = settings.get("icon_type_on_gutter", "dot")
Pref.highlight_when_selection_is_empty = bool(settings.get('highlight_when_selection_is_empty', False))
Pref.highlight_word_under_cursor_when_selection_is_empty = bool(settings.get('highlight_word_under_cursor_when_selection_is_empty', False))
Pref.word_separators = settings_base.get('word_separators')
Pref.show_status_bar_message = bool(settings.get('show_word_highlight_status_bar_message', True))
Pref.file_size_limit = int(settings.get('file_size_limit', 4194304))
Pref.when_file_size_limit_search_this_num_of_characters = int(settings.get('when_file_size_limit_search_this_num_of_characters', 20000))
Pref.timing = time.time()
Pref.enabled = True
Pref.prev_selections = None
Pref.prev_regions = None
Pref = Pref()
Pref.load()
settings.add_on_change('reload', lambda:Pref.load())
settings_base.add_on_change('wordhighlight-reload', lambda:Pref.load())
开发者ID:Nasakol,项目名称:WordHighlight,代码行数:34,代码来源:word_highlight.py
示例17: init
def init(self):
if self.inited:
return
sets = sublime.load_settings(settings_file)
if get_version() < 3000:
if sets.get("ha_style").startswith("underlined"):
sets.set("ha_style", "outlined")
if sets.get("icons"):
sets.set("icons", False)
if sets.get("icons_all"):
sets.set("icons_all", False)
sublime.save_settings(settings_file)
for k in ["enabled", "style", "ha_style", "icons_all", "icons", "color_formats"]:
self.settings[k] = sets.get(k)
self.settings["color_fmts"] = list(map(get_format, self.settings["color_formats"]))
sets.clear_on_change("ColorHighlighter")
sets.add_on_change("ColorHighlighter", lambda: self.on_ch_settings_change())
sets = sublime.load_settings("Preferences.sublime-settings")
self.settings["color_scheme"] = sets.get("color_scheme")
sets.clear_on_change("ColorHighlighter")
sets.add_on_change("ColorHighlighter", lambda: self.on_g_settings_change())
self.inited = True
for w in sublime.windows():
for v in w.views():
self.init_view(v)
开发者ID:rocknrollMarc,项目名称:Sublime-Text-2,代码行数:34,代码来源:ColorHighlighter.py
示例18: run
def run(self):
mm_response = None
args = self.get_arguments()
global_config.debug('>>> running thread arguments on next line!')
global_config.debug(args)
if self.debug_mode or 'darwin' not in sys.platform:
print(self.payload)
python_path = sublime.load_settings('mavensmate.sublime-settings').get('mm_python_location')
if 'darwin' in sys.platform or sublime.load_settings('mavensmate.sublime-settings').get('mm_debug_location') != None:
mm_loc = sublime.load_settings('mavensmate.sublime-settings').get('mm_debug_location')
else:
mm_loc = os.path.join(config.mm_dir,"mm","mm.py")
#p = subprocess.Popen("{0} {1} {2}".format(python_path, pipes.quote(mm_loc), args), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
if 'linux' in sys.platform or 'darwin' in sys.platform:
#osx, linux
p = subprocess.Popen('\'{0}\' \'{1}\' {2}'.format(python_path, mm_loc, self.get_arguments()), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
else:
#windows
if sublime.load_settings('mavensmate.sublime-settings').get('mm_debug_mode', False):
#user wishes to use system python
python_path = sublime.load_settings('mavensmate.sublime-settings').get('mm_python_location')
p = subprocess.Popen('"{0}" "{1}" {2}'.format(python_path, mm_loc, self.get_arguments()), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
else:
python_path = os.path.join(os.environ["ProgramFiles"],"MavensMate","App","python.exe")
if not os.path.isfile(python_path):
python_path = python_path.replace("Program Files", "Program Files (x86)")
p = subprocess.Popen('"{0}" -E "{1}" {2}'.format(python_path, mm_loc, self.get_arguments()), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
#process = subprocess.Popen("{0} {1} {2}".format(python_path, pipes.quote(mm_loc), self.get_arguments()), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
else:
p = subprocess.Popen("{0} {1}".format(pipes.quote(self.mm_path), args), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
#print("PAYLOAD: ",self.payload)
#print("PAYLOAD TYPE: ",type(self.payload))
if self.payload != None and type(self.payload) is str:
self.payload = self.payload.encode('utf-8')
p.stdin.write(self.payload)
p.stdin.close()
if p.stdout is not None:
mm_response = p.stdout.readlines()
elif p.stderr is not None:
mm_response = p.stderr.readlines()
#response_body = '\n'.join(mm_response.decode('utf-8'))
strs = []
for line in mm_response:
strs.append(line.decode('utf-8'))
response_body = '\n'.join(strs)
global_config.debug('>>> got a response body')
global_config.debug(response_body)
if '--html' not in args:
try:
valid_json = json.loads(response_body)
except:
response_body = generate_error_response(response_body)
self.response = response_body
开发者ID:CPDaveGalligher,项目名称:MavensMate-SublimeText,代码行数:60,代码来源:util.py
示例19: do
def do(renderer, keymap_counter):
default_packages = ['Default']
user_packages = ['User']
global_settings = sublime.load_settings("Preferences.sublime-settings")
ignored_packages = global_settings.get("ignored_packages", [])
package_control_settings = sublime.load_settings("Package Control.sublime-settings")
installed_packages = package_control_settings.get("installed_packages", [])
if len(installed_packages) == 0:
includes = ('.sublime-package')
os_packages = []
for (root, dirs, files) in os.walk(sublime.installed_packages_path()):
for file in files:
if file.endswith(includes):
os_packages.append(file.replace(includes, ''))
for (root, dirs, files) in os.walk(sublime.packages_path()):
for dir in dirs:
os_packages.append(dir)
break # just the top level
installed_packages = []
[installed_packages.append(package) for package in os_packages if package not in installed_packages]
diff = lambda l1,l2: [x for x in l1 if x not in l2]
active_packages = diff( default_packages + installed_packages + user_packages, ignored_packages)
keymapsExtractor = KeymapsExtractor(active_packages, keymap_counter)
worker_thread = WorkerThread(keymapsExtractor, renderer)
worker_thread.start()
ThreadProgress(worker_thread, 'Searching ' + MY_NAME, 'Done.', keymap_counter)
开发者ID:sandroqz,项目名称:sublime-text,代码行数:28,代码来源:Keymaps.py
示例20: plugin_loaded
def plugin_loaded():
global settings
settings = sublime.load_settings('LocalHistory.sublime-settings')
settings.add_on_change('reload', sublime.load_settings('LocalHistory.sublime-settings'))
status_msg('Target directory: "' + get_history_root() + '"')
开发者ID:rhamzeh,项目名称:local-history,代码行数:7,代码来源:LocalHistory.py
注:本文中的sublime.load_settings函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论