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


Python RendererManager.RendererManager类代码示例

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


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

示例1: plugin_loaded

def plugin_loaded():
    Server.init()
    # Setting must be the first to initialize.
    Setting.instance().init()
    PluginManager.instance().subscribe_setting_events()
    RendererManager.start()
    PluginManager.instance().restart_server()
开发者ID:hsp86,项目名称:sublime_text3_configure,代码行数:7,代码来源:OmniMarkupPreviewer.py

示例2: run

    def run(self, edit, immediate=True):
        # Whether RendererManager is finished loading?
        if not RendererManager.ensure_started():
            sublime.status_message('OmniMarkupPreviewer have not yet started')
            return

        buffer_id = self.view.buffer_id()
        # Opened in a tab already?
        opened = False
        for view in self.view.window().views():
            if view.buffer_id() == buffer_id:
                opened = True
                break
        if not opened:
            RendererManager.enqueue_view(self.view, immediate=True)

        host = Setting.instance().server_host
        port = Setting.instance().server_port
        if host == '0.0.0.0':
            host = '127.0.0.1'
        url = 'http://%s:%d/view/%d' % (host, port, buffer_id)
        # Open with the default browser
        log.info('Launching web browser for %s', url)
        launching_web_browser_for_url(
            url,
            success_msg_default='Preview launched in default web browser',
            success_msg_user='Preview launched in user defined web browser')
开发者ID:hsp86,项目名称:sublime_text3_configure,代码行数:27,代码来源:OmniMarkupPreviewer.py

示例3: put

    def put(self, view, preemptive=True, timeout=0.5):
        if not RendererManager.any_available_renderer_for_view(view):
            return

        view_id = view.id()
        now = time.time()

        with self.mutex:
            if view_id in self.view_entry_mapping:
                # Too fast, cancel this operation
                if now - self.last_signaled <= 0.01:
                    return

        if preemptive:
            # Cancel pending actions
            with self.cond:
                if view_id in self.view_entry_mapping:
                    del self.view_entry_mapping[view_id]
                    self.cond.notify()
            RendererManager.enqueue_view(view, only_exists=True)
            self.last_signaled = now
        else:
            with self.cond:
                filename = view.file_name()
                if view_id not in self.view_entry_mapping:
                    self.view_entry_mapping[view_id] = self.Entry(view, timeout)
                else:
                    entry = self.view_entry_mapping[view_id]
                    entry.view = view
                    entry.filename = filename
                    entry.timeout = timeout
                self.cond.notify()
开发者ID:hsp86,项目名称:sublime_text3_configure,代码行数:32,代码来源:OmniMarkupPreviewer.py

示例4: queue

    def queue(self, view, preemptive=True, timeout=0.5):
        if not RendererManager.has_renderer_enabled_in_view(view):
            return

        view_id = view.id()
        now = time.time()

        with self.mutex:
            if view_id in self.delayed_views:
                if now - self.last_signaled <= 0.01:  # Too fast, cancel this operation
                    return

        if preemptive:
            # Cancel pending actions
            with self.cond:
                if view_id in self.delayed_views:
                    del self.delayed_views[view_id]
                    self.cond.notify()
            RendererManager.queue_view(view, only_exists=True)
            self.last_signaled = now
        else:
            with self.cond:
                filename = view.file_name()
                if view_id not in self.delayed_views:
                    self.delayed_views[view_id] = self.Entry(view, filename, timeout)
                else:
                    entry = self.delayed_views[view_id]
                    entry.view = view
                    entry.filename = filename
                    entry.timeout = timeout
                self.cond.notify()
开发者ID:beuth,项目名称:Sublime-Packages,代码行数:31,代码来源:OmniMarkupPreviewer.py

示例5: render_text_by_buffer_id

def render_text_by_buffer_id(buffer_id):
    valid_view = None
    for window in sublime.windows():
        if valid_view is not None:
            break
        for view in window.views():
            if view.buffer_id() == buffer_id:
                valid_view = view
                break
    if valid_view is None:
        return None
    RendererManager.queue_view(valid_view, immediate=True)
    return RenderedMarkupCache.instance().get_entry(buffer_id)
开发者ID:n1k0,项目名称:OmniMarkupPreviewer,代码行数:13,代码来源:Server.py

