omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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

    Pythonista
    9
    594
    181792
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ihf
      ihf last edited by

      @cvp it happened a few times, but now I can't reproduce it reliably so I guess it is not worth spending time on.

      1 Reply Last reply Reply Quote 0
      • cvp
        cvp @ihf last edited by

        @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?

        1 Reply Last reply Reply Quote 0
        • ihf
          ihf last edited by

          @cvp Yes, I would prefer that but now that I know what it is, I could live with it.

          1 Reply Last reply Reply Quote 0
          • cvp
            cvp last edited by

            @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
            
            1 Reply Last reply Reply Quote 0
            • ihf
              ihf last edited by

              @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.

              cvp 3 Replies Last reply Reply Quote 0
              • cvp
                cvp @ihf last edited by

                @ihf

                1 Reply Last reply Reply Quote 0
                • cvp
                  cvp @ihf last edited by cvp

                  @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.

                  1 Reply Last reply Reply Quote 0
                  • ihf
                    ihf last edited by

                    @cvp I am glad to see that you are maintaining a sense of humor. (or at least I hope you are).

                    cvp 1 Reply Last reply Reply Quote 1
                    • cvp
                      cvp @ihf last edited by cvp

                      @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.....

                      1 Reply Last reply Reply Quote 0
                      • cvp
                        cvp last edited by cvp

                        @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

                        1 Reply Last reply Reply Quote 0
                        • JonB
                          JonB @cvp last edited by

                          @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-scrolling

                          You can try beginUpdates() before updating your data (adding or deleting rows) then end updates() after reloading on the tableview ObjCInstance)

                          cvp 1 Reply Last reply Reply Quote 0
                          • cvp
                            cvp @JonB last edited by cvp

                            @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 ...

                            1 Reply Last reply Reply Quote 0
                            • cvp
                              cvp last edited by

                              @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"
                              
                              1 Reply Last reply Reply Quote 0
                              • cvp
                                cvp @ihf last edited by cvp

                                @ihf not sure you had seen the post where there was a new version of Mac script, before new version of outline.py

                                1 Reply Last reply Reply Quote 0
                                • ihf
                                  ihf last edited by

                                  @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.

                                  cvp 4 Replies Last reply Reply Quote 0
                                  • cvp
                                    cvp @ihf last edited by

                                    @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? 😂

                                    1 Reply Last reply Reply Quote 0
                                    • cvp
                                      cvp @ihf last edited by

                                      @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)
                                      
                                      1 Reply Last reply Reply Quote 0
                                      • cvp
                                        cvp @ihf last edited by

                                        @ihf said

                                        A bit simpler, add sort on date to the html page.

                                        Simpler, you say that...

                                        1 Reply Last reply Reply Quote 0
                                        • ihf
                                          ihf last edited by

                                          @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.

                                          1 Reply Last reply Reply Quote 0
                                          • cvp
                                            cvp @ihf last edited by

                                            @ihf said

                                            Now are you ready for potential enhancements?

                                            I never forget the bugs or @JonB 's advices, all is written at top of my source code, but I'm no more motivated a lot to spend time for that. But, for new (realistic) functionalities, always.

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Powered by NodeBB Forums | Contributors