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.


    [share code] How to programatically control the editor actions

    Pythonista
    wrench action
    3
    6
    4836
    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.
    • JonB
      JonB last edited by JonB

      https://gist.github.com/c9f42c81c53b276b6560
      I stumbled across the NSUserDefaults (omz had used it for the theme editor) and noticed editor actions are there. Here is a set of utilities for adding or removing editor actions, programatically. (for instance, i am going to put in a pull request for stash to self install an editor action).

      especially useful since deleting an action through the menu seems to crash on my device anyway. Also, since you cannot tell the path from the action menu, this lets you check which copy of a script you are using.

      1 Reply Last reply Reply Quote 3
      • ywangd
        ywangd last edited by

        Is it possible to programmatically add an action with arguments?

        It seems to me that the UI for adding arguments is currently bugged in 2.0. You can add arguments, but they are NOT saved once you click "Done". It would be great to have a fix with your script.

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

          Unfortunately, i don't know the key name for the arguments, since they are not being saved in 2.0 (anyone still have the beta? we could check there)

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

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • JonB
              JonB last edited by

              updated for beta 20100 with arguments

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

                @JonB Thanks for the update.

                It seems to me that an extra parameter is needed for function add_action to actually allow user specified arguments like the follows:

                def add_action(scriptName,iconName='python',iconColor='',title='', arguments=None):
                

                I tested and it worked with 2.0.

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