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 yes, but the image you posted shows the button as π½, that will say the next tap will give a descending sort, actual is no sort
-
@cvp OK, so the button that shows is not the way it is sorted, but how it would be sorted if you hit the button? Not what I would have expected. However this has just surfaced a different bug. I went back and hit Expand All and the top line of icons is (mostly) gone.
-
@cvp but the sort does work (once I realize that the button is showing what will be not what is).
-
@cvp it happened a few times, but now I can't reproduce it reliably so I guess it is not worth spending time on.
-
@ihf said
the sort does work (once I realize that the button is showing what will be not what is).
Do you prefer that it should show what the sort is?
-
@cvp Yes, I would prefer that but now that I know what it is, I could live with it.
-
@ihf V01.23 and outline.versions with
Version V01.23 - icon of dates sort button now shows the actual sort order, not the order if button would be tapped
-
@cvp If my outline is collapsed and I select view by completion date, and then select sort button to change to sort down, the display gets messed up in that lines are overlapping.
-
-
@ihf said
If my outline is collapsed and I select view by completion date, and then select sort button to change to sort down, the display gets messed up in that lines are overlapping.
It seems that lines after sort keep height of initial order, I don't understand why because I recompute their height in tableview_cell_for_row delegate
Γdit: but I guess that ObjectiveC code of TableView also calls it again. Very annoying.
-
@cvp I am glad to see that you are maintaining a sense of humor. (or at least I hope you are).
-
@ihf said
or at least I hope you are
I also hope it is humor, not instinct
Obviously, I should have to advice: don't collapse, don't sort, don't.....
-
@ihf Version mac_outline_viewer.py V00.04 with
V0.04 - use a dropdown selector to choose which dates to show
Thanks to you, I have had to use my poor JavaScript and HTML5
Feed-back hoped -
@cvp I wonder if updates are not being made on the main thread...
https://stackoverflow.com/questions/2318445/uitableview-crashes-if-data-source-is-updated-during-scrollingYou can try beginUpdates() before updating your data (adding or deleting rows) then end updates() after reloading on the tableview ObjCInstance)
-
@JonB thanks for your continuous help. I remember that I already did something like that, without success.
I would try to incorporate this advice but it not so easy, and obviously no way to correctly test it because the problem is not reproducible on demand.Don't forget that the way I update the TableView is only by modifying directly the items, wiThouT calling delete or add functions. There are a lot of script lines where I update items because there are a lot of ways to do it. And often, the call reload_data is not in the same function. Very annoying to update in your adviced way.
I have tried this beginUpdates before deleting item(s) and enUpdates() after reload_dara, and I get this ObjectiveC error (I remember now I already got it and stopped to use this code)
Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (56) must be equal to the number of rows contained in that section before the update (60), plus or minus the number of rows inserted or deleted from that section (0 inserted, 0 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out). Table view: <SUITableView_PY3: 0x14233d000; baseClass = UITableView; frame =(0 74; 818 1106); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x286c94480>; layer = <CALayer: 0x283c27a00>; contentOffset: {0, 373.5}; contentSize: {818, 2492}; adjustedContentInset: {0, 0, 20, 0}; dataSource: <SUITableView_PY3: 0x14233d000; baseClass = UITableView; frame = (0 74; 818 1106); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x286c94480>; layer = <CALayer: 0x283c27a00>; contentOffset: {0, 373.5}; contentSize: {818, 2492}; adjustedContentInset: {0, 0, 20, 0}; dataSource: <SUITableView_PY3: 0x14233d000>>>
Perhaps due that to delete a row and its children, I rebuild the data_source.items before reload the TableView, without using any call to an eventUal delete function. And, that works always for me, I never have this crash posted by @ihf.
I think next time I write such a program (if ever) I will use a basic scroll view and draw all the necessary objects myself ...
-
@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. -
@ihf said
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)