本文整理汇总了Python中sublime.save_settings函数的典型用法代码示例。如果您正苦于以下问题:Python save_settings函数的具体用法?Python save_settings怎么用?Python save_settings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了save_settings函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_panel_close
def on_panel_close(i):
if i == 1 or i == 2:
view = win.open_file(changelog_fn)
if i == 1:
run_go_get(view)
settings.set('tracking_rev', new_rev)
sublime.save_settings(settings_fn)
示例2: on_done_filename
def on_done_filename(self, value):
self.filename = value
# get selected text, or the whole file if nothing selected
if all([region.empty() for region in self.view.sel()]):
text = self.view.substr(sublime.Region(0, self.view.size()))
else:
text = "\n".join([self.view.substr(region) for region in self.view.sel()])
try:
gist = self.gistapi.create_gist(description=self.description,
filename=self.filename,
content=text,
public=self.public)
self.view.settings().set('gist', gist)
sublime.set_clipboard(gist["html_url"])
sublime.status_message(self.MSG_SUCCESS)
except GitHubApi.UnauthorizedException:
# clear out the bad token so we can reset it
self.settings.set("github_token", "")
sublime.save_settings("GitHub.sublime-settings")
sublime.error_message(self.ERR_UNAUTHORIZED_TOKEN)
sublime.set_timeout(self.get_username, 50)
except GitHubApi.UnknownException as e:
sublime.error_message(e.message)
except GitHubApi.ConnectionException as e:
sublime.error_message(e.message)
示例3: on_done_password
def on_done_password(self, value):
"Callback for the password show_input_panel"
self.github_password = value
try:
api = GitHubApi(self.base_uri, debug=self.debug)
self.github_token = api.get_token(self.github_user,
self.github_password,
self.github_one_time_password)
self.github_password = self.github_one_time_password = None # don't keep these around
self.accounts[self.active_account]["github_token"] = self.github_token
self.settings.set("accounts", self.accounts)
sublime.save_settings("GitHub.sublime-settings")
self.gistapi = GitHubApi(self.base_uri, self.github_token, debug=self.debug)
try:
if self.callback:
sublime.error_message(self.MSG_TOKEN_SUCCESS)
callback = self.callback
self.callback = None
sublime.set_timeout(callback, 50)
except AttributeError:
pass
except GitHubApi.OTPNeededException:
sublime.set_timeout(self.get_one_time_password, 50)
except GitHubApi.UnauthorizedException:
sublime.error_message(self.ERR_UNAUTHORIZED)
sublime.set_timeout(self.get_username, 50)
except GitHubApi.UnknownException as e:
sublime.error_message(e.message)
示例4: _save_test_run
def _save_test_run(self, command: str) -> None:
"""Save the last ran test
"""
s = sublime.load_settings('PythonTestRunner.last-run')
s.set('last_test_run', command)
sublime.save_settings('PythonTestRunner.last-run')
示例5: generate
def generate(self, sourcePath):
if not sourcePath:
return
if not os.path.isdir(sourcePath):
sublime.error_message("'{0}' is not a valid path to a directory.".format(sourcePath))
return
appKitPath = join(sourcePath, "AppKit")
foundationPath = join(sourcePath, "Foundation")
if not os.path.isdir(appKitPath) or not os.path.isdir(foundationPath):
sublime.error_message("'{0}' does not appear to be a Cappuccino source directory.".format(sourcePath))
return
self.parse_source_directory(appKitPath)
self.parse_source_directory(foundationPath)
self.write_instance_methods()
self.write_class_methods()
self.write_classes()
self.write_functions()
self.write_constants()
# If we make it this far, save the path so next time the user does not have to enter it
settings = sublime.load_settings(self.OBJECTIVEJ_SETTINGS)
settings.set(self.CAPPUCCINO_SOURCE_PATH_SETTING, sourcePath)
sublime.save_settings(self.OBJECTIVEJ_SETTINGS)
sublime.error_message("Cappuccino completions successfully generated.")
示例6: on_select_done
def on_select_done(self, picked):
entry = GetSearchEngineEntry(picked)
settings = sublime.load_settings(__name__ + '.sublime-settings')
settings.set('searchanywhere_searchengine', entry.get('name'))
settings.set('searchanywhere_searchurl', entry.get('searchurl'))
sublime.save_settings(__name__ + '.sublime-settings')
示例7: modify_and_save_settings
def modify_and_save_settings(self):
settings = sublime.load_settings("Preferences.sublime-settings")
settings.set("color_scheme", self.colors)
settings.set("theme", self.theme)
sublime.save_settings("Preferences.sublime-settings")
示例8: save_config
def save_config(self, filezilla_db_path):
settings = sublime.load_settings("SublimeZilla.sublime-settings")
settings.set("filezilla_db_path", filezilla_db_path)
sublime.save_settings("SublimeZilla.sublime-settings")
# Now, show the quick panel
self.quick_panel()
示例9: handle_thread
def handle_thread(thread, timeout):
if thread.is_alive():
sublime.set_timeout(lambda: handle_thread(thread, timeout), timeout)
return
# If succeed, something may happen,
# for example, user password is expired
result = api.result
if result == None: return
if "status_code" in result and result["status_code"] > 399: return
# Load COMPONENT_METADATA_SETTINGS Settings and put all result into it
# Every org has one local repository
component_metadata = result
component_settings = sublime.load_settings(COMPONENT_METADATA_SETTINGS)
component_settings.set(toolingapi_settings["username"], component_metadata)
sublime.save_settings(COMPONENT_METADATA_SETTINGS)
print (message.SEPRATE.format('All code are Downloaded.'))
sublime.status_message(message.DOWNLOAD_ALL_SUCCESSFULLY)
# After Refresh all succeed, start initiate sobject completions
handle_initiate_sobjects_completions(120)
# If get_static_resource_body is true,
# start to get all binary body of static resource
if toolingapi_settings["get_static_resource_body"]:
handle_get_static_resource_body(toolingapi_settings)
示例10: on_done
def on_done(self, index):
saved_layouts = self.settings.get('saved_layouts')
if index != -1:
saved_layouts.pop(index)
self.settings.set('saved_layouts', saved_layouts)
sublime.save_settings('Origami.sublime-settings')
示例11: save_config
def save_config(self, value=None, type=None):
self.settings.set('font_size', self.size)
self.settings.set('font_face', self.face)
self.update_options()
sublime.save_settings(self.settings_id)
if type:
sublime.status_message("Fontafeelya: %s set to %s" % (type,value))
示例12: 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)
示例13: cycle_scheme
def cycle_scheme(backward=False, purge=False):
settings = sublime.load_settings('Preferences.sublime-settings')
current_scheme = settings.get('color_scheme')
raw_path = sublime.packages_path()
package_path = fix_path(raw_path)
schemes = ['/'.join([
fix_path(dirpath[len(dirname(package_path)) + 1:]),
filename,
])
for dirpath, _, filenames in os.walk(package_path)
for filename in filenames if filename.endswith('.tmTheme')
]
schemes.sort(key=lambda x: basename(x))
i = schemes.index(current_scheme) + (backward and -1 or 1)
i = 0 if i == len(schemes) else len(schemes) - 1 if i == -1 else i
scheme = schemes[i]
if not scheme:
return
settings.set('color_scheme', scheme)
sublime.save_settings('Preferences.sublime-settings')
sublime.status_message(
u'Color Scheme: ' + friendly_name(scheme)
)
if purge:
purge_scheme(raw_path.rstrip('Packages'), current_scheme)
示例14: ondone
def ondone(mstr):
settings = sublime.load_settings("luadbg.sublime-settings")
global searchpaths
if searchpaths.count(mstr) == 0:
searchpaths.append(mstr)
settings.set("searchpaths",searchpaths)
sublime.save_settings("luadbg.sublime-settings")
示例15: onConfigDone
def onConfigDone(self, data):
# print(self.window.project_data())
global SETTINGS
global CONFIG_PATH
CONFIG_PATH = data
if CONFIG_PATH == "":
sublime.error_message(u"需设置 UI 资源路径!")
return
isOk = sublime.ok_cancel_dialog(u"是否将 UI 资源路径设置为: " + CONFIG_PATH + " ?")
if not isOk:
self.window.show_input_panel(u"重新设置 UI 资源路径:", "", self.onConfigDone, None, self.onConfigCancel)
else:
# print(CONFIG_PATH)
SETTINGS.set("UIResPath", CONFIG_PATH)
#保存配置 在user目录下的 PUIEditor.sublime-settings文件
sublime.save_settings(SETTING_FILE)
projectData = self.window.project_data()
folders = projectData['folders']
folders.append({"path": CONFIG_PATH})
self.window.set_project_data(projectData)
snippetsGenerate = SnippetsGenerate()
snippetsGenerate.dealFiles()