Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
History popup [share]
-
Here is a tool that adds the ability to long press the built in history up button in the console, to bring up a table of the current history buffer. Selecting a row copies it to the command line. this also lets you save the history session to a json file, which allows it to be loaded again later. For stupid reasons that I will eventually fix, when loading from the history file, you will have to close and then reopen the history for the loaded values to show up. At the moment, it also needs to be in site-packages to work, or in pythonista_startup. It should be safe to enable there, and then the gesture is always available.
Others may find this interesting for :
- example of a themable ListDialogController -- notice tableview cell background match theme.
- Example of custom view in the title bar, in this case a search textfield.
- repurposing an existing App button for our own nefarious purposes.
https://github.com/jsbain/objc_hacks.git. history_popup.py -
Impressive as always @JonB
-
Thank you @jonb. I am not sure if I will use this too much. But it's nice to just read through the UI code. Especially this part about hijacking UI.buttonitem:
I will try to use that for something else. That's really cool!!searchField=ui.TextField() searchField.placeholder='Search' searchField.frame=(0,0,180,32) searchField.clear_button_mode='always' editor.apply_ui_theme(searchField) searchBarButton=ui.ButtonItem() ObjCInstance(searchBarButton).customView=searchField
-
An unfortunate bit about the search bar in the title bar- in panel presentation the width is limited.... Maybe there's some workaround but...
-
Maybe on the iphone it is limited? The width is controlled by whatever frame you set on the customView. On iPad I can use the whole bar area...
>>> v=ui.View() >>> b=ui.ButtonItem() >>> from objc_util import * >>> ObjCInstance(b).customView=ui.TextField(frame=(0,0,700,30)) >>> v.present('panel') >>> v.right_button_items=[b]
-
I made a slight update to include multiple line (variable height) table rows.
The reason I made this is I tend to work a lot in the console, since it autocompletes objc. I find myself continually hitting that history up button to find something i was doing before. Also, this allows you to basically persist history across sessions--once the history is loaded, it can be used by the normal history buttons. My plan with the copy button would be to allow you to select from history, and copy the snippets into a script, to more easily capture the console ramblings into something more formal.
-
The copy sounds very useful to me. I don't use the console too much, but these days I'm starting to more. Being able to copy things easily would be great.
Will try the search bar thing again. Was on my iPad but will try like you said.
-
@JonB , for some reason your link gives a 404 error. I found the code on your Github page. But the link above not working
-
https://github.com/jsbain/objc_hacks with a "c" on the objc