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
-
@ihf V01.20 and outline.versions with
Version V01.20 - correction of bug "before the keyboard has appeared a first time, the first edited outline is automatically scrolled up erroneously"
For your information, I get the keyboard height in keyboard_frame_did_change but this function is only called when the keyboard appears. I need to know this height because if you edit a row that would be hidden by the appearing keyboard, the row needs to be automatically scrolled up above the keyboard. But if you edit a row before the keyboard has appeared the first time, this height is not yet known. Thus I force the keyboard to appear and immediately be dismissed without we see it by creating, edit, end, delete a TextField during the general ui.View initialization. Magic, isn't it ?
-
@cvp Thanks for the quick fix to the scrolling problem. The lost insertion point on long lines that i mentioned above also occurs on the iPad in landscape mode.
-
@ihf said
there is a problem when I type a long line (at least on the iPhone in portrait mode). When I get to the right side of the screen, the line is continued on the next line but the insertion point goes away
I've seen that, and also on iPad as you said.
And you added
although the keyboard is still visible
Sure of that? For me, keyboard disappears
-
@cvp I just tested it again on the iPhone and confirmed that the keyboard remains visible although the insertion point disappears.
-
@cvp Probably an old Pythonista problem, but I just started a new outline entered three lines and then hit enter and Pythonista crashed.
-
@ihf said
Probably an old Pythonista problem, but I just started a new outline entered three lines and then hit enter and Pythonista crashed.
Unfortunately, this does not seem to be in my hands
But, anyway, try to check the reason in objc_exception.txt or faultlog folder
-
@ihf V01.21 and outline.versions with
Version V01.21 - correction of bug "when typing a long line automatically splits the line, the keyboard sometimes disappears and cursor is no more visible"
As I can't reproduce your problem (in my case, keyboard disappears), perhaps this correction does not solve your bug (but only mine). Please, give me some feedback
-
@cvp I tested v1.21 on the iPad and the keyboard remained visible (although it seemed to go away and come right back). So that seems to be fixed (I will test on the iPhone). However, I had a different (new?) problem. I added an item and then tried to move it by holding and dragging it. It looked like it was working, but when I released it, I got an error. Here is the traceback:
Traceback (most recent call last): File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 3199, in tableview_cell_for_row v = MyInputAccessoryView(row) File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 476, in __init__ self.width = mv.get_screen_size()[0] # width of keyboard = screen File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 1132, in get_screen_size app = UIApplication.sharedApplication().keyWindow() File "/var/containers/Bundle/Application/8778D1CF-1C08-48BA-9714-9D2CFE524EA1/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 801, in __call__ ordered_args = list(args) + [kwargs[key] for key in kwarg_order] TypeError: 'builtin_function_or_method' object is not iterable
-
@ihf said
Traceback (most recent call last):
File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 3199, in tableview_cell_for_row
v = MyInputAccessoryView(row)
File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 476, in init
self.width = mv.get_screen_size()[0] # width of keyboard = screen
File "/private/var/mobile/Containers/Shared/AppGroup/05D14C00-CCAC-4E98-A3CC-96C6944B8534/Pythonista3/Documents/outline.py", line 1132, in get_screen_size
app = UIApplication.sharedApplication().keyWindow()
File "/var/containers/Bundle/Application/8778D1CF-1C08-48BA-9714-9D2CFE524EA1/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 801, in call
ordered_args = list(args) + [kwargs[key] for key in kwarg_order]
TypeError: 'builtin_function_or_method' object is not iterableI already got that, not reproductible. Not in my code. I personally think that Pythonista has a lot of problems with iOS/ObjectiveC next versions. Sorry for you, but one more time, I think it is not in my hands.
-
@cvp I am not sure what to make of this but I am testing on an iPad and the auto update does not seem to work properly. When I start the script it tells me there is a new version and asks whether I want to update. I say yes and it comes back and says the update was done and to restart the program and I restart it as I do on my other devices. However the update does not seem to take and it goes through the same cycle again. This happened with the previous release and I thought that I would just do a manual update to 1.20 but it is now happening again with 1.21. It’s obviously not a big deal as I can always do the manual update but I thought I would mention it.
-
@ihf said
I am not sure what to make of this but I am testing on an iPad and the auto update does not seem to work properly. When I start the script it tells me there is a new version and asks whether I want to update. I say yes and it comes back and says the update was done and to restart the program and I restart it as I do on my other devices. However the update does not seem to take and it goes through the same cycle again. This happened with the previous release and I thought that I would just do a manual update to 1.20 but it is now happening again with 1.21. It’s obviously not a big deal as I can always do the manual update but I thought I would mention it.
Is your outline.py local or on iCloud, I got tHe same problem, only once, but my script is on iCloud and download from GitHub to iCloud was done but perhaps not yet to your local device.
If your script is in your local Pythonista, was it edited in a Pythonista tab or run from a shortcut?
When you restart, do you remove Pythonista from memory first? If no, not sure Pythonista does not have a cache.It is always better to remove it from memory because if the script changes in some created ObjectiveC classes, they are not replaced without restarting Pythonista it-self.
Are you waiting some time before to restart?
-
@cvp I have 2 iPads and on the old iPad Pro, the auto update always works. (I run Outline.py that is in a tab, it asks if I want to download, I say yes, and I get a message saying the download completed and I restart the program. After I restart I am running the new version (I don't even have to quit Pythonista, just the script). On the newer iPad, I do the same exact thing except that when I restart the program it has not been updated. Weird.
-
@ihf The only difference I could see between your two devices is their speed, if you are running really on the two devices an edited script. I thought you used a shortcut to start the Pythonista script via its url scheme, and in this case you may run a not edited script.
You did not answer if the script is stored in iCloud or in a local folder. If it is in iCloud, the first device which will download the new version from GitHub to an iCloud folder would have done the job for the second device.
Anyway, I would prefer that you don't restart the script without restarting Pythonista it-self becuse, as explained in my previous post, if the new version changes code of a created ObjectiveC class, you need to restart Pythonista to use the updated code. -
@cvp The script is local on both devices and the outlines are on iCloud. On the newer iPad Pro, watch time I run v 1.20 it says that v1.21 is available and then says it is downloaded and after I restart the script, it repeats. Restarting Pythonista does not help.
-
@ihf do you use on your boTh devices the outline.py script in a Pythonista tab or do you use a shortcut to run the script? I could understand that Pythonista has problems to replace an edited running script, although on my iPad I don't have any problem. Sorry, but I am completely in the fog.
My code to replace the running script by a new one is
url = 'https://raw.githubusercontent.com/cvpe/Pythonista-scripts/master/Gists/outline.py' data = requests.get(url).content with open('outline.py', mode='wb') as out_file: out_file.write(data) del data
But if I set an un existing url, the code runs without error and thus does not replace the script.
Perhaps does the problem come from this. -
@cvp the running outline script is in a tab. I had wondered about replacing a running script but it works just fine on the iPhone and the (older) iPad.
-
@ihf said
the running outline script is in a tab. I had wondered about replacing a running script but it works just fine on the iPhone and the (older) iPad.
I'm sincerely sorry, but I don't understand why this difference exists
-
@cvp have you considered using the editor module to make sure the current file isn't open, and close it if it is?
Also, stupid question, but is it possible that @ihf has two copies of the script, and is running the old version? Or a version in site-packages, etc?
Seems like you could also do a check of current file to check if that is the one to replace. -
https://github.com/omz/Pythonista-Issues/issues/510
Also, someone had a cool idea to do this'
https://forum.omz-software.com/topic/5756/close-editor-tab -
@JonB said
have you considered using the editor module to make sure the current file isn't open, and close it if it is?
Also, stupid question, but is it possible that @ihf has two copies of the script, and is running the old version? Or a version in site-packages, etc?
Seems like you could also do a check of current file to check if that is the one to replace.First: you never ask stupid questions, believe me.
A lot of good ideas. I'll think about it. Thursday.
I had also thought to check if new downloaded version was really downloaded, as I saw that a bad url did not give an error to requests line.But that should not explain that it works on all my devices, on two of @ihf and not on his iPad Pro.
Thus perhaps your idea of two versions in this iPad Pro. Normally, my script displays its version at top than he can check the version, even if he has two copies.