• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python sublime.set_timeout函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: monitorDownloadThread

def monitorDownloadThread(downloadThread):
    if downloadThread.is_alive():
        msg = downloadThread.getCurrentMessage()
        sublime.status_message(msg)
        sublime.set_timeout(lambda: monitorDownloadThread(downloadThread), CHECK_DOWNLOAD_THREAD_TIME_MS)
    else:
        downloadThread.showResultToPresenter()
开发者ID:Mondego,项目名称:pyreco,代码行数:7,代码来源:allPythonContent.py


示例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)
开发者ID:Mikerobenics,项目名称:sublime-github,代码行数:26,代码来源:sublime_github.py


示例3: on_complete

	def on_complete(self, *args, **kwargs):
		self.state = 'complete'

		if kwargs['progress'].is_background:
			return

		sublime.set_timeout(lambda: sublime.status_message('PyV8 binary successfully loaded'), 0)
开发者ID:ivoianchev,项目名称:Emmet,代码行数:7,代码来源:emmet-plugin.py


示例4: __init__

 def __init__(self, threads, message, success_message):
     self.threads = threads
     self.message = message
     self.success_message = success_message
     self.addend = 1
     self.size = 15
     sublime.set_timeout(lambda: self.run(0), 100)
开发者ID:ViciaWang,项目名称:SublimeApex,代码行数:7,代码来源:progress.py


示例5: defered_update

    def defered_update(self, view):
        if not view.window():  # If view is not visible window() will be None.
            return

        if view.id() not in self.seen_views:
            self.seen_views.append(view.id())

        if view_is_widget(view):
            return

        if not self.is_enabled(view):
            return

        if view_is_too_big(view, self.max_size_setting,
                           self.default_max_file_size):
            self.view_is_too_big_callback(view)
            return

        def func():
            self.update(view)

        if self.delay:
            sublime.set_timeout(func, self.delay)
        else:
            func()
开发者ID:Lothiraldan,项目名称:sublime_unicode_nbsp_3,代码行数:25,代码来源:sublime_unicode_nbsp.py


示例6: handle_threads

    def handle_threads(self, edit, threads, selections, offset = 0, i = 0, dir = 1):

        next_threads = []
        for thread in threads:
            if thread.is_alive():
                next_threads.append(thread)
                continue
            if thread.result == False:
                continue
            self.handle_result(edit, thread, selections, offset)
        threads = next_threads

        if len(threads):
            before = i % 8
            after = (7) - before

            dir = -1 if not after else dir
            dir = 1 if not before else dir

            i += dir

            self.view.set_status('minify', '[%s=%s]' % (' ' * before, ' ' * after))

            sublime.set_timeout(lambda: self.handle_threads(edit, threads, selections, offset, i, dir), 100)
            return

        self.view.erase_status('minify')
        sublime.status_message('Successfully minified')
开发者ID:Mirovinger,项目名称:Sublime-Minifier,代码行数:28,代码来源:Minify.py


示例7: on_done

    def on_done(self, text=""):
        """
        Create a class with informations from the input text

        @param text: text from input panel
        """
        self.hide_status()
        info = self.parse_create(text)
        if isinstance(info, str):
            sublime.error_message(info)
            return
        ActionHistory().add_action(
            "javatar.commands.create.create_class.on_done",
            "Create [info={info}]".format_map({
                "info": info
            })
        )
        if JavaUtils().create_package_path(
                info["directory"], True) == JavaUtils().CREATE_ERROR:
            return

        if self.create_class_file(info):
            sublime.set_timeout(lambda: StatusManager().show_status(
                "{class_type} \"{class_name}\" is created within".format_map({
                    "class_type": self.args["create_type"],
                    "class_name": info["class_name"]
                }) + " package \"{readable_package_path}\"".format_map({
                    "readable_package_path": JavaUtils().to_readable_class_path(
                        info["package"].as_class_path(),
                        as_class_path=True
                    )
                })
            ), 500)
开发者ID:Pugio,项目名称:Javatar,代码行数:33,代码来源:create_class.py


示例8: lint_view

	def lint_view(cls, view_id, filename, code, sections, callback):
		if view_id in cls.linters:
			selectors = Linter.get_selectors(view_id)

			linters = tuple(cls.linters[view_id])
			for linter in linters:
				if not linter.selector:
					linter.filename = filename
					linter.pre_lint(code)

			for sel, linter in selectors:
				if sel in sections:
					highlight = Highlight(code, scope=linter.scope, outline=linter.outline)
					errors = {}

					for line_offset, left, right in sections[sel]:
						highlight.shift(line_offset, left)
						linter.pre_lint(code[left:right], highlight=highlight)

						for line, error in linter.errors.items():
							errors[line+line_offset] = error

					linter.errors = errors

			# merge our result back to the main thread
			sublime.set_timeout(lambda: callback(linters[0].view, linters), 0)
