[share/in work] side bar replacement
JonB last edited by
Here is a little class to mimic the old sidebar presentation style from pythonista's past.
Not quite a perfect replica, but a functional quick attempt. This resizes the detail window (editor view) as the sidebar width is changed. I realize this probably should live a little lower down the view heirarchy, but this way was easy and robust.
@JonB , thanks for sharing. Works well. My mind goes blank when I see the objc calls. But you are not passing on the kwargs to the super. I added the super call at the end of the init to override some of your defaults, like alpha and bg_color. While bg_color was changed alpha did not. I am not sure if it has to do with the way you create the view. I am just not sure, I thought I would point it out anyway.
tileyon last edited by
@JonB I used your 'sidebar.py' to resurrect 'editmenu'. The extended side bar 'sidebar2.py' at:
is functionally and visually identical to 'editmenu.py' except that it no longer calls 'Find and Replace'. I also put the results from 'finddocstring' into a 'popover' since 'editor._set_toolbar(v)' has been removed. 'INDENTSTR' is no longer defined so I set it to four spaces. For those who prefer the 'real TAB' 'Indent Selection' can be easily modified to accommodate the 'Tab' character. You really investigate the Pythonista ui to its deepest end and teach me a lot with very little effort on my part. Thank you very much.
filippocld last edited by
What does ObjCInstance(self).tag=hash('SideBar') do?
@filippocld , I don't know. But possibly a dynamically added attr called tag storing the hash of SideBar
JonB last edited by JonB
It allows a check so we can avoid creating two sidebars. It there is already a sidebar, we delete it and spawn the new one. UIViews have a tag attribute, which is sort of like the name attribute of ui.Views, except that it accepts an integer, hence the hash.
Long live HyperCard