• Niall

    Ooooh... neat.

    I don't think I'll bother trying to implement the connection management at this stage -- it'll be a very early-stage prototype, and only I'll be using it, so I can do that manually.

    Many thanks!

    posted in Pythonista read more
  • Niall

    Apple is very precious about background services, and there was a point a few years ago where they cracked down heavily on app developers using background processing for convenience rather than strict need.

    In order to get through app approval, you have to have a very strong case for allowing background operation, and I'd be very surprised if Pythonista would have got through approval with an open API for background tasks that would basically allow anyone to do anything they feel like...

    posted in Pythonista read more
  • Niall

    I'm pretty certain the answer is "no" (because otherwise I'd have found something when I tried searching the documentation) but is it possible to get Pythonista to send a different picture to a connected HDMI or AirPlay screen than is shown on the iPad's own screen.

    I'm looking to prototype an educational app where the teacher has a control surface on the iPad which controls what is displayed on the classroom projector or interactive whiteboard.

    (If Pythonista can't do it natively, I'll set up a Raspberry Pi as the classroom screen controller and write a simple control interface in Python to send HTTP requests to the Pi....)

    posted in Pythonista read more
  • Niall

    The only wrinkle with your approach is that it would be too easy to work away on Pythonista and build up a working UI, only to forget which methods were available in the cross-platform version.

    The way I would solve this is by renaming the package (eg pythonistaui, and having two versions -- a Pythonista one and a Kivy one. The job of the Pythonista package would be to simply throw an error any time you tried to use something that isn't implemented in the Kivy version.

    In its simplest version, it would just be a list of imports, but that wouldn't deal with classes that didn't have all methods fully implemented -- in that case you'd have to build subclasses and override unimplemented methods to throw exceptions.

    If you are considering developing such a wrapper, I think the Pythonista version could probably be generated automatically with a bit of clever programming -- write a script that takes the ui spec from Pythonista, checks each function, class and method to see if it's available in your Kivy wrapper, and builds up the Pythonista wrapper from there.

    posted in Pythonista read more
  • Niall

    Capital cases, lawyers be damned. You say this:
    "In the unfortunate event that the material should be reproduced, transformed or otherwise manipulated in whole or in parts then current local, state and international copyright laws should apply."

    What that means is that I can submit changes to your Git repository, but I can't actually any software with it built in, as that would be "reproduction". Thus any code I wrote with it would only be issuable in source form, for people who run a Python interpreter and who install your gui wrapper themselves.

    That means that I can't develop a package in Pythonista using it and then package it in XCode.
    It means I can't compile the package into an Android.apk or a Windows .exe .

    There is little point in me learning your API if I'm never going to be able to use it beyond tinkering for my own interest -- and if I'm tinkering for my own interest, then cross-platform dev clearly isn't a big issue and in the end I'd be just as well sticking with Pythonista ui or Kivy.

    posted in Pythonista read more
  • Niall

    Ah wait, sorry... I see what's happening here...

    "I splited them in 5 arrays"

    You don't want to do that. Each row of your file is a single entity and should not be split.

    You should read each row as a single array, tuple or dictionary. If you read them as a dictionary, use the solution I supplied above. If you're reading them as an array or tuple, modify the key in the code above to be 1 rather than "population".

    Check out the Python docs for the csv module to read your files in -- that does most of the string handling work for you.

    posted in Pythonista read more
  • Niall

    Because the items in your list are dicts rather than simple values (I'm assuming you used csv.DictReader to read in your file, and I'm going to call it list_of_dicts for clarity), there's no reliable automatic sorting. What you need is a "key function" that tells sorted how to determine what the order is.

    You need to either:

    1. define a function:
      def getPopulation (record) : return record["population"]
      and then call sorted with this as the named parameter "key":
      sortedValues = sorted(list_of_dicts, key=getPopulation)


    1. provide an anonymous function (lambda) as the key parameter
      *sortedValues = sorted(list_of_dicts,key=(lambda x: x["population"])

    posted in Pythonista read more
  • Niall

    It's not just a question of Apple ceasing to provide OS updates for the device though, is it?

    The problem is first that they stop supporting the OS, including refusing to fix bugs they introduced in their latest versions. I'm having a lot of hanging and crashing in Safari, and the text-to-speech bugs @JonB mentions are a major issue to me as I was using my iPad and Pythonista to produce listening material for language classes that I could alter and repeat, slow down or speed up as appropriate to an individual class's needs.

    My device is now not simply "not updated", its most important function to me has been irresolvably borked. (And then of course there are the partially sighted users who rely on the availability of text-to-speech for most of their iOS usage.)

    Then we have the fact that you cannot load apps onto the iPad without using the iTunes App Store. The app store only holds one version of each app, so when one of my current purchases becomes iOS 10 only, I will no longer be able to reinstall. With less than 16 gigs to play with on my Mini, and with a habit of recording at high bitrates in Filmic Pro, I often need to drop apps off my device and reload them later, which I can no longer afford to do. Say I delete Filmic Pro so that I've got extra space to edit in Pinnacle Studio, and then when I go to reinstall Filmic, it says my device is not supported. Or if I leave Pinnacle off the iPad while filming and go to install it once I've finished filming and it complains that I've not got a supported version of iOS. In either one of these scenarios, I'm SooL. My portable combination of camcorder and edit suite is ripped from my hands when the hardware's still in a perfectly serviceable state.

    4 years might seem like a reasonable lifespan when compared to a laptop PC, but when you compare it to pro audio and video equipment (or even just consumer kit), it's not.

    posted in Pythonista read more
  • Niall

    As Lukas already asked: why? Why do you want to do this?

    posted in Pythonista read more
  • Niall

    I have a long-term natural language processing project that I've been working on for a while. Pythonista let me continue to work on it while I was on a month long cycle tour over the summer. (People thought I was mad when I pulled an iPad mini and a full-sized USB keyboard out of my luggage at the campsites, but it was much better than trying to transport even a netbook without damaging something.)

    Until recently I was also using it for small classroom tasks (as a teacher), but then Apple went and broke it on me -- the latest update of iOS 9 messed up the text-to-speech interface, and I was using high quality voices to provide listening material for language classes. I wrapped the whole thing up in a keyboard controlled interface to play the whole thing, step through line by line, repeat lines, slow down/speed up etc. I was able to produce anything I wanted, tune it to the class in question, and walk around with a Bluetooth keyboard controlling it from everywhere in the class.
    But iOS 9 won't get any more bug fixes (except serious security flaws) so now my most important use for the iPad mini (not iOS 10 compatible) is gone.

    Is there a decent Pythonista-like app for Android? I'm not sure I want to buy Apple again.

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!