Sublime Forum

Mdpopups, how to make a view-wide popup

#1

I’d like to use mdpopups for a plugin I’m writing. Does anybody have some practice with it? What I’d like to do is a box that spans for the view width, at the bottom or at the top, which would contain file information when the view is changed or when the tooltip is called. I can make a tooltip appear, but it’s not big enough, I can set max_width but not the minimum width. Also, I would like to keep a consistent colour, independent from the colour scheme, because this makes it just harder to read or even notice. Any suggestions? Thanks if you can provide any.

0 Likes

#2

Popups don’t support min width and even positioning might be tricky.

If you want to show a view at the bottom, why don’t you use a panel. You can add phantom text to it, which supports html for better formatting. You could also use normal css to modify the look.

0 Likes

#3

Thanks, seems like phantoms could be the best options. Also the output panel wouldn’t be bad, maybe I’ll try both.

0 Likes

#4

Is there a way to set an image as background for a popup/phantom, to be stretched? Thanks

0 Likes

#5

Not sure, but I think background images are not supported by minihtml

0 Likes

#6

The minihtml reference doesn’t mention the CSS property that would do this, although having said that I am by no means an HTML/CSS wizard so there may be some other way to do the same thing.

0 Likes

#7

Yeah, background images aren’t supported yet from my understanding.

0 Likes

#8

Thanks all for the answers. I’m struggling trying to create the output panel. For now I have:

class FilePanelCommand(sublime_plugin.TextCommand):

    def run(self, edit, content, css):
        def scheme():
            return settings().get("file_panel_color_scheme")

        output = win().create_output_panel("file_operations")
        output.settings().set("color_scheme", scheme())
        output.insert(edit, output.size(), content + '\n')
        output.set_read_only(True)
        win().run_command("show_panel", {"panel": "output.file_operations"})

The panel shows up, but empty. How is it that I can insert text in the panel? Thanks

Edit: ok I sorted it out with set_read_only(False) put before insert

0 Likes