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
    589
    180510
    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 @cvp last edited by cvp

      @ihf Instead of printing the outline file in the console, I could create a local html file with the outline content and open a new tab in Safari showing this html, but it is a little bit more complex. And surely if we want to include the images in the html...

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

        https://brew.sh is the essential tool for macOS.

        brew install python

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

          @ccc Far from me to critic any Mac software , but, sincerely, I stopped to use my Mac some years ago and I have programmed all what I needed on my iPad in Pythonista, Shortcuts, Scriptable, IFTTT.
          It is only when @ihf asked this last feature that I powered my Mac on. I don't want to spend more time to learn something new, but thanks for the info, as usual.

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

            @cvp I tried the viewer script. It worked fine on the first outline I tried but the second gave:

            Traceback (most recent call last):
              File "/Users/ihf/Desktop/outline_viewer.py", line 48, in <module>
                sys.exit(main())
              File "/Users/ihf/Desktop/outline_viewer.py", line 42, in main
                print(f"{RED}{outline} {BLUE}{text}")
            UnicodeEncodeError: 'ascii' codec can't encode character '\u2019' in position 27: ordinal not in range(128)
            
            

            It would be helpful if a path to the Outline could optionally be passed to the script rather than requiring the selection each time.

            As far as rendering in html, that would be useful if there are images and more elegant than using the console but at least I can see the outlines on the Mac.

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

              @ihf Since IOS 15, I have a lot of problems with a lot of apps, including Pythonista and Pyto, obliging me to restart my iPad. They stay hanging even if restart from Safari or in safe mode for Pythonista.
              I program the script on my iPad, in Pythonista with the script open as external on the Mac via the Files app. And if Pythonista hangs, I can't do anything.
              I guess this encode problem comes from a special character in the file, not accepted by the print.

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

                @ihf How do you call the script with argument?

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

                  @cvp outline_viewer path_to_file

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

                    @ihf thus in terminal? I used in double clicking it in Finder

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

                      @ihf see V00.01 of mac_outline_viewer

                      You can pass as argument the entire path of the outline file, relative versus folder of script it-self.

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

                        @ihf see V00.02 of mac_outline_viewer with

                          V0.02
                            - runs on Mac and in Pythonista on iPad/iPhone
                            - generates a web page (without images, font attributes, links...)
                            - opens a new tab in Safari to display the html
                        

                        As I don't know a lot about html/css, I don't see how I could make this script better so the html would support images (at left/right/...), font attributes, links and so on...

                        I wonder if the ideal would not be that the outline program generates a .pdf each time an .outline file is "finished", either when the program is closed, or when the option "new" creates a new one,

                        the mac_outline_viewer program would then allow you to choose a .pdf to display.

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

                          @ihf Are you interested by viewing your outlines (text) on your Apple Watch (if you have one as I think )?
                          If yes, I've found a way (after hours of tests), not yet programmed but feasible.
                          The outline.py program could, at each save, create/update the notes field (if accessible as I hope, but not sure, see here) of a contact named as
                          first name = outline
                          last name = file name (without the yyyymmdd_hhmmss part)
                          You would need to run a shortcut on your Apple Watch, shortcut as:

                          • show a list of contacts with first name = outline
                          • you select one in the list
                          • get notes
                          • quick look of notes

                          It seems that from IOS 13, notes field of contact is no more available to apps.
                          Thus, my solution would not work.
                          I'll try to use notes fields of calendar events, for instance in a specific calendar...
                          Tried (not in outline.py) and ok
                          Concept is to store it in an area readable by Apple Watch shortcut and shared on all Idevices

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

                            @ihf please give me news about the Mac script and the Apple Watch proposal

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

                              @cvp Sorry for the delay in replying. I am away from home this week and had some network issues yesterday. I will try to test the Mac script later today. As to the watch, that would be a great addition. I think I would use DataJar for this purpose. I have to look at how Pythonista could add values though.

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

                                @ihf oups, sorry to have insisted, no urgence at all.
                                don't know datajar, if you find a way that Pythonista could use it to update such a file, tell me.

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

                                  @ihf the only way I actually see to update the Data Jar database is via a shortcut, not via a Python script. Thus, I don't see how it could help you to store the ouTline data.

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

                                    @cvp Yes but you can do this:

                                    import shortcuts
                                    shortcuts.open_shortcuts_app(name="dj",shortcut_input="Hello World" 
                                    

                                    The Shortcut looks like this: https://www.icloud.com/shortcuts/a944a4779c0c4c71861a402cb6b6a138

                                    Then it is easy to get to Datajar values from a shortcut that is run on the watch.

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

                                      @ihf Did you try it? That will say that at each save of an outline file, I should run a shortcut, passing the text part of the outline? Agree?

                                      To be compared to update a calendar event (fixed date, title = outline name) with its notes field = outline text part. And shortcut on Apple watch can show a list of all such events, user select one and show the text.

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

                                        @cvp Yes I tested saving text from Pythonista to Data Jar. However, your idea of using the calendar may turn out to perform better as it does not depend on a 3rd party app. Also, depending on the formatting, the calendar route might offer a way to see an outline on the Mac. (There is a DataJar for the Mac in beta but I have not tried it).

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

                                          @ihf I guess that is possible on Mac to read calendars, but I don't know how in Python (quid about Two-factor authentication?).

                                          But is my script on Mac not sufficient? Read the outline file is not better?

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

                                            @cvp Reading the outline with Python is better although having it in the calendar as you suggested would also make it readable on the watch as well as on the Mac without any additional programs. I’m just not sure how usable it will be on the Watch given the display limitations and the inability to check off outline items. I’m happy to try it, if you implement it (either with Datajar or the calendar).

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