本文整理汇总了Python中OmniMarkupLib.RendererManager.RendererManager.ensure_started方法的典型用法代码示例。如果您正苦于以下问题:Python RendererManager.ensure_started方法的具体用法?Python RendererManager.ensure_started怎么用?Python RendererManager.ensure_started使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OmniMarkupLib.RendererManager.RendererManager
的用法示例。
在下文中一共展示了RendererManager.ensure_started方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from OmniMarkupLib.RendererManager import RendererManager [as 别名]
# 或者: from OmniMarkupLib.RendererManager.RendererManager import ensure_started [as 别名]
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')