开发者ID:bronson,项目名称:SublimeLint,代码行数:26,代码来源:linter.py


示例9: read_handle

 def read_handle(self, handle):
     chunk_size = 2 ** 13
     out = b''
     while True:
         try:
             data = os.read(handle.fileno(), chunk_size)
             # If exactly the requested number of bytes was
             # read, there may be more data, and the current
             # data may contain part of a multibyte char
             out += data
             if len(data) == chunk_size:
                 continue
             if data == b'' and out == b'':
                 raise IOError('EOF')
             # We pass out to a function to ensure the
             # timeout gets the value of out right now,
             # rather than a future (mutated) version
             self.queue_write(out.decode(self.encoding))
             if data == b'':
                 raise IOError('EOF')
             out = b''
         except (UnicodeDecodeError) as e:
             msg = 'Error decoding output using %s - %s'
             self.queue_write(msg  % (self.encoding, str(e)))
             break
         except (IOError):
             if self.killed:
                 msg = 'Cancelled'
             else:
                 msg = 'Finished'
             sublime.set_timeout(self.finished, 1)
             self.queue_write('\n[%s]' % msg)
             break
开发者ID:gabsoftware,项目名称:progress-abl-4gl-sublime-text,代码行数:33,代码来源:abl.py


示例10: output

    def output(self, stdout, stderr, q):
        errs = []

        for line in iter(stdout.readline, b''):
            if len(errs) == 0 and ('error' not in line.lower().decode('utf-8')):
                q.put(line)
                print(line.decode('utf-8'))
            else:
                errs.append(line)

            # print(str(line))

        for line in iter(stderr.readline, b''):
            errs.append(line)

        if len(errs) != 0:
            message = ''
            sublime.set_timeout(lambda: self.show_status('Error'), 0)
            for line in errs:
                message += line.decode('utf-8')

            sublime.error_message(message)
        else:
            sublime.set_timeout(lambda: self.show_status('Success'), 0)

        stderr.close()
        stdout.close()
开发者ID:enagic,项目名称:sublime-sass-compiler,代码行数:27,代码来源:SassCompiler.py


示例11: run

 def run(self, edit):
     for region in self.view.sel():
         self.view.insert(edit, region.end(), ".")
     caret = self.view.sel()[0].begin()
     line = self.view.substr(sublime.Region(self.view.word(caret-1).a, caret))
     if member_regex.search(line) != None:
         sublime.set_timeout(self.delayed_complete, 1)
开发者ID:nlloyd,项目名称:SublimeCompletionCommon,代码行数:7,代码来源:completioncommon.py


示例12: run

    def run(self, paths=[]):
        self.paths = paths

        if (sys.version_info > (3, 0)):
            q = Queue()
        else:
            q = Queue.Queue()

        for path in self.paths:
            proc = subprocess.Popen(
                self.build_cmd(path),
                bufsize=bufsize,
                cwd=os.path.dirname(path),
                shell=True,
                stdout=subprocess.PIPE,
                stderr=subprocess.PIPE,
                close_fds=ON_POSIX)

            thread = Thread(
                target=self.output,
                args=(proc.stdout, proc.stderr, q))
            thread.daemon = True
            thread.start()

        self.thread = thread
        self.message = 'Compiling'
        self.addend = 1
        self.size = 8
        sublime.set_timeout(lambda: self.show_progress(0), 100)
开发者ID:enagic,项目名称:sublime-sass-compiler,代码行数:29,代码来源:SassCompiler.py


示例13: set_status

    def set_status(self):
        global server, client

        if server or client:
            if server:
                server_status = "running"
            else:
                server_status = "off"

            if client:
                host = client.socket.host
                state = client.state
                client_status = "client:%(host)s...%(state)s" % locals()
            else:
                client_status = "disconnected"

            status_value = "Collab (server:%(server_status)s; %(client_status)s)" % locals()
        else:
            status_value = ""

        def _set_status():
            for window in sublime.windows():
                for view in window.views():
                    view.set_status("collab_server_status", status_value)

        sublime.set_timeout(_set_status, 0)
开发者ID:zookatron,项目名称:sublime-collaboration,代码行数:26,代码来源:collaboration.py


示例14: on_load

 def on_load(self, view):
     DbgPrint("ReadOnly Protect: on_load of view %d" %(view.id()))
     global config
     UpdateViewModeStatus(view, config.protect_mode, isFileReadonly(view))
     if(config.protect_mode == 1):
         sublime.set_timeout(lambda: start_polling(), 1000)
     DumpAll()
