Python sublime.HIDE_ON_MOUSE_MOVE_AWAY Examples

The following are 10 code examples of sublime.HIDE_ON_MOUSE_MOVE_AWAY(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module sublime , or try the search function .
Example #1
Source File: render.py    From sublime_debugger with MIT License 6 votes vote down vote up
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 
Example #2
Source File: popup.py    From R-Box with MIT License 6 votes vote down vote up
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)) 
Example #3
Source File: hover.py    From LSP with MIT License 6 votes vote down vote up
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)) 
Example #4
Source File: VulHint.py    From VulHint with MIT License 5 votes vote down vote up
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 
Example #5
Source File: code_actions.py    From LSP with MIT License 5 votes vote down vote up
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) 
Example #6
Source File: signature_help.py    From LSP with MIT License 5 votes vote down vote up
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 
Example #7
Source File: popups.py    From EasyClangComplete with MIT License 5 votes vote down vote up
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) 
Example #8
Source File: mouse.py    From Terminus with MIT License 5 votes vote down vote up
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) 
Example #9
Source File: inline_documentation.py    From sublimetext-cfml with MIT License 5 votes vote down vote up
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),
        ) 
Example #10
Source File: _generated_2018_02_11_at_20_21_24.py    From JavaScript-Completions with MIT License 4 votes vote down vote up
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)