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.
Outliner with drag/drop reordering - part 2
-
... yes, it was git:
def refresh_editor(): #reload current file in editor # TODO: only reload if the file was recently updated... try: sel = editor.get_selection() editor.open_file(editor.get_path()) import time time.sleep(0.5) #let the file load editor.replace_text(sel[0], sel[0], '') #force scroll editor.set_selection(sel[0], sel[1]) except: print('Could not refresh editor. continuing anyway')
I think I determined the issue only happens for the current tab -- any background tabs get checked and reloaded if needed already.
I'm not proud of that
sleep
, I'm sure there is another way to check state of the load, but I never dug into it. -
-
You can always force a crash if you want to restart pythonista.
-
@JonB os.abort?
-
Yes, abort.
Maybe paired with a notification set for a few seconds in the future to relaunch the app. At least takes that one variable out of the equation!
Or, your new code could have some indication that classes have been updated (like an objc class version separate from main script version), in which case, if classes have been updated, you would abort, otherwise could even relaunch the script.
-
@JonB thanks for your help, I have a lot to think about.
First, I think you did find the reason why it does not work if when you terminate a script in an edited tab, it rewrites it-self... -
@JonB said
Yes, abort. Maybe paired with a notification set for a few seconds in the future to relaunch the app. At least takes that one variable out of the equation!
I like it, thanks
-
@cvp Just to be clear, I only have one copy of the outline.py and, yes ,it is being run from the tab in both cases yet on one iPad it works and the other it fails.
-
@ihf Even with the advices of @JonB , I don't understand this difference...
What I will do, I think, but tomorrow because I have a big request of a neighbor for whom I have programmed also a big program (8248 lines, yours is only 5681), is:
- download from GitHub
- close tab if program runs in a edited tab (to avoid that script end saves the script in the file, replacing the downloaded one)
- abort the program, and thus Pythonista it-self
- try to create a notification for the user, one minute later, to allow him to restart Pythonista and the script (to be tested)
-
@ihf V01.22 and outline.versions with
Version V01.22 - when a new version is available, if user accepts to install it, this version will be installed, then Pythonista will abort to avoid the current edited version to be written and thus replace the new version
This new version only contains thus a supplementary
os.abort()
to force Pythonista to abort and to avoid that current running script, when it ends, saves it-self and thus erases the newly downloaded version. If it works correctly on all your devices, please thanks @JonB for his advice.To test (on all your devices) this, you can wait for the next version, or you can, after manually or automatically having downloaded this version, modify the line
Version = 'V01.22'
into
Version = 'V01.21
and run it, to force the script to believe it is of previous version.
After Pythonista abort, rerun the script and check its version, if it's V01.22, then all is ok.
Of course, I could also generate a notification appearing one minute later asking you to tap it to start Pythonista and the script. Please, tell me if this functionality could help you.
-
@cvp I tested as you suggested on the iPad which was having the problem with downloading the new releases and it worked. Not sure why this works since I had tried (on previous releases) to force quit Pythonista and restart it only to have it try to download the new release again, but happy to have it working now.
-
@ihf said
Not sure why this works since I had tried (on previous releases) to force quit Pythonista and restart it only to have it try to download the new release again
Perhaps did you force quit Pythonista after end of the script, which saves the script on file, even if not changed, it seems.
-
@cvp what is puzzling, but probably not worth pursuing, is why I get different behavior on the two iPads even though I’m doing exactly the same thing. In any case, it works now.
-
@ihf Life (and my programs 😂) always have a bit of a mystery
-
@ihf do you want a version that, just before the Pythonista abort, creates a local notification which should appear some seconds later. Tapping on this notification will automatically restart outline.py
-
Do some of you use outliner on iPhone?
On my iPhone 12 mini the application crashes when I create new entries continuously. Sooner or later an error appears (see Screenshot).
On my ipad 2020 the Problem does not occur. I use version 1.22.
-
@Bambla Unfortunately, not reproducible. Please, restart Pythonista itself and retry, sorry for you.
-
@Bambla I use outline on my iPhone and iPad all the time. I haven’t seen that problem .
-
@cvp I haven't tested it, but it looks like
https://github.com/andy-landy/traceback_with_variables
Should work with pythonista.This might provide some more useful tracebacks -- that traceback implies that kwargs got stomped on somehow. It could be useful to know what it was stomped with.
-
Thanks for the feedback. As soon as I find out more I will post it here.