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


Python sublime.set_timeout方法代码示例

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


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

示例1: on_new

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_timeout [as 别名]
def on_new(self, view):
        if not self.MOVE:
            return
        w = sublime.active_window()
        if w.num_groups() < 2:
            return
        if is_any_dired_in_group(w, 0):
            if w.active_group() == 0:
                # at this point views are exist, so we cannot avoid the use of
                # set_view_index, but ST2 return None if group has no views
                # ST3 return None if group has active image’s view
                avig1 = w.active_view_in_group(1)
                if avig1:
                    _group, active_view_index_in_other_group = w.get_view_index(avig1)
                    index = active_view_index_in_other_group + 1
                else:
                    index = 0
                sublime.set_timeout(lambda: w.set_view_index(view, 1, index), 1) 
开发者ID:aziz,项目名称:SublimeFileBrowser,代码行数:20,代码来源:dired_misc.py

示例2: progress_bar

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_timeout [as 别名]
def progress_bar(self, threads, i=0, dir=1):
        threads = [t for t in threads if t.is_alive()]
        if threads:
            # This animates a little activity indicator in the status area
            before = i % 8
            after = (7) - before
            if not after:  dir = -1
            if not before: dir = 1
            i += dir
            self.view.set_status('__FileBrowser__', u'Please wait%s…%sWriting %s' %
                                 (' ' * before, ' ' * after, u', '.join([t.name if ST3 else t.name.decode('utf8') for t in threads])))
            sublime.set_timeout(lambda: self.progress_bar(threads, i, dir), 100)
            return
        else:
            emit_event(u'watch_view', self.view.id(), plugin=u'FileBrowserWFS')
            self.view.run_command('dired_clear_copy_cut_list') 
开发者ID:aziz,项目名称:SublimeFileBrowser,代码行数:18,代码来源:dired_file_operations.py

示例3: run

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_timeout [as 别名]
def run(self, edit):
        pt = self.view.sel()[0].a
        row, col = self.view.rowcol(pt)
        points = [[n, t] for n, t in jump_points()]
        current_project = [points[row - 3][1]]
        settings = load_settings('dired.sublime-settings')
        smart_jump = settings.get('dired_smart_jump', False)
        if smart_jump and len(self.view.window().views()) == 1:
            show(self.view.window(), current_project[0])
        else:
            self.view.run_command("dired_open_in_new_window", {"project_folder": current_project})

        def close_view(view):
            if ST3:
                view.close()
            else:
                view.window().run_command("close_file")

        sublime.set_timeout(close_view(self.view), 100) 
开发者ID:aziz,项目名称:SublimeFileBrowser,代码行数:21,代码来源:jumping.py

示例4: open_category_panel

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_timeout [as 别名]
def open_category_panel(self, thread, sel_category, timeout=200):
        if thread.is_alive():
            self.sublconsole.showlog("loading metadata , please wait...")
            timeout=200
            sublime.set_timeout(lambda: self.open_category_panel(thread, sel_category, timeout), timeout)
            return
        self.sublconsole.showlog("load metadata ok!")

        try:
            self.sel_category_list = self.metadata_cache.get_meta_category()
            if sel_category and sel_category in self.sel_category_list:
                self.open_detail_panel(sel_category)
            else:
                self.window.show_quick_panel(self.sel_category_list, self.panel_done, sublime.MONOSPACE_FONT)
        except Exception as e:
            self.sublconsole.showlog(e)
            return 
开发者ID:exiahuang,项目名称:SalesforceXyTools,代码行数:19,代码来源:main_metadata.py

示例5: run

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_timeout [as 别名]
def run(self, i):
        if self.stopped:
            return

        before = i % self.size
        after = (self.size - 1) - before

        sublime.status_message('%s [%s=%s]' % (self.message, ' ' * before, ' ' * after))

        if not after:
            self.addend = -1
        if not before:
            self.addend = 1
        i += self.addend

        sublime.set_timeout(lambda: self.run(i), 100) 
开发者ID:nicosantangelo,项目名称:sublime-gulp,代码行数:18,代码来源:progress_notifier.py

示例6: print_on_complete

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_timeout [as 别名]
def print_on_complete(self, thread, user_command):
        if thread.is_alive():
            sublime.set_timeout(lambda: self.print_on_complete(thread, user_command), 20)
            return
        else:
            # command was successful
            if self.exitcode == 0:
                # clean the standard output string
                clean_stdout = self.clean_output(self.stdout)
                self.view.run_command('glue_writer', {'text': clean_stdout, 'command': user_command})
            # command was not successful (non-zero exit status)
            else:
                self.view.run_command('glue_writer', {'text': self.stderr, 'command': user_command})

            # print to stdout as well - removed
            # self.print_response()

    #------------------------------------------------------------------------------
    # [ clean_output method ] - remove special characters that should not be printed to standard output view
    #------------------------------------------------------------------------------ 
开发者ID:chrissimpkins,项目名称:glue,代码行数:22,代码来源:Glue.py

示例7: progress_indicator

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_timeout [as 别名]
def progress_indicator(self, thread, i=0, direction=1):
        if thread.is_alive():
            before = i % 8
            after = (7) - before
            if not after:
                direction = -1
            if not before:
                direction = 1
            i += direction
            self.view.set_status('glue_status_indicator', 'Glue: Running command [%s|%s]' % (' ' * before, ' ' * after))
            sublime.set_timeout(lambda: self.progress_indicator(thread, i, direction), 75)
            return
        else:
            self.view.erase_status('glue_status_indicator')
            sublime.status_message('Glue: Command completed.')

    #------------------------------------------------------------------------------
    # [ execute_command method ] - execute a system command
    #   run in a separate thread from muterun() method above
    #   assigns stdout stderr and exitcode in instance attributes
    #------------------------------------------------------------------------------ 
