• mikael

    @egehman, do you still need the click import and the lambda?

    posted in Pythonista read more
  • mikael

    @egehman, for what it is worth, you do not need to set the environment variable if you create the app exlicitly, like in

    app = Flask(__name__)
    

    I earlier decided to use bottle rather than flask because there was a cleaner way to shut it down in Pythonista - see this thread.

    posted in Pythonista read more
  • mikael

    @BGKirkham, thanks.

    Note that the images are still not copied over to the forum in any way, and will go away when you remove or move them at your end.

    posted in Pythonista read more
  • mikael

    @BGKirkham, when you are done with this view, would be nice if you could publish it as a generally usable table view.

    posted in Pythonista read more
  • mikael

    @BGKirkham, I assume the contents of each row are extending beyond the content_view of the cell, and TableView does not really know this is happening.

    One option could be to make TableView big enough to fit all rows and columns, and then place it in a ScrollView.

    posted in Pythonista read more
  • mikael

    @Drizzel, would still recommend understanding which thread is used to initialize the connection, and which thread to make sql queries, especially updates.

    posted in Pythonista read more
  • mikael

    Happy last day of the decade to everyone who shares my calendar!

    I finessed the script a bit with the ability to select, copy or share multiple items, and nicer icons.

    @cvp, noted and wondered about the lack of the link for your handle, no idea why.

    posted in Pythonista read more
  • mikael

    Revisiting this.

    Regardless of language restrictions, I have found the simple and reliable ability to pick text from paper to be useful for me almost weekly - URLs, email addresses, reservation codes, laptop serial numbers, etc.

    With the use, I noted that the original script had some issues:

    1. Difficult to find and open when quickly needed.
    2. Slow to get from the picked photo to recognized text.
    3. Results are a pain to copy from the Console as it likes to jump around just as you’ve selected the text to copy.

    Point #1 was fixed with a simple Apple Shortcuts shortcut to make the script easy to run.

    Point #3 was resolved by presenting the recognized text in a TableView, with tap to copy.

    Point #2 took a bit more doing.

    Pythonista photos module wants to return PIL images, and that results in two very slow conversions - first the module converts the UIImage to PIL, and then I converted that back to a PNG image for recognition. I found some @cvp code in this thread and replaced photos module with objc_util pickers, which return PNG data almost directly.

    And hey presto! Not just faster recognition, but instantaneous - and with much better quality than with the only contender app I could find (Prizmo Go).

    Updated script here.

    posted in Pythonista read more
  • mikael

    @BGKirkham, to my knowledge, there is no generic, built-in way to detect ”losing focus”. I would suggest placing a background ui.View to detect taps on it and call end_editing on your TextFields — Labels etc. should be transparent to touches.

    This could be made a bit generic by running through all subviews, and calling end_editing on all views that have the method.

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!