本文整理汇总了Python中sublime.run_command方法的典型用法代码示例。如果您正苦于以下问题:Python sublime.run_command方法的具体用法?Python sublime.run_command怎么用?Python sublime.run_command使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sublime
的用法示例。
在下文中一共展示了sublime.run_command方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUpClass
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import run_command [as 别名]
def setUpClass(cls):
"""Create a temp directory for testing."""
cls._temp_dir = tempfile.mkdtemp()
nwindows = len(sublime.windows())
original_window_id = sublime.active_window().id()
sublime.run_command("new_window")
yield lambda: len(sublime.windows()) > nwindows
yield lambda: sublime.active_window().id() != original_window_id
cls.window = sublime.active_window()
project_data = dict(folders=[dict(follow_symlinks=True, path=cls._temp_dir)])
cls.window.set_project_data(project_data)
def condition():
for d in cls.window.folders():
# on Windows, `cls._temp_dir` is lowered cased,
# `os.path.normcase` is needed for comparison.
if cls._temp_dir == os.path.normcase(d):
return True
yield condition
示例2: run
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import run_command [as 别名]
def run(self, package=None, **kwargs):
if not package:
self.prompt_package(lambda x: self.run(x, **kwargs))
return
package, pattern = self.input_parser(package)
if sys.version_info >= (3, 8) and self.package_python_version(package) == "3.3":
print("run unit_testing in python 3.3")
kwargs["package"] = package
sublime.set_timeout(lambda: sublime.run_command(self.fallback33, kwargs))
return
if pattern is not None:
# kwargs have the highest precedence when evaluating the settings,
# so we sure don't want to pass `None` down
kwargs['pattern'] = pattern
settings = self.load_unittesting_settings(package, kwargs)
stream = self.load_stream(package, settings)
if settings["async"]:
threading.Thread(target=lambda: self.unit_testing(stream, package, settings)).start()
else:
self.unit_testing(stream, package, settings)
示例3: plugin_loaded
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import run_command [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")
示例4: run
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import run_command [as 别名]
def run(self, edit, new_window=False):
# Collect all found filenames
positions = self.view.find_by_selector("entity.name.filename.find-in-files")
if len(positions) > 0:
# Set up the window to open the files in
if new_window:
sublime.run_command("new_window")
window = sublime.active_window()
else:
window = self.view.window()
# Open each file in the new window
for position in positions:
window.run_command('open_file', {'file': self.view.substr (position)})
else:
self.view.window().status_message("No find results")
示例5: test_project
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import run_command [as 别名]
def test_project(self):
start_time = time.time()
while not plugin_ready():
if time.time() - start_time <= timeout:
yield 200
else:
raise TimeoutError("plugin is not ready in " + str(timeout) + " seconds")
self.window.run_command("javascript_enhancements_create_new_project")
yield 1000
self.window.run_command("insert", {"characters": "empty"})
yield 1000
self.window.run_command("keypress", {"key": "enter"})
yield 1000
self.window.run_command("insert", {"characters": "javascript_enhancements_project_test"})
yield 1000
self.window.run_command("keypress", {"key": "enter"})
self.window.run_command("keypress", {"key": "enter"})
yield 1000
self.assertDictEqual(project_settings, util.get_project_settings())
示例6: open_image_window
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import run_command [as 别名]
def open_image_window(self):
image_filepath = get_image_filepath(self.st_settings, self.window.active_view())
if os.path.isfile(image_filepath):
sublime.run_command("new_window")
image_window = sublime.active_window()
image_window.open_file(image_filepath)
image_window.set_menu_visible(False)
image_window.set_tabs_visible(False)
image_window.set_minimap_visible(False)
image_window.set_status_bar_visible(False)
else:
sublime.message_dialog("Image has not been rendered!")
示例7: tearDownClass
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import run_command [as 别名]
def tearDownClass(cls):
# need at least one window in order to keep sublime running
if len(sublime.windows()) > 1:
cls.window.run_command('close_window')
def remove_temp_dir():
try:
shutil.rmtree(cls._temp_dir)
except Exception:
print("Cannot remove {}".format(cls._temp_dir))
sublime.set_timeout(remove_temp_dir, 1000)
示例8: run
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import run_command [as 别名]
def run(self):
if self.syntax_test:
sublime.run_command("unit_testing_syntax", {
"package": self.package,
"output": self.output
})
elif self.syntax_compatibility:
sublime.run_command("unit_testing_syntax_compatibility", {
"package": self.package,
"output": self.output
})
elif self.color_scheme_test:
sublime.run_command("unit_testing_color_scheme", {
"package": self.package,
"output": self.output
})
elif self.coverage:
sublime.run_command("unit_testing_coverage", {
"package": self.package,
"output": self.output
})
else:
sublime.run_command("unit_testing", {
"package": self.package,
"output": self.output
})
示例9: try_running_scheduler
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import run_command [as 别名]
def try_running_scheduler():
while not UnitTestingRunSchedulerCommand.ready:
sublime.set_timeout(
lambda: sublime.run_command("unit_testing_run_scheduler"), 1)
time.sleep(1)
示例10: responseAutoComplete
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import run_command [as 别名]
def responseAutoComplete(self, view, res):
self.lastResponse = res
view.run_command("auto_complete",
{
"disable_auto_insert": True,
"api_completions_only": False,
"next_completion_if_showing": False,
"auto_complete_commit_on_tab": True,
})
示例11: save_current_view
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import run_command [as 别名]
def save_current_view():
window = sublime.active_window()
if window:
view = window.active_view()
if (view and view.is_dirty()):
view.run_command("save")
示例12: run
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import run_command [as 别名]
def run(self, edit, type = "Local"):
sublime.run_command("fuse_preview", {"type": type, "paths": [self.view.file_name()]});
示例13: run
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import run_command [as 别名]
def run(self, edit, event):
base_path, input_path = self.get_path(event)
abspath = computer_friendly(os.path.join(base_path, input_path))
sublime.run_command(
"fm_creater", {"abspath": abspath, "input_path": input_path}
)
示例14: refresh_sidebar
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import run_command [as 别名]
def refresh_sidebar(settings=None, window=None):
if window is None:
window = active_window()
if settings is None:
settings = window.active_view().settings()
if settings.get("explicitly_refresh_sidebar") is True:
window.run_command("refresh_folder_list")
示例15: close_view
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import run_command [as 别名]
def close_view(view_to_close, dont_prompt_save=False):
if dont_prompt_save:
view_to_close.set_scratch(True)
if isST3():
view_to_close.close()
return
window = view_to_close.window()
window.focus_view(view_to_close)
window.run_command("close")