Menuitems (and other) issues

Posted on
Sun Sep 01, 2019 10:26 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Menuitems (and other) issues

I have run into a couple of unrelated issues. Could be bugs, but more likely cockpit errors.

  1. In a Menuitem ConfigUI I have the following field described
    Code: Select all
    <Field id="multiPlug" type="checkbox" readonly='YES' visibleBindingId="displayOk"  visibleBindingValue="true" >
            <Label>2 or more outlets:</Label>
    </Field>
    It displays, but it is not readonly. That is, the user can still click the checkbox to change the display. There is no action attached, so the effect is only cosmetic. This is happening on all checkbox fields on the UI. But, readonly is properly respected for textfields
  2. I have a callback method that receives a dict, valuesDict. I would like to log the entries in that dict, but when I do
    Code: Select all
    self.logger.info("Device data for %s:\n%s", device, valuesDict)
    I get a dictionary name as the first line of output...
    Code: Select all
      TP-Link Device                  Device data for device:
         UiValuesDict : (dict)
         actionButton :  (string)
         address : 192.168.5.113 (string)
        ...
    This isn't a huge issue since I want to remove some entries and add some labels anyway. But, I was just wondering if there were a way to suppress that first line.
Thanks for any ideas, suggestions, etc.

Posted on
Sun Sep 01, 2019 11:31 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Menuitems (and other) issues

Probably isn't documented, butI believe checkbox control types ignore the readonly attribute. Readonly is only used (Jay correct me if I'm wrong) for the text field control types.

I can help you with the 2nd question though. Indigo uses its own internal/special dictionary type which as you noticed logs (via str()) differently than the python one. In this case you can first cast it to a python dict type if you want its str() formatted result:

Code: Select all
self.logger.info("Device data for %s:\n%s", device, dict(valuesDict))

Image

Posted on
Sun Sep 01, 2019 11:35 am
jay (support) offline
Site Admin
User avatar
Posts: 18219
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Menuitems (and other) issues

I was just replying when I saw Matt's reply. It's either a documentation bug (it should apply to fewer field types than the docs say) or it's a code bug. My spider sense is tingling about this for some reason, so I think this might have come up before. We'll look into it.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sun Sep 01, 2019 11:36 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Menuitems (and other) issues

matt (support) wrote:
Probably isn't documented, butI believe checkbox control types ignore the readonly attribute. Readonly is only used (Jay correct me if I'm wrong) for the text field control types.
I can help you with the 2nd question though. Indigo uses its own internal/special dictionary type which as you noticed logs (via str()) differently than the python one. In this case you can first cast it to a python dict type if you want its str() formatted result:
Code: Select all
self.logger.info("Device data for %s:\n%s", device, dict(valuesDict))

Thanks Matt. BTW, readonly actually IS documented tor checkbox types. The docs say it does support the option. :roll: No big deal either way, I was just curious as to why it didn't work.

Enjoy labor day. You two guys certainly deserve it.

Posted on
Sun Sep 01, 2019 11:38 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Menuitems (and other) issues

jay (support) wrote:
... My spider sense is tingling about this for some reason, so I think this might have come up before. We'll look into it.

Funny, I had a sort of deja vu too. It wouldn't surprise me at all if you do find a previous reference if it was in response to something I posted. :roll: (rolling eyes at myself this time)

Posted on
Sun Sep 01, 2019 11:44 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Menuitems (and other) issues

jay (support) wrote:
...My spider sense is tingling about this for some reason, so I think this might have come up before. We'll look into it.

https://forums.indigodomo.com/viewtopic.php?f=108&t=21409&hilit=checkbox+readonly and I wasn't involved

Posted on
Sun Sep 01, 2019 7:48 pm
jay (support) offline
Site Admin
User avatar
Posts: 18219
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Menuitems (and other) issues

Thought it sounded familiar... :)

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests