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


Python sublime.windows方法代码示例

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


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

示例1: refresh

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import windows [as 别名]
def refresh(views, erase_settings=False):
    '''
    views
        list of integers which are view.id(), can be empty
    erase_settings
        boolean, can be True after change of global setting dired_autorefresh
    '''
    if not views and not erase_settings:
        def is_dired(view): return view.settings() and view.settings().get("dired_path")
    else:
        def is_dired(view): return False

    for w in sublime.windows():
        for v in w.views():
            if v.id() in views or is_dired(v):
                if erase_settings:
                    v.settings().erase('dired_autorefresh')
                v.run_command('dired_refresh') 
开发者ID:aziz,项目名称:SublimeFileBrowser,代码行数:20,代码来源:0_dired_fs_observer.py

示例2: is_hidden

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import windows [as 别名]
def is_hidden(self, filename, path, goto=''):
        if not (path or goto):  # special case for ThisPC
            return False
        tests = self.view.settings().get('dired_hidden_files_patterns', ['.*'])
        if isinstance(tests, str):
            tests = [tests]
        if any(fnmatch.fnmatch(filename, pattern) for pattern in tests):
            return True
        if sublime.platform() != 'windows':
            return False
        # check for attribute on windows:
        try:
            attrs = ctypes.windll.kernel32.GetFileAttributesW(join(path, goto, filename))
            assert attrs != -1
            result = bool(attrs & 2)
        except (AttributeError, AssertionError):
            result = False
        return result 
开发者ID:aziz,项目名称:SublimeFileBrowser,代码行数:20,代码来源:common.py