开发者ID:chrissimpkins,项目名称:glue,代码行数:23,代码来源:Glue.py

示例8: run

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

示例9: run_in_worker

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_timeout [as 别名]
def run_in_worker(fn, *args, **kwargs):
    sublime.set_timeout_async(partial(fn, *args, **kwargs))


# When we swap `set_timeout_async` with `set_timeout` we basically run
# our program single-threaded.
# This has some benefits:
# - We avoid async/timing issues
# - We can use plain `yield` to run Sublime's task queue empty, see below
# - Every code we run will get correct coverage
#
# However note, that Sublime will just put all async events on the queue,
# avoiding the API. We cannot patch that. That means, the event handlers
# will *not* run using plain `yield` like below, you still have to await
# them using `yield AWAIT_WORKER`.
# 
开发者ID:SublimeText,项目名称:UnitTesting,代码行数:18,代码来源:test_deferred_timing.py

示例10: run

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_timeout [as 别名]
def run(self, i):
        if not self.thread.is_alive():
            msg = '' if not self.success_message else 'Sync Settings: {}'.format(self.success_message)
            sublime.status_message(msg)
            return
        before = i % self.size
        after = (self.size - 1) - before

        sublime.status_message('Sync Settings: {} [{}={}]'.format(self.message, ' ' * before, ' ' * after))

        if not after:
            self.addend = -1
        if not before:
            self.addend = 1

        i += self.addend
        sublime.set_timeout(lambda: self.run(i), 100) 
开发者ID:mfuentesg,项目名称:SyncSettings,代码行数:19,代码来源:thread_progress.py

示例11: create_codemap_group

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_timeout [as 别名]
def create_codemap_group():
    """Adds a column on the right, and scales down the layout."""
    w = win()
    layout = win().get_layout()
    cols = layout['cols']
    cells = layout['cells']
    last_col = len(cols) - 1
    last_row = len(layout['rows']) - 1
    width = 1 - settings().get("codemap_width")

    for i, col in enumerate(cols):
        if col > 0:
            cols[i] = col*width

    cols.append(1)
    newcell = [last_col, 0, last_col + 1, last_row]
    cells.append(newcell)
    groups = w.num_groups()
    w.run_command("set_layout", layout)
    sublime.set_timeout(lambda: Mapper.block_max_pane(False), 10)
    return (groups + 1)

# ----------------- 
开发者ID:oleg-shilo,项目名称:sublime-codemap,代码行数:25,代码来源:code_map.py

示例12: reset_layout

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_timeout [as 别名]
def reset_layout():
    """Removes the Code Map group, and scales up the layout."""
    w = win()
    layout = w.get_layout()
    cols = layout['cols']
    width = 1 - settings().get("codemap_width")

    alone_in_group = len(win().views_in_group(CodeMapListener.map_group)) == 0

    if alone_in_group:
        for i, col in enumerate(cols):
            if col > 0:
                cols[i] = col/width

        cols[-2] = 1.0
        del cols[-1]
        del layout['cells'][-1]

    Mapper.block_max_pane(True)
    w.run_command("set_layout", layout)
    sublime.set_timeout(lambda: Mapper.block_max_pane(False), 10)

# ----------------- 
开发者ID:oleg-shilo,项目名称:sublime-codemap,代码行数:25,代码来源:code_map.py

示例13: _run

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_timeout [as 别名]
def _run(self, thread, count=0):
        """Evaluate environment in a separate thread and show an activity
        indicator. Inspect thread at regular intervals until it's finished, at
        which point `make_requests` can be invoked. Return if thread times out.
        """
        REFRESH_MULTIPLIER = 2
        activity = self.get_activity_indicator(count//REFRESH_MULTIPLIER, self.ACTIVITY_SPACES)
        if count > 0:  # don't distract user with RequesterEnv status if env can be evaluated quickly
            self.view.set_status('requester.activity', '{} {}'.format('RequesterEnv', activity))

        if thread.is_alive():
            timeout = self.config.get('timeout_env', None)
            if timeout is not None and count * self.REFRESH_MS/REFRESH_MULTIPLIER > timeout * 1000:
                sublime.error_message('Timeout Error: environment took too long to parse')
                self.view.set_status('requester.activity', '')
                return
            sublime.set_timeout(lambda: self._run(thread, count+1), self.REFRESH_MS/REFRESH_MULTIPLIER)

        else:
            requests = self.get_requests()
            self.view.set_status('requester.activity', '')
            self.make_requests(requests, self._env) 
开发者ID:kylebebak,项目名称:Requester,代码行数:24,代码来源:__init__.py

示例14: run

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_timeout [as 别名]
def run(self, selector="", kill=False, **kwargs):
        if kill:
            if ride_settings.get("terminus_exec", False):
                self.window.run_command("terminus_cancel_build")
            else:
                self.window.run_command("exec", {"kill": True})
            return

        if "cmd" in kwargs and kwargs["cmd"]:
            self.window.run_command("ride_exec_core", kwargs)
        elif "cmd" not in kwargs:
            # as a workaround of
            # https://github.com/SublimeTextIssues/Core/issues/3010
            # we pass an empty `text`
            sublime.set_timeout(lambda: self.window.run_command(
                    "show_overlay", {
                        "overlay": "command_palette",
                        "command": "ride_exec_core",
                        "text": ""
                    }), 10) 
开发者ID:REditorSupport,项目名称:sublime-ide-r,代码行数:22,代码来源:exec.py

示例15: subl

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


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