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.


    Editor observations

    Pythonista
    editor
    2
    9
    5997
    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.
    • Phuket2
      Phuket2 last edited by Phuket2

      @omz, it would be nice if editor.open_file(name) could open in a new tab instead of the active tab when called from the tools menu.

      The documentation for this method is a bit misleading for me. When I read it I was under the impression I could not pass a absolute file spec as a param, but I could.

      Help text:
      editor.open_file(name)
      Open the file with the given name in the editor.

      name is just a file name of a script in the library, not an absolute path.

      The .py extension can be omitted. The file that is currently open in the editor will automatically be saved.

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

        Thanks, that documentation seems to be totally outdated (I think I wrote that before Pythonista even supported creating folders).

        Phuket2 1 Reply Last reply Reply Quote 0
        • Phuket2
          Phuket2 @omz last edited by

          @omz , is the editor module written in Python? I have been trying to find in the Standard library folder, but can't see it

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

            No, it's written entirely in (Objective-)C, though it would be possible to replace it with something based on objc_util.

            Phuket2 1 Reply Last reply Reply Quote 0
            • Phuket2
              Phuket2 @omz last edited by

              @omz , it's ok. As you mentioned the docs were out of date, was going to look at it and see what new stuff was in there.

              1 Reply Last reply Reply Quote 1
              • omz
                omz last edited by

                There is actually a new thing. editor.open_file() can take two additional (optional) boolean parameters: editor.open_file(file_path[, new_tab, force_reload]). The new_tab parameter should be self-explanatory. force_reload only has an effect when new_tab is False, and the given file is already open in the current tab.

                Phuket2 1 Reply Last reply Reply Quote 1
                • Phuket2
                  Phuket2 @omz last edited by

                  @omz , thanks. They are not named args though. They are positional args. But it works.

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

                    Yeah, I tend to be a bit lazy with keyword args in C code, I always forget the correct way to parse them… Positional args are a bit easier for me, though I'm trying to improve support for keyword args in new code, especially for functions that take lots of parameters.

                    Phuket2 1 Reply Last reply Reply Quote 0
                    • Phuket2
                      Phuket2 @omz last edited by

                      @omz , LOL. Now I understand the ui interface a little bit better. You need a holiday. I know you don't need the virtues of a consistent prototype interface preached to you, however it does make life a hell of a lot easier for the rest of us 😎
                      Regardless, they are still small things. Like Apple, for the 1 thing that is that not 100% correct, you have done 1,000 correct and better than correct.

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