示例3: setUpClass

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import windows [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

示例4: tryHandle

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import windows [as 别名]
def tryHandle(self, request):
		if request.name != "FocusEditor":
			return False
		fileName = request.arguments["File"]
		line = request.arguments["Line"]
		column = request.arguments["Column"]
		if not os.path.isfile(fileName):
			self._returnFailure("File '{}' does not exist".format(fileName), request.id)
			return True
		window = self._tryGetWindowFor(request.arguments["Project"])
		if window:
			try:
				window.open_file( "{}:{}:{}".format(fileName, line, column), sublime.ENCODED_POSITION)
				if sublime.platform() == "osx":
					self._focusWindowOSX()
					self.msgManager.sendResponse(self.interop, request.id, "Success")
					return True
				elif sublime.platform() == "windows":
					self.msgManager.sendResponse(self.interop, request.id, "Success", {"FocusHwnd":window.hwnd()})
					return True
			except Exception as e:
				self._returnFailure(str(e), request.id)
				return True
		return False 
开发者ID:fuse-open,项目名称:Fuse.SublimePlugin,代码行数:26,代码来源:focus_editor.py

示例5: on_done

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import windows [as 别名]
def on_done(self, selected_index):
        current_index = self._get_current_index()
        if selected_index == -1 or current_index == selected_index:
            return

        folders = self._get_folders()
        window_index = folders[selected_index][1]
        window_to_move_to = sublime.windows()[window_index]

        self.focus(window_to_move_to)

        # OS X and Linux require specific workarounds to activate a window
        # due to this bug:
        # https://github.com/SublimeTextIssues/Core/issues/444
        if sublime.platform() == 'osx':
            self._osx_focus()
        elif sublime.platform() == 'linux':
            self._linux_focus(window_to_move_to) 
开发者ID:ccampbell,项目名称:sublime-goto-window,代码行数:20,代码来源:GotoWindow.py

示例6: is_hidden

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import windows [as 别名]
def is_hidden(self, filename, path, goto=''):
        if not (path or goto):  # special case for ThisPC
            return False
        tests = self.view.settings().get('outline_hidden_files_patterns', ['.*'])
        if isinstance(tests, str):
            tests = [tests]
        if any(fnmatch.fnmatch(filename, pattern) for pattern in tests):
            return True
        if sublime.platform() != 'windows':
            return False
        # check for attribute on windows:
        try:
            attrs = ctypes.windll.kernel32.GetFileAttributesW(join(path, goto, filename))
            assert attrs != -1
            result = bool(attrs & 2)
        except (AttributeError, AssertionError):
            result = False
        return result 
开发者ID:warmdev,项目名称:SublimeOutline,代码行数:20,代码来源:common.py

示例7: subl

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import windows [as 别名]
def subl(*args):
    executable_path = sublime.executable_path()
    if sublime.platform() == 'osx':
        app_path = executable_path[:executable_path.rfind('.app/') + 5]
        executable_path = app_path + 'Contents/SharedSupport/bin/subl'

    subprocess.Popen([executable_path] + list(args))

    def on_activated():
        window = sublime.active_window()
        view = window.active_view()

        if sublime.platform() == 'windows':
            # fix focus on windows
            window.run_command('focus_neighboring_group')
            window.focus_view(view)

        sublime_plugin.on_activated(view.id())
        sublime.set_timeout_async(lambda: sublime_plugin.on_activated_async(view.id()))

    sublime.set_timeout(on_activated, 300) 
开发者ID:randy3k,项目名称:ProjectManager,代码行数:23,代码来源:project_manager.py

示例8: setup_previews

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import windows [as 别名]
def setup_previews():
    """Setup previews."""

    global ch_preview_thread
    global ch_preview
    global unloading

    unloading = True
    if ch_preview_thread is not None:
        ch_preview_thread.kill()
    for w in sublime.windows():
        for v in w.views():
            v.settings().clear_on_change('color_helper.reload')
            v.settings().erase('color_helper.preview_meta')
            v.erase_phantoms('color_helper')
    unloading = False

    if ch_settings.get('inline_previews', False):
        ch_preview = ChPreview()
        ch_preview_thread = ChPreviewThread()
        ch_preview_thread.start() 
开发者ID:facelessuser,项目名称:ColorHelper,代码行数:23,代码来源:color_helper.py

示例9: plugin_unloaded

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import windows [as 别名]
def plugin_unloaded():
    """Kill threads."""

    global unloading
    unloading = True

    if ch_thread is not None:
        ch_thread.kill()
    if ch_file_thread is not None:
        ch_file_thread.kill()
    if ch_preview_thread is not None:
        ch_preview_thread.kill()

    # Clear view events
    ch_settings.clear_on_change('reload')
    for w in sublime.windows():
        for v in w.views():
            v.settings().clear_on_change('color_helper.reload')

    unloading = False 
开发者ID:facelessuser,项目名称:ColorHelper,代码行数:22,代码来源:color_helper.py

示例10: plugin_loaded

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import windows [as 别名]
def plugin_loaded() -> None:
    load_settings()
    popups.load_css()
    set_debug_logging(settings.log_debug)
    set_exception_logging(True)
    windows.set_diagnostics_ui(DiagnosticsPresenter)
    windows.set_server_panel_factory(ensure_server_panel)
    windows.set_settings_factory(settings)
    load_handlers()
    sublime.status_message("LSP initialized")
    window = sublime.active_window()
    if window:
        windows.lookup(window).start_active_views()
    if int(sublime.version()) > 4000:
        sublime.error_message(
            """The currently installed version of LSP package is not compatible with Sublime Text 4. """
            """Please remove and reinstall this package to receive a version compatible with ST4. """
            """Remember to restart Sublime Text after.""") 
开发者ID:sublimelsp,项目名称:LSP,代码行数:20,代码来源:main.py

示例11: plugin_unloaded

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import windows [as 别名]
def plugin_unloaded() -> None:
    # Also needs to handle package being disabled or removed
    # https://github.com/sublimelsp/LSP/issues/375
    unload_settings()
    # TODO: Move to __del__ methods
    for window in sublime.windows():
        unload_sessions(window)  # unloads view state from document sync and diagnostics
        destroy_output_panels(window)  # references and diagnostics panels
        for view in window.views():
            if view.file_name():
                remove_highlights(view)
                remove_color_boxes(view)
                for key in ['error', 'warning', 'info', 'hint', 'diagnostics']:
                    view.erase_regions('lsp_{}'.format(key))
                for key in ['diagnostics', 'clients']:
                    view.erase_status('lsp_{}'.format(key))
                for key in ['language', 'active', 'diagnostic_phantom']:
                    view.settings().erase('lsp_{}'.format(key)) 
开发者ID:sublimelsp,项目名称:LSP,代码行数:20,代码来源:main.py

示例12: disable_resources

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import windows [as 别名]
def disable_resources(self):
        """
        Disables all resources being provided by the system bootstrap package
        by saving the state of items that are using them and then reverting
        them to temporary defaults.
        """
        prefix = "Packages/{pkg}/".format(pkg=bootstrap_pkg)

        # TODO if the package also contains a custom color scheme, this should
        # also temporarily reset the color scheme back to defaults and then
        # restore them later.
        for window in sublime.windows():
            for view in window.views():
                s = view.settings()
                syntax = s.get("syntax")
                if syntax.startswith(prefix):
                    s.set("_mp_boot_syntax", syntax)
                    s.set("syntax", "Packages/Text/Plain text.tmLanguage") 
开发者ID:STealthy-and-haSTy,项目名称:SublimeScraps,代码行数:20,代码来源:bootstrapper.py

示例13: subl

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import windows [as 别名]
def subl(args):
  
  executable_path = sublime_executable_path()
  args = [executable_path] + args
  args_list = list()

  if sublime.platform() == 'windows' :
    for arg in args :
      args_list.append(json.dumps(arg, ensure_ascii=False))
  else :
    for arg in args :
      args_list.append(shlex.quote(arg))
  
  args = " ".join(args_list)

  return subprocess.Popen(args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 
开发者ID:pichillilorenzo,项目名称:JavaScriptEnhancements,代码行数:18,代码来源:util.py

示例14: is_project_open

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import windows [as 别名]
def is_project_open(project): 

  project_folder_to_find = os.path.dirname(project)

  windows = sublime.windows()

  for window in windows :

    project_file_name = sublime.active_window().project_file_name()

    if project_file_name :
      project_folder = os.path.dirname(project_file_name)

      return True if project_folder == project_folder_to_find else False

    else :
      # try to look at window.folders()
      folders = window.folders()   
      if len(folders) > 0:

        project_folder = folders[0]

        return True if project_folder == project_folder_to_find else False

  return False 
开发者ID:pichillilorenzo,项目名称:JavaScriptEnhancements,代码行数:27,代码来源:util.py

示例15: play

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import windows [as 别名]
def play(self, **kwargs):
        sound_path = os.path.join(self.dir, '{}.wav'.format(kwargs['command']))

        if sublime.platform() == "osx":
            if os.path.isfile(sound_path):
                call(["afplay", "-v", str(1), sound_path])

        if sublime.platform() == "windows":
            if os.path.isfile(sound_path):
                winsound.PlaySound(sound_path, winsound.SND_FILENAME | winsound.SND_ASYNC | winsound.SND_NODEFAULT)

        if sublime.platform() == "linux":
            if os.path.isfile(sound_path):
                call(["aplay", sound_path]) 
开发者ID:nojanath,项目名称:SublimeKSP,代码行数:16,代码来源:ksp_plugin.py


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