當前位置: 首頁>>代碼示例>>Python>>正文


Python sublime.run_command方法代碼示例

本文整理匯總了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 
開發者ID:SublimeText,項目名稱:UnitTesting,代碼行數:26,代碼來源:temp_directory_test_case.py

示例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) 
開發者ID:SublimeText,項目名稱:UnitTesting,代碼行數:27,代碼來源:package.py

示例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") 
開發者ID:fuse-open,項目名稱:Fuse.SublimePlugin,代碼行數:20,代碼來源:fuse.py

示例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") 
開發者ID:STealthy-and-haSTy,項目名稱:SublimeScraps,代碼行數:18,代碼來源:open_found_files.py

示例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()) 
開發者ID:pichillilorenzo,項目名稱:JavaScriptEnhancements,代碼行數:23,代碼來源:test_project.py

示例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!") 
開發者ID:hao-lee,項目名稱:Graphvizer,代碼行數:14,代碼來源:open_image.py

示例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) 
開發者ID:SublimeText,項目名稱:UnitTesting,代碼行數:14,代碼來源:temp_directory_test_case.py

示例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
            }) 
開發者ID:SublimeText,項目名稱:UnitTesting,代碼行數:28,代碼來源:scheduler.py

示例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) 
開發者ID:SublimeText,項目名稱:UnitTesting,代碼行數:8,代碼來源:scheduler.py

示例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,
        }) 
開發者ID:fuse-open,項目名稱:Fuse.SublimePlugin,代碼行數:11,代碼來源:fuse.py

示例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") 
開發者ID:fuse-open,項目名稱:Fuse.SublimePlugin,代碼行數:8,代碼來源:fuse.py

示例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()]}); 
開發者ID:fuse-open,項目名稱:Fuse.SublimePlugin,代碼行數:4,代碼來源:fuse.py

示例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}
        ) 
開發者ID:math2001,項目名稱:FileManager,代碼行數:8,代碼來源:create_from_selection.py

示例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") 
開發者ID:math2001,項目名稱:FileManager,代碼行數:9,代碼來源:sublimefunctions.py

示例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") 
開發者ID:math2001,項目名稱:FileManager,代碼行數:11,代碼來源:sublimefunctions.py


注:本文中的sublime.run_command方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。