示例6: queue_to_renderer_manager

    def queue_to_renderer_manager(self, view, filename):
        view_id = view.id()
        valid_view = False
        for window in sublime.windows():
            if valid_view:
                break
            for v in window.views():
                if v.id() == view_id:  # Got view
                    valid_view = True
                    break

        if not valid_view or view.is_loading() or view.file_name() != filename:
            return
        if RendererManager.has_renderer_enabled_in_view(view):
            RendererManager.queue_view(view, only_exists=True)
            self.last_signaled = time.time()
开发者ID:beuth,项目名称:Sublime-Packages,代码行数:16,代码来源:OmniMarkupPreviewer.py

示例7: run

    def run(self, edit, immediate=True):
        buffer_id = self.view.buffer_id()
        # Is opened in a tab?
        opened = False
        for view in self.view.window().views():
            if view.buffer_id == buffer_id:
                opened = True
                break
        if not opened:
            RendererManager.queue_view(self.view, immediate=True)

        url = 'http://localhost:%d/view/%d' % (Setting.instance().server_port, buffer_id)
        # Open with the default browser
        log.info('Launching web browser for %s', url)
        launching_web_browser_for_url(
            url,
            success_msg_default='Preview launched in default web browser',
            success_msg_user='Preview launched in user defined web browser'
        )
开发者ID:beuth,项目名称:Sublime-Packages,代码行数:19,代码来源:OmniMarkupPreviewer.py

示例8: unload_handler

def unload_handler():
    log.info('Unloading plugin...')
    # Cleaning up resources...
    PluginManager.instance().stop_server()
    # Stopping renderer worker
    RendererManager.stop()
开发者ID:hsp86,项目名称:sublime_text3_configure,代码行数:6,代码来源:OmniMarkupPreviewer.py

示例9: on_query_context

 def on_query_context(self, view, key, operator, operand, match_all):
     # `omp_is_enabled` for backwards compatibility
     if key == 'omnimarkup_is_enabled' or key == 'omp_is_enabled':
         return RendererManager.any_available_renderer_for_view(view)
     return None
开发者ID:hsp86,项目名称:sublime_text3_configure,代码行数:5,代码来源:OmniMarkupPreviewer.py

示例10: enqueue_view_to_renderer_manager

 def enqueue_view_to_renderer_manager(self, view, filename):
     if view.is_loading() or view.file_name() != filename:
         return
     if RendererManager.any_available_renderer_for_view(view):
         RendererManager.enqueue_view(view, only_exists=True)
         self.last_signaled = time.time()
开发者ID:hsp86,项目名称:sublime_text3_configure,代码行数:6,代码来源:OmniMarkupPreviewer.py

示例11: is_visible

 def is_visible(self):
     return RendererManager.any_available_renderer_for_view(self.view)
开发者ID:hsp86,项目名称:sublime_text3_configure,代码行数:2,代码来源:OmniMarkupPreviewer.py

示例12: on_query_context

 def on_query_context(self, view, key, operator, operand, match_all):
     # omp_is_enabled is here for backwards compatibility
     if key == 'omnimarkup_is_enabled' or key == 'omp_is_enabled':
         return RendererManager.has_renderer_enabled_in_view(view)
     return None
开发者ID:beuth,项目名称:Sublime-Packages,代码行数:5,代码来源:OmniMarkupPreviewer.py

示例13: is_enabled

 def is_enabled(self):
     return RendererManager.has_renderer_enabled_in_view(self.view)
开发者ID:beuth,项目名称:Sublime-Packages,代码行数:2,代码来源:OmniMarkupPreviewer.py

示例14: Server

        g_server = Server(host=setting.server_host, port=setting.server_port)

    def stop_server(self):
        global g_server
        if g_server is not None:
            g_server.stop()
            g_server = None

    def try_download_mathjax(self, setting=None):
        if setting is None:
            setting = Setting.instance()
        if setting.mathjax_enabled:
            OnDemandDownloader.on_demand_download_mathjax()


def unload_handler():
    log.info('Unloading plugin...')
    # Cleaning up resources...
    PluginManager.instance().stop_server()
    # Stopping renderer worker
    RendererManager.WORKER.stop()


# Setting must be the first to initialize.
Setting.instance().init()
PluginManager.instance().subscribe_setting_events()
RendererManager.init()
RendererManager.WORKER.start()
PluginManager.instance().restart_server()
PluginManager.instance().try_download_mathjax()
开发者ID:beuth,项目名称:Sublime-Packages,代码行数:30,代码来源:OmniMarkupPreviewer.py


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