• DaveR133

    No. My theory is wrong. The main module, which has run(myscene()) in the <i>middle</i> of it, completes before calling the scene . If I correct that import statement it downloads the weather maps, using the default parameters, and only switches to the scene once it reaches the webbrowser.open command at the end. (And it doesn't open the webbrowser window at all.)

    So to enable this scene to collect parameters I need to move all the code after the run(myscene()) somewhere else so that it runs after the scene.

    posted in Pythonista read more
  • DaveR133

    I have a module that takes some parameters and downloads some files from the internet - weather maps in fact. I wrote it years ago - it ran under maemo.

    My wife bought an iPad and I wrote a wrapper for it in pythonista. It gets the parameters using console.input_alert, then calls the download module, and then displays the maps in a webbrowser window.

    I bought an Android device. I ported the iPad version to that. I recently wrote a GUI for the parameter-entry; most of the parameters stay the same as the last time and the one that doesn't, a date, can usually be predicted. So it's a waste of time to prompt for all these paramters. Here's some pictures of the result here, which will give you an idea of what I'm trying to do:
    <a href="http://www.flickr.com/photos/7544154@N07/9946566726/">GUI</a>
    <a href="http://www.flickr.com/photos/7544154@N07/9946631744/">Viewer in the browser</a>

    So I thought I'd update the iPad version to do something similar. I was half-way though producing a similar GUI using scene, which works fine I think so far, when I realised that unlike on my Android version there appears to be no scene.quit(). I want to resume with the code after the run()

    Can you quit scene and continue? I want further output in the log window.

    The download module uses print to display progress and error messages. I don't really want to move all that into the GUI - I've done something similar with Tkinter and it's a pain. And I certainly can't implement my viewer in scene.

    posted in Pythonista read more
  • DaveR133

    Thanks for that. I know nothing about threads in python, but I get the gist. I'l read up on it.

    It helps explain something that was puzzling me but I hadn't got round to investigating. Immediately after the run() I have a print statement - it prints the parameters (they're global). On the Android version that get executed after I quit the GUI. But in pythonista it executes <i>before</i> running the scene - and prints the parameters going <i>into</i> the GUI.

    But below that is an import that fails in pythonista, because the module name is wrong and I haven't yet corrected it. That statement fails only after I close the scene with the X at the corner.

    I suppose that what's happening is that it takes some time to launch the scene, time enough to print but not enough to reach the import. Which suggests a solution: insert a delay after the run(), get the parameters in the scene, then close it with the X.

    A bit of a kludge. I could make a friendly green arrow pointing to the X labelled 'Download'.

    posted in Pythonista read more
  • DaveR133

    I wrote a script that downloads images (a sequence of weather maps) from the internet and displays them using Image.show. It works fine. But the images are not zoomable.

    So I wrote an html module which takes a list of these maps (the paths to them) and displays them in the webbrowser module in a slideshow - which is zoomable. Each map is loaded by inserting its path in the form
    using forward/backward buttons and a bit of javascript which changes the html.
    All that works fine too.

    BUT the maps take ages to load in the webbrowser - much slower than they all appear on the console with Image.show. Slower than loading an image from the internet! It's OK once they've been displayed once (ie they're cached I suppose) but it's painful waiting for them as I click through the slideshow.

    Can anybody suggest why the browser is so slow doing this, and whether I can do anything to speed it up? It ought to be fast loading an image from memory. It might be the javascript - but there's not much of it.

    posted in Pythonista read more
  • DaveR133

    @pudquick Thanks for that very full explanation. I'm not a developer these days, but as a Linux user I find these restrictions incredibly frustrating - though I understand the commercial and technical reasons for them. Thanks for your patience.

    posted in Pythonista read more
  • DaveR133

    After my post about kivy I saw pudquick's post about licensing earlier in this thread:

    I also looked at what kivy (who also produce the python-for-android environment which I used) said about it:
    <blockquote>Kivy is released under the terms of the GNU LGPL Version 3. ... An online version of the license can be found at http://www.gnu.org/licenses/lgpl-3.0.txt

    In a nutshell the license allows you to use Kivy in your own projects, regardless of whether they are open source, closed source, commercial or free. The one thing the license does enforce is that if you make changes to the Kivy sourcecode itself, you have to share those changes with us. For a more thorough legal explanation ....
    </blockquote>(From http://kivy.org/docs/) Which is not quite the same emphasis - but the licence itself is pretty clear and confirms pudquick's post.

    Much seems to depend on static vs dynamic linking - about which I know little. This seems to be summed up here:
    <blockquote>Proprietary Source code + LGPL Source code
    - statically linked: You must release both parts as LGPL.
    - dynamically linked: LGPL code stays LGPL, you can keep the proprietary code proprietary.</blockquote>
    (Do iOS apps differ from an Android ones in that respect?)

    Could a scripting app, like Pythonista, provide a version of the kivy libraries without itself linking to them? Arguably the scripting app would then not be an 'Application' under the definition in the LGPL. That would put the onus on whoever writes a script using kivy: if that were 'conveyed' they would be subject to the LGPL.

    Kivy's python-for-Android may be a special case - they own kivy. But I see that Qpython for Android provides a kivy library and promotes building apps. (I suggest we don't discuss it's licensing here though.)

    posted in Pythonista read more
  • DaveR133

    Good luck, Daniel!

    I'm nearly 50 years older than you. I first programmed a computer in the 1960s in Algol, and was a programmer during the 1970s in IBM and ICL assembler. It was all new and fun. This was before object oriented programming was in common use.

    I still program for fun - but struggle with this new-fangled 'object' stuff ;-)

    posted in Pythonista read more
  • DaveR133

    +1 for kivy - x-platform GUI


    I wrote a python program for Android using it - with the advantage that I could test it on Linux first. Only the paths differ between the two OSes.

    Currently I maintain two versions of my Pythonista programs - the Linux ones use tkinter and the iOS ones use console - which is a bit clunky.

    posted in Pythonista read more
  • DaveR133

    I tried the idea I wrote in that readme - pre-emptively loading the next map, but hidden, to get it into the browser's cache. On a non-rigorous test it works well. The first load is slower but subsequently it's faster moving between maps. It also confirms it's not the javascript that's the problem.

    I still wonder why it's so slow to display an image that's in the filestore?

    posted in Pythonista read more
  • DaveR133

    Nice. Thanks. I could have done with this when I started with pythonista.

    (We could do with a 'thanks' button on here.)

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!