本文整理汇总了Python中sublime.HIDE_ON_MOUSE_MOVE_AWAY属性的典型用法代码示例。如果您正苦于以下问题:Python sublime.HIDE_ON_MOUSE_MOVE_AWAY属性的具体用法?Python sublime.HIDE_ON_MOUSE_MOVE_AWAY怎么用?Python sublime.HIDE_ON_MOUSE_MOVE_AWAY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类sublime
的用法示例。
在下文中一共展示了sublime.HIDE_ON_MOUSE_MOVE_AWAY属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import HIDE_ON_MOUSE_MOVE_AWAY [as 别名]
def __init__(self, component: Union[span, div], view: sublime.View, location: int = -1, on_close: Optional[Callable[[], None]] = None) -> None:
super().__init__(component, view)
self.on_close = on_close
self.location = location
self.max_height = 500
self.max_width = 1000
self.render()
view.show_popup(
self.html,
location=location,
max_width=self.max_width,
max_height=self.max_height,
on_navigate=self.on_navigate,
flags=sublime.COOPERATE_WITH_AUTO_COMPLETE | sublime.HIDE_ON_MOUSE_MOVE_AWAY,
on_hide=self.on_hide
)
_renderables_add.append(self)
self.is_hidden = False
示例2: run_async
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import HIDE_ON_MOUSE_MOVE_AWAY [as 别名]
def run_async(self, pkg, funct, point=-1):
if not funct:
pkg, funct = self.function_name_at_point(self.view, point)
if not pkg:
pkg = namespace_manager.find_object_in_packages(funct)
funct_call = namespace_manager.get_function_call(pkg, funct)
if not funct_call:
return
with preference_temporary_settings("mdpopups.use_sublime_highlighter",
True):
with preference_temporary_settings(
"mdpopups.sublime_user_lang_map",
{"s": [["r"], ["R/R.sublime-syntax"]]}):
text = POPUP_TEMPLATE.format(
mdpopups.syntax_highlight(
self.view, funct_call.strip(), language="r"), pkg,
funct)
mdpopups.show_popup(
self.view,
text,
css=POPUP_CSS,
flags=sublime.COOPERATE_WITH_AUTO_COMPLETE | sublime.HIDE_ON_MOUSE_MOVE_AWAY,
location=point,
max_width=800,
on_navigate=lambda x: self.on_navigate(x, pkg, funct, point))
示例3: show_hover
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import HIDE_ON_MOUSE_MOVE_AWAY [as 别名]
def show_hover(self, point: int) -> None:
contents = self.diagnostics_content() + self.hover_content()
if contents and settings.show_symbol_action_links:
contents += self.symbol_actions_content()
_test_contents.clear()
_test_contents.append(contents) # for testing only
if contents:
mdpopups.show_popup(
self.view,
contents,
css=popups.stylesheet,
md=False,
flags=sublime.HIDE_ON_MOUSE_MOVE_AWAY,
location=point,
wrapper_class=popups.classname,
max_width=800,
on_navigate=lambda href: self.on_hover_navigate(href, point))
示例4: on_hover
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import HIDE_ON_MOUSE_MOVE_AWAY [as 别名]
def on_hover(self, view, point, hover_zone):
if not sublime.load_settings("plugin.sublime-settings").get("enable", 1):
return
global g_regions
global g_region_lines
global g_jump_index
global g_line_regions
if not self.lang or not self.data:
return
#self.init(view)
# locate smiles in the string. smiles string should be at the beginning and followed by tab (cxsmiles)
# hovered_line_text = view.substr(view.word(point)).strip()
#hovered_line_text = view.substr(view.line(point)).strip()
if (hover_zone == sublime.HOVER_TEXT):
word = view.substr(view.word(point)).strip()
for key in g_regions:
val = self.data[key]
if word in val["keyword"]:
hovered_text = '<p>%s</p>'%(val["discription"])
view.show_popup(hovered_text,
flags=sublime.HIDE_ON_MOUSE_MOVE_AWAY,
location=point)
g_jump_index = g_region_lines.index(view.rowcol(point)[0])
return
line = view.rowcol(point)[0]
if g_line_regions.get(line):
hovered_text = ''
for key in g_line_regions.get(line):
val = self.data[key]
hovered_text += '<p>%s</p><br>'%(val["discription"])
view.show_popup(hovered_text, flags=sublime.HIDE_ON_MOUSE_MOVE_AWAY, location=point)
g_jump_index = g_region_lines.index(view.rowcol(point)[0])
return
示例5: show_popup_menu
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import HIDE_ON_MOUSE_MOVE_AWAY [as 别名]
def show_popup_menu(self) -> None:
if len(self.commands) > 0:
self.view.show_popup_menu([command[1] for command in self.commands], self.handle_select)
else:
self.view.show_popup('No actions available', sublime.HIDE_ON_MOUSE_MOVE_AWAY)
示例6: _show_popup
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import HIDE_ON_MOUSE_MOVE_AWAY [as 别名]
def _show_popup(self, content: str, point: int) -> None:
mdpopups.show_popup(self.view,
content,
css=popups.stylesheet,
md=True,
flags=sublime.HIDE_ON_MOUSE_MOVE_AWAY,
location=point,
wrapper_class=popups.classname,
max_width=800,
on_hide=self._on_hide,
on_navigate=self._on_hover_navigate)
self._visible = True
示例7: show
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import HIDE_ON_MOUSE_MOVE_AWAY [as 别名]
def show(self, view, location=-1, on_navigate=None):
"""Show this popup."""
mdpopups.show_popup(view, self.as_markdown(),
max_width=self.max_width,
max_height=self.max_height,
wrapper_class=Popup.WRAPPER_CLASS,
css=self.CSS,
flags=sublime.HIDE_ON_MOUSE_MOVE_AWAY,
location=location,
on_navigate=on_navigate)
示例8: on_hover
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import HIDE_ON_MOUSE_MOVE_AWAY [as 别名]
def on_hover(self, view, point, hover_zone):
terminal = Terminal.from_id(view.id())
if not terminal:
return
if hover_zone != sublime.HOVER_TEXT:
return
url = find_url(view, pt=point)
if not url:
return
def on_navigate(action):
if action == "open":
webbrowser.open_new_tab(url)
def on_hide():
if link_key:
view.erase_regions(link_key)
url_region = find_url_region(view, pt=point)
link_key = None
if url_region:
link_key = highlight_key(view)
view.add_regions(
link_key,
[sublime.Region(*url_region)],
"meta",
flags=sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE | sublime.DRAW_SOLID_UNDERLINE)
view.show_popup(
URL_POPUP,
sublime.HIDE_ON_MOUSE_MOVE_AWAY,
location=point,
on_navigate=on_navigate, on_hide=on_hide)
示例9: display_documentation
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import HIDE_ON_MOUSE_MOVE_AWAY [as 别名]
def display_documentation(view, docs, doc_type, pt=-1, current_index=0):
global doc_window
doc_region_id = str(uuid.uuid4())
doc_html, doc_regions = generate_documentation(view, docs, current_index, doc_type)
on_navigate = get_on_navigate(view, docs, doc_type, current_index, pt)
if doc_type == "completion_doc":
if doc_window and doc_window == "completion_doc":
view.update_popup(doc_html)
else:
doc_window = "completion_doc"
view.show_popup(
doc_html,
flags=sublime.COOPERATE_WITH_AUTO_COMPLETE,
max_width=480,
on_navigate=on_navigate,
on_hide=lambda: on_hide(view, doc_region_id),
)
else:
if doc_regions and utils.get_setting("inline_doc_regions_highlight"):
view.add_regions(
doc_region_id,
merge_regions(doc_regions),
"source",
flags=sublime.DRAW_NO_FILL,
)
doc_window = "inline_doc"
flags = sublime.HIDE_ON_MOUSE_MOVE_AWAY if doc_type == "hover_doc" else 0
# print(doc_html)
view.show_popup(
doc_html,
location=pt,
flags=flags,
max_width=768,
max_height=480,
on_navigate=on_navigate,
on_hide=lambda: on_hide(view, doc_region_id),
)
示例10: hint_popup
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import HIDE_ON_MOUSE_MOVE_AWAY [as 别名]
def hint_popup(self, location, completions):
html = ""
for completion in completions :
parameters_html = "()"
completion_class_name = completion[0].split("\t")[1].strip()
if len(completion_class_name) > 15 :
completion_class_name = completion_class_name[0:15] + ".."
completion_description = completion[1]
if completion_description.get("type") == "operation" :
parameters = []
for parameter in completion_description.get("parameters") :
parameters.append( "<span class=\"parameter-name\">" + parameter.get("name") + "</span>" + ( "<span class=\"parameter-is-optional\">?</span>" if parameter.get("is_optional") else "" ) + "<span class=\"parameter-symbol\">:</span> " + "<span class=\"parameter-type\">" + parameter.get("type") + "</span>" )
if len(parameters) > 0 :
parameters_html = "( " + ", ".join(parameters) + " )"
html += """
<div class=\"container-description\">
<div><span class=\"operation-class-name\">"""+completion_class_name+""" <span class=\"circle\">F</span></span><div class=\"container-info\"><span class=\"operation-name\">"""+completion_description.get("name")+"</span>"+parameters_html+""" : <span class=\"operation-return-type\">"""+completion_description.get("return_type")+"""</span></div></div>
<div class=\"container-url-doc\"><a href=\""""+completion[2]+"""\">View complete doc</a> <span class=\"label\">URL doc: </span><a class=\"operation-url-doc-link\" href=\""""+completion_description.get("url_doc")+"""\">"""+completion_description.get("url_doc")+"""</a></div>
</div>
"""
elif completion_description.get("type") == "property" :
html += """
<div class=\"container-description\">
<div><span class=\"property-class-name\">"""+completion_class_name+""" <span class=\"circle\">P</span></span><div class=\"container-info\"><span class=\"property-name\">"""+completion_description.get("name")+"</span>"+" : <span class=\"property-return-type\">"""+completion_description.get("return_type")+"""</span></div></div>
<div class=\"container-url-doc\"><a href=\""""+completion[2]+"""\">View complete doc</a> <span class=\"label\">URL doc: </span><a class=\"property-url-doc-link\" href=\""""+completion_description.get("url_doc")+"""\">"""+completion_description.get("url_doc")+"""</a></div>
</div>
"""
elif completion_description.get("type") == "constructor" :
parameters = []
for parameter in completion_description.get("parameters") :
parameters.append( "<span class=\"parameter-name\">" + parameter.get("name") + "</span>" + ( "<span class=\"parameter-is-optional\">?</span>" if parameter.get("is_optional") else "" ) + "<span class=\"parameter-symbol\">:</span> " + "<span class=\"parameter-type\">" + parameter.get("type") + "</span>" )
if len(parameters) > 0 :
parameters_html = "( " + ", ".join(parameters) + " )"
html += """
<div class=\"container-description\">
<div><span class=\"constructor-class-name\">"""+completion_class_name+""" <span class=\"circle\">C</span></span><div class=\"container-info\"><span class=\"constructor-name\">"""+completion_description.get("name")+"</span>"+parameters_html+""" : <span class=\"constructor-return-type\">"""+completion_description.get("return_type")+"""</span></div></div>
<div class=\"container-url-doc\"><a href=\""""+completion[2]+"""\">View complete doc</a> <span class=\"label\">URL doc: </span><a class=\"constructor-url-doc-link\" href=\""""+completion_description.get("url_doc")+"""\">"""+completion_description.get("url_doc")+"""</a></div>
</div>
"""
sublime.active_window().active_view().show_popup("""
<html><head></head><body>
"""+js_css+"""
<div class=\"container-hint-popup\">
""" + html + """
</div>
</body></html>""", sublime.COOPERATE_WITH_AUTO_COMPLETE | sublime.HIDE_ON_MOUSE_MOVE_AWAY, location, 1150, 60, open_browser)