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.24 and outline.versions with
Version V01.24 - correction of bug "sometimes after view dates, back and hit Expand All and the top line of icons is (mostly) gone"
@ihf not sure you had seen the post where there was a new version of Mac script, before new version of outline.py
@cvp I was just now testing it. I changed the line that had your path in it to: default_path = os.path.expanduser('~/Desktop/Pythonista/Backup/Outline')
I couldn't get it to work at first. Not sure what the problem was but I ended up with Firefox being frozen and I restarted it and now the script seems to work fine.In my case, it opens Safari but then the outline html file is opened (by default) in Firefox. It never actually uses Safari. Now are you ready for potential enhancements? The ultimate "enhancement" would be a complete rewrite so that the full outline runs as a webapp (no Pythonista)...LOL. A bit simpler, add sort on date to the html page.
The ultimate "enhancement" would be a complete rewrite so that the full outline runs as a webapp (no Pythonista)
Did you become crazy? 😂
@ihf on Mac OS, I do
os.system("open /Applications/Safari.app file:///"+os.getcwd()+"/"+fname)
Then, I don't see how you could open Firefox.
On iOS, I do
webbrowser.open('safari-http://localhost:' + port)
A bit simpler, add sort on date to the html page.
Simpler, you say that...
@cvp The script opens Safari but then when it actually opens the .html file my config must be defaulting to opening a tab in Firefox. Yes, rewriting to run in the web was not meant to be a serious proposal although it would have many virtues and to my knowledge does not exist. I will continue to enjoy your creation with the hope that Pythonista keeps running without support from @omz.
@cvp je comprends que
@ihf For instance, I've spent some hours today to try to solve the problem of "the display gets messed up in that lines are overlapping." when sorting dates. But without success.
@ihf Version mac_outline_viewer.py V00.05 with
V0.05 - support sort on dates
@cvp It works great!
@ihf As you know, a TableView does not remember all TableViewCells but rebuilds them when they are visible. If scrolling makes them disappear, their memory is freed and if they reappear, they are built and displayed. It is therefore a saving of memory but a waste of time if the scrolling causes cells to appear and disappear often. But it seems that most of our problems would come from the possible desynchronization between the management of the table of items and their display.
I more and more want to try to replace the TableView with a simple ScrollView where I would manage the position of the rows myself. The cells would be subviews of the scrollview and would only be rebuilt if their content changes.
this solution, for which I cannot yet estimate the development time, would only be valid if your outlines did not contain too many lines (but how many = too many?). Could you tell me approximately how many lines are in your outlines?
And, would you agree to test a different version?
@cvp To answer your last question first, of course, I would be happy to test any future version. As far as how large my outlines are, Were you referring to how many lines in the outline or in a particular item?
how many lines in the outline
JonB last edited by
@cvp Another option is that you can store TableViewCells rather than returning new ones. That way the objc references never change .
Rather than starting cell_for_row with
like normal, you could manage your cells on your own, and build them all in advance, and then in cell_for_row, you simply return the pre-built value:
Since you probably won't have outlines with thousands of rows, that's probably safe memory-wise.
I also wonder if it wouldn't be possible to use one of the omz text view classes (say extending the markdown formatter. ). That would require a lot of swizzling, or at least making implementing subclasses of objc classes that we don't have good documentation on (and just have to rely on swizzlelog to figure out the interfaces) ... so probably is not heading in the right direction...
@JonB that would not solve the problem we had for which you adviced to use begin /end update.
The internal code will still decide to call cell_for_row and perhaps still be désynchronised.
and yet, I followed the omz doc, namely modify my items and call reload for any modification or deletion
Édit: for info, I already stored cell in my own array self.cells, for usage when I'm sure that the row is still on screen, when the TextView in the row is edited
@cvp My Outline lengths are (up to now) <100 items. I can imagine them being somewhat longer but certainly <<1000.
@ihf ok. Thus I'll try to replace the base TableView of rows by a ScrollView. I know that it is not an easy job and that it should take a long time but so, if it works, it should avoid some bugs where invisible code is performed without I can manage it. So, Vital bugs excepted, you would not get new versions during some time...
@cvp I was thinking about whether there was a way to make your mac_outline_viewer work as a cgi-bin so that I could use the web to access outlines (for viewing). The problem I see (so far) is that the selection of the outline file requires access to the iCloud drive and I don't see an easy way to do that from a linux system that runs the webserver. Do you think the storage location of the outline files could (optionally) be another location that linux could access? Or perhaps you can think of another way to achieve access from the web?