• donnieh

    @mikael Understood. Thanks for the useful and helpful information!

    posted in Pythonista read more
  • donnieh

    @mikael wow good to know. What do I have to do to run github code right in Pythonista? I never used GitHub and will have to quickly learn.

    posted in Pythonista read more
  • donnieh

    Hi there. If you have a iPhone 4S, the latest OS is iOS 9.3.6. iCloud Drive support on there is old and shady. The iPhone 6S is a little outdated but should be fine.

    However on a new device Pythonista doesn’t behave with iCloud Drive so great. I run my projects right out of the iCloud drive folder to keep things safe. I learned sometimes my project won’t load and the app will lock up because the iCloud-Pythonista syncing is very slow.

    For the most part all works good. You have to have good hardware to run Pythonista well.

    posted in Pythonista read more
  • donnieh

    @henryaukc For option 3, main.py could maybe be:

    import myapp
    myapp.run()
    

    This is what the user would see if they ended up at the code editor. It is basically calling your app as a module. It is not a good solution but they will not easily be able to edit your code if the script stops. It there is an error with an input, Pythonista may bring the user to the source code though :(

    posted in Pythonista read more
  • donnieh

    @henryaukc To present a view without the x button, use the hide_title_bar=True parameter.

    View.present(hide_title_bar=True)
    

    Swipe down with 2 fingers to kill the script.

    posted in Pythonista read more
  • donnieh

    @henryaukc I know you cannot go to the home screen from a script, but I have done both of the below methods.

    1. Just call another app using the url scheme. For example, you could call the settings app. It doesn't get you home but it exits the app.

    2. I have called a script before from my main script( the App ) where the called script was designed to crash pythonista. (Cringing is expected). It is such a dirty way, but it brought me to the home screen instantly when I needed. You can also open Safari with a bogus URL and get it to crash, leaving you at the home screen. Obviously these options are grabbing at straws but I'd thought I would share.

    posted in Pythonista read more
  • donnieh

    Hello. I have a couple simple apps on the app store (https://itunes.apple.com/al/developer/donnie-herman/id837266303) and more on the way, so I may be able to offer some information about your options. I provided 3 options I know of, starting with the most elegant method moving to the least elegant method. Method 1 and 2 require a Mac.

    1. Publish on App store. Create an iOS developer account and publish the app through Xcode. The App store requires a $99/year fee. You can submit apps there free for download, even if it has a limited user base. It requires some time to get all the icons and description Apple worthy, but it is smooth sailing after that. Apple will reject it if it has no lasting value for the customer. However, if it is presented as a tool, Apple will not be so strong on the criticism as it is hard to gauge if it is functional value or not. Once on the App store, it will require some maintenance over time as iOS updates. App store apps should be updated at least once a year by compiling under the latest Xcode. You can also distribute the app via TestFlight and share a download link. You do not need to have it approved on the app store for Test flight, but will still have to pay $99/yr.

    2. Manually install the app on the device. If you can physically hold the device in your hand, you can do the following.

    • Run your Pythonista app in Xcode using @omz's Xcode template.
    • You can test your app using the iPhone simulator or by plugging in the device.
    • In this case plug in your family members phone or iPad to a MAC and run Xcode pointing to that plugged in device. The app will install on their phone and will work just like an App store app. You can disconnect the phone and that family member is set run the app anytime like normal.

    Be aware that this app will not be updated or supported in any way, but only by manually installing via Xcode. It is possible an iOS update can break your app because the python APIs can become deprecated, and a app reinstall will be needed. Right now I have a bunch of real apps on my phone written in pythonista that I installed via Xcode. A great way to run unauthorized Apps.

    1. Create a Pythonista script shortcut on the home screen or use the URL scheme. This is what @Phuket2 mentioned but I have done a twist on this to prevent exposing the code for accidental editing. One thing I do is I run the main program as a module, and call it will a different .py file. So if the user gets brought to Pythonista code editor, they only see the module being called and not the source code.

    Good luck!

    posted in Pythonista read more
  • donnieh

    Ok, I have some more information about this. It happened again last night, but it didn't require changing the font setting. I switched back and forth between my main.py file and the documentation tab. When I return back to the .py file it updated the editor text with code that was about 5 min old.

    I immediately cut all my internet (airplane mode within 1 second) so no further iCloud syncing could happen. My internet was on 3G so syncing was slow-ish.

    I then download Pythonista to another iOS device and allowed iCloud to sync the files it had. Wouldn't you know!? The iCloud version was the 5 minute old file!

    I am wondering if the Pythonista editor refreshes the current editor text with the iCloud version .py file even if it is older or not fully synced. I am not sure if my assumption is truly correct, but I wanted to share this issue. Maybe it is something I am doing wrong.... I believe this issue is isolated to the iCloud folder. I never seen this until I moved my project to from the phone folder to the iCloud folder.

    For now, I just added the following code to my project so it archives everytime I run.

    
    # Back up script to text file before running
    import editor
    import datetime
    st = editor.get_text() # script text
    dt = str(datetime.datetime.now())
    f = open('Backup '+ dt, "w+")
    f.write(st)
    f.close()
    
    
    # my script below...
    
    ​```

    posted in Pythonista read more
  • donnieh

    I am pretty sure my code is gone. If it can't be retrieved, at least this bug can be fixed so it doesn't happen again.

    posted in Pythonista read more
  • donnieh

    I am deep into a pythonista project saved in the iCloud folder. The code was a few hundred lines long so I went to the gear icon to reduce the editor font size. I changed it from 12 to 10 to see more code on my iPhone.

    Then went I went back to the main file and the editor updated the code to the new font size by flashing the screen, but I noticed it also overwritten my code with old code from 2 days ago. A lock icon showed up at the top but doesn't anymore.

    1. Why would changing the font size erase my latest changes from the last 2 days?
    2. Is there any back up in the app somewhere or some cache or something? I want to find this code it just erased.

    I am very discouraged about this and feel like shelving my project because my best work and solutions were made over the last 48 hours.

    posted in Pythonista read more
  • donnieh

    So is this template still functioning with the latest Xcode?

    posted in Pythonista read more
  • donnieh

    Hi all. I have read through the forums regarding the Xcode template and I am concerned about using Pythonista for App Store submissions. Can anyone provide an update to the 2018 status?

    I may be wrong but this is my current understanding...

    • Apps written in python 3 cannot be posted to the App Store because that template doesn’t exists.

    • Apps written in 2.7 work with old template but have had a few issues.

    Is there some light anyone can shine on the Xcode template situation so we all can know what to expect? Has anyone submitted to App Store recently? If so, under what circumstances? I’d hate to spend 6 months of code development and hopes to publish on the App Store be crushed because the way I chose was not yet supported.

    Here me out: If Pythonista’s web page and website mention creating real Apps for the App Store, and there is only a narrow path to allow it, it should be outlined somewhere.

    Thanks for you taking the time to reply if you do. I’m about to send my first 2.7 app to the App Store and I am trying to learn where the template stands and what I am to expect.

    • Donnie

    posted in Pythonista read more
  • donnieh

    Adding @ui.in_background before the method(s) fixed it!

    I used @ui.in_background before but I was threw off by it working, then not working out of nowhere.

    posted in Pythonista read more
  • donnieh

    Does it on iPhone 6S and 7 too. Definitely iOS related. Dialogs is definitely broke, but not sure why it works for some people.

    posted in Pythonista read more
  • donnieh

    @omz Fair enough. Here is my exact code...

    class Home_page:
        def __init__(self):
            pass
            
        def Info_tap(self, sender=None):
            dialogs.alert('Opamp Pro v1.0', '\nA circuit rich design calculator for iOS.\n\nDonnie Herman, 2016-2017 \nWestern NY','OK', hide_cancel_button=True)```
    
    If you send me an email, I will reply with entire source code. (I don’t want to post all my code here)

    posted in Pythonista read more
  • donnieh

    For example, this will freeze up...

    dialogs.alert('hello world', 'test', 'Ok', hide_cancel_button=True)
    

    posted in Pythonista read more
  • donnieh

    I do not believe this is related to iPhone X, but iOS 11. I have an iPhone 6 Plus. Once I updated to iOS11, dialogs.alert() broke (and other related dialogs). I know this because I updated to iOS 11 in the middle of this code development and noticed it immediately.

    You can have a simple message alert with an Ok button. Once the message comes up, I have to force quit Pythonista because the Ok button is not "clickable". It doesn't even highlight when touched. So it appears the app freezes, but not sure.

    posted in Pythonista read more
  • donnieh

    In Xcode, if I begin a new Obj-C project I usually can find a "memory warning" method that gets called if needed, so I can dump resources.

    Is there a way to monitor low memory with Pythonista? Maybe with objc_util?

    posted in Pythonista read more
  • donnieh

    @mikael Yeah, because the label background matches the view background. Not always useful when the background color and and label background are different colors.

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!