Forum Archive

Sidebar UI -- close programmatically

Helgi

I've stumbled upon a nice sidebar UI script made to work together with the Working Copy app.

The script presents a very narrow sidebar with just one column of buttons. As it turns out, for a sidebar that narrow, the close button overlaps with the 'open console' chevron, so it's impossible to close the sidebar. Is it a known issue?

To circumvent this, I wanted to add a custom 'close' button that calls close() on the view. However, it looks like close() doesn't work for sidebars (it works OK for me for sheets, fullscreens and popovers). Is it a known issue? I wasn't able to find anything stating this in the docs.

If I succeed with adding a custom close button, I'd like to hide the standard close button on the sidebar (which is not usable anyway). Is there any way I can do this? hide_title_bar doesn't work for me.

I believe this questions are not covered on the forum, at least I wasn't able to find anything like them.

Tested with Pythonista 1.5.

dgelessus

Sidebar and panel mode views cannot be closed programmatically, this is a known bug/limitation. A workaround could be to present an empty view with the same mode, which would at least make the X button usable again, but that of course still requires extra user interaction.

JonB

As a hack, you can set the frame to 0,0,0,0 and present as a sidebar again. This has some unfortunate behavior of returning on_screen as True, but otherwise seems to hide the view.