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.
New Xcode Template on GitHub
-
Even works with the new Scene module.
Thanks so much. -
Hey. I just wanted to stop by and say thank you for this. I consider it above and beyond, and the thorough instructions in the readme are very much appreciated. Time to go play with it.
-
@omz I'm adding my sincere thanks here as well. I've been making extensive use of the old one and chiming in about a desire for this here and there. This is seriously empowering stuff.
By the way, I listen to "Accidental Tech Podcast" (atp.fm) live, and there's a "tipster" from Apple that answers questions in their irc chat after the live shows - I mentioned pythonista and the fact that you can make iOS apps from iOS with it and asked if people were generally aware of it and how people inside apple felt about it. He said they were very aware, and highly impressed.
-
One question - is there a way to programmatically access the version number / build number from within python?
UPDATE: @omz thanks!!
-
from objc_util import NSBundle info = NSBundle.mainBundle().infoDictionary() version = str(info['CFBundleVersion']) short_version = str(info['CFBundleShortVersionString'])
-
Another question:
In the previous template I figured out that I could change the name of my main python file by searching for "main.py" and then changing it to whatever script I want to run.
in PAAppDelegate.mNSString *mainScriptFile = [writableScriptDirectory stringByAppendingPathComponent:@"main.py"];
Is there any reason this would cause any problems or is not advisable?
UPDATE: thanks @omz
-
@Tizzy You can change that if you like.
-
Just tested it out and it almost works flawlessly, there were a few issues with indents, but nothing large. Being new to the world of programming, I was just wondering how exactly this work. Does the XcodeTemplate translate the Python language into Objective C, or does the Iphone actually support Python?
-
@Doglike-spike I think he basically rewrote parts of the Python language, in order for it to work on iOS. I'm not sure though.
-
Python (at least the main implementation, CPython) is written in C, and Objective-C is a superset of C, which means that C code should compile as Objective-C without modification. The iOS/Pythonista-specific modules like
console
,ui
,location
, etc. are custom extension modules written by omz, they are not available outside Pythonista. -
@omz is it a shared codebase such that we can expect the template to always be up to date with the latest release version of pythonista?
-
@Tizzy Yes, the template is basically a subset of the main app. It would actually be possible to take the PythonistaKit framework out of the App Store version, and build your own template with it (I think @stroughtonsmith has actually done that).
-
Is there a way to access the 'normal' documents folder of the app from within (for accessing via iTunes file share after allowing in info.plist)? The 'normal' documents folder of Pythonista seems to be in an appgroup now.
os.path.expanduser('~/Documents') now results in '/private/var/mobile/Containers/Shared/AppGroup/E57F167E-F2F0-488A-A406-C6523F6F01DB/Documents' which is not accessable via iTunes fileshare.
-
No idea about iTunes, but what I use is a program called iExplorer. It allows you to read some files from a connected iOS device, but more importantly you can browse local backups, which also include the AppGroup folder.
-
@dgelessus IOS 8.3 (maybe 8.4, can't remember) made this a lot less useful. Now the app sandbox is not accessible through apps like iExplorer and iFunBox without jailbreak. This means no more going through apps and changing files, nor transferring files that represent game progress between devices.
-
@omz
I'm clearly a bit behind, but I got the template to work - thanks!One thing - I used pickle to store config data in a .dat file. This seems to work while the app is running, but if the app is closed and restarted completely, the config data is reset rather than storing the previous state. Is there a way around this?
-
@chriswilson if you're talking about "running the app" and you mean running it in the Xcode simulator, there won't necessarily be persistent data between sessions because it creates a "virtual" directory where any file modifications in your code are executed, so when you close the simulator's virtual environment, your original files remain intact.
If that's not what you meant, ignore and wait for @omz or someone else to respond,
-
Thanks for your reply @Tizzy
I'm running it on my own phone rather than in the simulator, but as it's in development the same principle might apply I guess. -
@chriswilson in that case, the data should stay persistent between runs of the same build, if you build and install it again, that's not the case. As far as I know you can't count on the data to persist between builds. For example -> build, create file, build, check if file has been created (returns FALSE - it won't exist).
-
@Tizzy
Unfortunately it's not saving and recalling the info even between runs of the same build.