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.


    Using Bottle/Webbrowser in v1.5

    Pythonista
    6
    7
    4385
    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.
    • onionradish
      onionradish last edited by

      I have a script written as a self-contained web app using bottle to serve the content and the integrated webbrowser to display it.

      Pythonista v1.5 now shifts the display away from the webbrowser to the console whenever anything is written to the console. By default, bottle outputs log information to the console, which means the any navigation on the webapp shifts the display away.

      As an FYI for anyone else with the issue, adding quiet=True to bottle.run() eliminates the default console output in bottle, but anything your script outputs to the console will shift focus to the console.

      It would be nice if there was an option to prevent the console from stealing focus from the webbrowser.

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

        As a workaround you could try changing "http://" to "safari-http://".

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

          Thanks I hadn't really thought of this when I changed the web browser UI. I guess one solution could be to change the console's behavior, so that it console doesn't automatically get focussed when you're in a different tab (web browser or docs).

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

            Yeah this is impacting me too. Most of my apps are using Bottle and dump logging /adhoc debug stuff to the console.

            Bottle's quiet option helps.

            Maybe a good time for me to move to a better way of debugging ... :)

            Just checking out the rest of v1.5 now.

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

              Another workaround... Run as a popover webview in a ui view.

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

                I suppose you could also redirect stdout somehwere else while the script is running, that'll make sure that you won't have any kind of console output. Not the cleanest way to get rid of console output, but it should work.

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

                  @omz:

                  Probably the best default behavior is to leave the user on whichever tab is currently active.

                  Other options would be:

                  • modify the icon of any non-active tab that has changed content so the user is aware and could switch to the display manually (as long as it's simply informative and not a blinking or other 'annoying' style that demands attention)
                  • add methods or options to the Pythonista iOS console/webbrowser modules to specify or force when and how switching between views is done.

                  In either case, I think the best default option is to remain on the current view.

                  The various workarounds listed above are all helpful. However, one of the benefits to writing a script as a self-contained webapp with bottle/webserver is that the same script will work on Windows, Mac, Linux and iOS (through Pythonista) with minimal or no modification -- the fewer workarounds and hacks needed for Pythonista, the better.

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