开发者ID:ivellioscolin,项目名称:sublime-plugin-readonlyprotect,代码行数:7,代码来源:readonly_protect.py


示例15: when_file_opened

def when_file_opened(window, file_path, view_settings, callback, result_queue):
    """
    Periodic polling callback used by open_file() to find the newly-opened file

    :param window:
        The sublime.Window to look for the view in

    :param file_path:
        The file path of the file that was opened

    :param view_settings:
        A dict of settings to set to the view's "golang" setting key

    :param callback:
        The callback to execute when the file is opened

    :param result_queue:
        A Queue() object the callback can use to communicate with the test
    """

    view = window.active_view()
    if view and view.file_name() == file_path:
        view.settings().set('golang', view_settings)
        callback(view, result_queue)
        return
    # If the view was not ready, retry a short while later
    sublime.set_timeout(lambda: when_file_opened(window, file_path, view_settings, callback, result_queue), 50)
开发者ID:codexns,项目名称:golang-build,代码行数:27,代码来源:tests.py


示例16: cb

	def cb(res, err):
		out = '\n'.join(s for s in (res.get('out'), res.get('err'), err) if s)
		def f():
			gs.end(tid)
			push_output(view, rkey, out, hourglass_repl='| done: %s' % res.get('dur', ''))

		sublime.set_timeout(f, 0)
开发者ID:OlingCat,项目名称:GoSublime,代码行数:7,代码来源:gs9o.py


示例17: on_select_action

    def on_select_action(self, selected_index):
        """Triggers on select from quick panel."""

        if selected_index == -1:
            return

        # Create new file
        elif selected_index == 0:
            # TODO: Set Syntax of the new file to be python
            view = self.view.window().new_file()

            # Append snippet to the view
            sublime.set_timeout(
                lambda: self._append_snippet(view, new=True), 10)

        # Select existing file
        else:
            # Subtract one to account for the "Create file" item
            directory_index = selected_index - 1

            current_root = self.view.window().folders()[0]

            # The paths are relative to the project root
            file_directory = os.path.join(
                current_root,
                self.step_file_paths[directory_index])
            view = self.view.window().open_file(file_directory)

            # Append snippet to the view
            sublime.set_timeout(lambda: self._append_snippet(view), 10)
开发者ID:mixxorz,项目名称:BehaveToolkit,代码行数:30,代码来源:generate_step_function.py


示例18: on_load

 def on_load(self, view):
     Pref.time = time()
     Pref.modified = True
     view.settings().set('function_name_status_row', -1)
     sublime.set_timeout(
         lambda: self.display_current_class_and_function(view,
             'on_load'), 0)
开发者ID:KeyserSosa,项目名称:SublimeFunctionNameDisplay,代码行数:7,代码来源:FunctionNameStatus.py


示例19: create_class_file

    def create_class_file(self, info):
        """
        Create a specified Java class and returns the status

        @param info: class informations
        """
        contents = self.get_file_contents(info)
        if contents is None:
            return False
        if os.path.exists(info["file"]):
            sublime.error_message(
                "{class_type} \"{class_name}\" already exists".format_map({
                    "class_type": self.args["create_type"],
                    "class_name": info["class_name"]
                })
            )
            return False
        open(info["file"], "w").close()
        view = sublime.active_window().open_file(info["file"])
        view.set_syntax_file("Packages/Java/Java.tmLanguage")
        # File Header override
        view.settings().set("enable_add_template_to_empty_file", False)
        sublime.set_timeout(
            lambda: self.insert_and_save(view, contents, info),
            100
        )
        return True
开发者ID:Pugio,项目名称:Javatar,代码行数:27,代码来源:create_class.py


示例20: handle_threads

  def handle_threads(self, edit, threads, offset=0, i=0, dir=1):
    next_threads = []
    for thread in threads:
      if thread.is_alive():
        next_threads.append(thread)
        continue
      if thread.result == False:
        continue
      offset = self.replace(edit, thread, offset)

    threads = next_threads

    if len(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('bitly', 'Bitly [%s=%s]' % (' ' * before, ' ' * after))

      sublime.set_timeout(lambda: self.handle_threads(edit, threads, offset, i, dir), 100)
      return

    self.view.end_edit(edit)

    self.view.erase_status('bitly')
    matches = len(self.urls)
    sublime.status_message('Bitly successfully run on %s selection%s' % (matches, '' if matches == 1 else 's'))
开发者ID:the0ther,项目名称:Sublime-Bitly,代码行数:31,代码来源:Bitly.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python sublime.set_timeout_async函数代码示例发布时间:2022-05-27
下一篇:
Python sublime.set_clipboard函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap