Initialize fields in MenuItem dialog

Posted on
Sat Oct 20, 2018 11:36 am
rbdubz3 offline
User avatar
Posts: 224
Joined: Sep 18, 2016
Location: San Diego, CA

Initialize fields in MenuItem dialog

I am putting together a MenuItem for a plugin. The MenuItem has a main 'list' of values that selected, upon which the dialog loads a number of additional fields. I have most of this working properly. However, I am not sure how to populate the dialog upon initialization, when a user first selects the MenuItem for the plugin..

Here is a quick excerpt from my MenuItems.xml:
Code: Select all
   <MenuItem id="saveScene">
      <Name>Edit Scenes...</Name>
      <CallbackMethod>saveScene</CallbackMethod>
      <ButtonTitle>Save</ButtonTitle>
      <ConfigUI>
         <Field id="sceneId" type="menu" defaultValue="">
            <Label>Scene:</Label>
            <List class="self" method="sceneListGenerator"></List>
            <CallbackMethod>scenesListItemSelected</CallbackMethod>
         </Field>
         <Field id="sceneIdLabel" type="label" alignWithControl="true" fontSize="small" fontColor="darkgray">
            <Label>Select the Scene preset for storing the configuration. Scenes with an asterisk (*) next to them have data already saved in them. Selecting one of these Scenes will overwrite the data saved.</Label>
         </Field>
         <Field id="sceneName" type="textfield" defaultValue="">
            <Label>Scene Name:</Label>
         </Field>
         <Field id="sceneNameLabel" type="label" alignWithControl="true" fontSize="small" fontColor="darkgray">
            <Label>Assign a name to this Scene.</Label>
         </Field>
                       .....
                       .....
      </ConfigUI>
   </MenuItem>


So far, all of the methods are functioning ok - saveScene, sceneListGenerator, and scenesListItemSelected... The logic for populating the 'valuesDict' in the scenesListItemSelected method works fine after the dialog is displayed and I select different items in the main 'Scene' list..

Any tips on how to populate the MenuItem fields upon dialog initialization is appreciated

I automate because I am lazy :D - My Plugins: https://forums.indigodomo.com/viewforum.php?f=309

Posted on
Sat Oct 20, 2018 11:45 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Initialize fields in MenuItem dialog

Take a look at this excellent plugin: Plugin Developer Documenter Plugin

It may help show you what's needed :)

Posted on
Sat Oct 20, 2018 11:50 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Initialize fields in MenuItem dialog

I think you need this:

Code: Select all
def getMenuActionConfigUiValues(self, menuId):
      valuesDict = indigo.Dict()
      errorMsgDict = indigo.Dict()

# fill in the valuesDict here with your pre-fill data

      return (valuesDict, errorMsgDict)

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sun Oct 21, 2018 8:33 am
rbdubz3 offline
User avatar
Posts: 224
Joined: Sep 18, 2016
Location: San Diego, CA

Re: Initialize fields in MenuItem dialog

thanks for the inputs.. the 'getMenuActionConfigUiValues' did the trick.. Guess I missed this in the Indigo documentation somewhere

I automate because I am lazy :D - My Plugins: https://forums.indigodomo.com/viewforum.php?f=309

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests