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
    181452
    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.
    • 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
                  • ihf
                    ihf last edited by

                    @cvp je comprends que

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

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

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

                        @ihf Version mac_outline_viewer.py V00.05 with

                          V0.05
                            - support sort on dates
                        

                        Even if I 'm sincerely not proud of my quick and dirty script/html/JavaScript and maybe it could be very slow with long outlines, I don't know.

                        Feed-back hoped

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

                          @cvp It works great!

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

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

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

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

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

                                @ihf said

                                how many lines in the outline

                                Yes

                                1 Reply Last reply Reply Quote 0
                                • JonB
                                  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
                                  cell=ui.TableViewCell()
                                  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:

                                  cell=self.cells[section][row]

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

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

                                    @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

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

                                      @cvp My Outline lengths are (up to now) <100 items. I can imagine them being somewhat longer but certainly <<1000.

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

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

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

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

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

                                            @ihf I don't know anything about cgi-bin. Where would be your web server? On a Linux machine, no more on your Mac? Where do you want to store your outline files? No more on iCloud Drive? On a NAS?

                                            Edit: perhaps could a web app read an iCloud calendar, like my Apple Watch shortcut does, get the file and display it...(shared public iCloud Calendar gets an url like webcal://...)

                                            Edit2: perhaps could the outline.py script save a copy of the outline file on your web server, like it also does in the 2022 event.

                                            PS For info, I'm still busy to convert my script for a ScrollView, I must admit that I am slow, for lack of desire/motivation, but I'll do it.

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