There isn't a closedMenuActionConfigUi?

Posted on
Fri Jul 27, 2018 11:29 am
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

There isn't a closedMenuActionConfigUi?

This seems to be missing from the PluginBase, is there a different method that is raised when someone cancels or closes out of a menu action other than the button action? I only see the following methods:

Code: Select all
closedActionConfigUi
closedDeviceConfigUi
closedDeviceFactoryUi
closedEventConfigUi
closedPrefsConfigUi

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Fri Jul 27, 2018 1:15 pm
jay (support) offline
Site Admin
User avatar
Posts: 18185
Joined: Mar 19, 2008
Location: Austin, Texas

Re: There isn't a closedMenuActionConfigUi?

No, because menu actions never validate UI on closure, so neither validate nor closed methods exist for them.

However, I believe that if you specify an actionId for the menu item's ConfigUI (rather than specifying the full UI), the validate method for the action dialog is called. It's possible the closed method is called as well, but I'm less sure about that.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Jul 27, 2018 1:38 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: There isn't a closedMenuActionConfigUi?

jay (support) wrote:
However, I believe that if you specify an actionId for the menu item's ConfigUI (rather than specifying the full UI)

I'm not sure I"m understanding what you mean by that.

But, once I understand what you mean by that, that means that even though validateMenuActionConfigUi doesn't exist here:
Code: Select all
validateActionConfigUi
validateDeviceConfigUi
validateDeviceFactoryUi
validateEventConfigUi
validatePrefsConfigUi
validateSerialPortUi

That it might be calling validateActionConfigUi in its place?

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Fri Jul 27, 2018 4:03 pm
jay (support) offline
Site Admin
User avatar
Posts: 18185
Joined: Mar 19, 2008
Location: Austin, Texas

Re: There isn't a closedMenuActionConfigUi?

Rather than building the whole ConfigUI for a menu, you can optionally specify an Action type ID, and the menu will use that for it's config dialog:

Code: Select all
   <MenuItem id="menu2">
      <Name>Start Timer...</Name>
      <ConfigUI actionId="startTimer"/>
   </MenuItem>


startTimer is an action in Actions.xml that has a config UI. This allows you to publish actions that can also be run interactively from the plugin's menu without having to duplicate code. In that case, the validateActionConfigUi call will be made.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Jul 27, 2018 4:38 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: There isn't a closedMenuActionConfigUi?

jay (support) wrote:
Rather than building the whole ConfigUI for a menu, you can optionally specify an Action type ID, and the menu will use that for it's config dialog:

That's interesting, I didn't know that was possible - a very cool way to provide the functionality in two places without duplicating the code. Can you reference a hidden action in that way without any problems? Honestly I don't want this menu action accessible via actions but want the validate method so if that is what it takes to get it then I'll do that as long as I can hide the action.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Fri Jul 27, 2018 5:00 pm
jay (support) offline
Site Admin
User avatar
Posts: 18185
Joined: Mar 19, 2008
Location: Austin, Texas

Re: There isn't a closedMenuActionConfigUi?

Colorado4Wheeler wrote:
Can you reference a hidden action in that way without any problems?


Probably - give it a try! (I honestly don't know and don't want to dig into the code at the moment)

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Jul 27, 2018 5:03 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: There isn't a closedMenuActionConfigUi?

I'll test it out in the next few days and see what happens. Like you, I don't want to change a bunch of stuff around to test right now ;).

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Mon Mar 18, 2019 7:16 am
DaveL17 offline
User avatar
Posts: 6739
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: There isn't a closedMenuActionConfigUi?

I'm not sure that this is the exact need that C4W was looking for, but I found this thread after I had a similar need to call validation routines from a Menu Item config menu UI. I found that you can also pass back the typical error message dict from the config menu's callback.

Code: Select all
<MenuItem id="test_menu">
    <Name>Test Menu Name</Name>
    <CallbackMethod>test_menu_callback</CallbackMethod>
    <ConfigUI>
        <Field id="field_one" type="menu">
            <Label>Field 1 Label</Label>
            <List>
                <Option value="2">2</Option>
                <Option value="1">1</Option>
            </List>
        </Field>
    </ConfigUI>
    <ButtonTitle>Save</ButtonTitle>
</MenuItem>

Code: Select all
    def test_menu_callback(self, values_dict, menu_id):

        error_msg_dict = indigo.Dict()

        if 1 != 2:
            error_msg_dict['field_one'] = u"This is a test error."
            error_msg_dict['showAlertText'] = u"Test Error.\n\nThis is a test of validation code within a callback."

            return False, values_dict, error_msg_dict

        else:
            return True

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest