omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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]

    Pythonista
    console history theme objc
    4
    9
    9016
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JonB
      JonB last edited by JonB

      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 :

      1. example of a themable ListDialogController -- notice tableview cell background match theme.
      2. Example of custom view in the title bar, in this case a search textfield.
      3. repurposing an existing App button for our own nefarious purposes.


      https://github.com/jsbain/objc_hacks.git. history_popup.py

      1 Reply Last reply Reply Quote 1
      • ccc
        ccc last edited by

        Impressive as always @JonB

        1 Reply Last reply Reply Quote 0
        • cook
          cook last edited by

          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
          
          1 Reply Last reply Reply Quote 0
          • cook
            cook last edited by

            An unfortunate bit about the search bar in the title bar- in panel presentation the width is limited.... Maybe there's some workaround but...

            1 Reply Last reply Reply Quote 0
            • JonB
              JonB last edited by

              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]
              
              Phuket2 1 Reply Last reply Reply Quote 0
              • JonB
                JonB last edited by

                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.

                1 Reply Last reply Reply Quote 1
                • cook
                  cook last edited by

                  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.

                  1 Reply Last reply Reply Quote 0
                  • Phuket2
                    Phuket2 @JonB last edited by

                    @JonB , for some reason your link gives a 404 error. I found the code on your Github page. But the link above not working

                    1 Reply Last reply Reply Quote 0
                    • ccc
                      ccc last edited by

                      https://github.com/jsbain/objc_hacks with a "c" on the objc

                      1 Reply Last reply Reply Quote 1
                      • First post
                        Last post
                      Powered by NodeBB Forums | Contributors