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.


    Remote Control with BaseHTTPServer

    Pythonista
    4
    8
    7412
    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.
    • cook
      cook last edited by

      I've been doing some brainstorming on something...
      (sorry this is about something in Editorial but more so about the ability of Python code so I put it in the Pythonista forum)

      I have a presentation script that I use for teaching. Currently it's an implementation of remarks.js within python. So I'm able to do a presentation using a markdown file and I use this in Editorial. It's brilliant and much easier to use than silly silly powerpoint etc.

      The other day Apple updated their iWorks suite with multitasking. I played with it a bit - and now you can use Keynote remote on splitscreen while displaying something (like notes) and on iphone you have the presentation running. That's awesome.

      really hoping for multitasking support in editorial :)

      So I was thinking if I can do that in Editorial/Pythonista with my presentation script.

      I did a bit of looking around and saw that we have BaseHTTPServer installed already. Before I bother writing a bit of code, I'm wondering if anyone has any experience with this and can offer some insight.

      I'm wondering if I can pull this off:

      on one iDevice:

      • Run my presentation script (which is a UI webview) on my iPhone
      • In the background it runs an HTTPserver which serves a simple webpage with some buttons (next, previous etc.)
      • the server then can take POST requests and handle them to do things (next, previous etc)

      on the other iDevice:

      • connect to the server and show the simple webpage (I could easily create this to be a simple UI split screen (notes+control).

      Do you think this is all possible?

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

        Not commenting on your idea itself but I've noticed when I've worked with *HTTPServer it tends to quit running after a while.

        I don't have useful diagnostics but if it's unreliable then you have to be aware it might not be up when you try to use it.

        (And my application is to use Safari in Slide Over mode, served by Pythonista - so not too dissimilar to what you're doing.)

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

          Do you think that has to do with backgrounding?

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

            I have not done any research into this however if it is the result of background tasks try using this.
            Also something to think about is the presentation on both devices does not necessarily need to be a *HTTPServer but could simply be ui.WebView.load_html('filename.ext') calls and then a simple Socket server between the two devices to call 'page' changes

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

              Overall, I would say that your idea should be doable. You might check out the last post in this thread.... https://forum.omz-software.com/topic/532/feature-request/6 I tried with HTTPServer but shifted to Bottle (or your could try Flask) instead because I found it to be more robust for this purpose than HTTPServer.

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

                @cook I don't know but could very well do.

                @ccc Thanks for the steer on other ways of serving HTML - I hope to a web browser as my use case requires Slide Over or Split Screen.

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

                  @ccc So I've typed in the bottle "Hello World" example and I'll see how resilient it is.

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

                    Okay thanks everyone! Sometime I'll look into it a bunch more. Appreciate the alternate suggestions @ccc

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