Page 2 of 2

Re: Differences between indigo.Dict and python dict

PostPosted: Wed Aug 19, 2020 9:53 am
by dclonts
OK, maybe a silly question. how do I list all the key/items in an indigo Dict? such as pluginProps.

tried .keys() and .items() and they are blank...

Re: Differences between indigo.Dict and python dict

PostPosted: Wed Aug 19, 2020 1:29 pm
by jay (support)
Hmmm...

Code: Select all
>>> d = indigo.Dict()
>>> d["a"] = 1
>>> d["b"] = 2
>>> d.keys()
[u'a', u'b']
>>> d.values()
[1, 2]
>>> d.items()
[(u'a', 1), (u'b', 2)]


and:

Code: Select all
>>> self.pluginPrefs
<indigo.Dict object at 0x10dfd2668>
>>> print(self.pluginPrefs)
Prefs : (dict)
     bottomLabel :  (string)
     showDebugInfo : false (bool)
     showThreadDebugInfo : false (bool)
     topLabel :  (string)
>>> self.pluginPrefs.keys()
[u'bottomLabel', u'showDebugInfo', u'showThreadDebugInfo', u'topLabel']
>>> self.pluginPrefs.values()
[u'', False, False, u'']
>>> self.pluginPrefs.items()
[(u'bottomLabel', u''), (u'showDebugInfo', False), (u'showThreadDebugInfo', False), (u'topLabel', u'')]


Is it possible that the plugin prefs you're looking for are just empty?

Re: Differences between indigo.Dict and python dict

PostPosted: Sat Aug 22, 2020 8:43 am
by dclonts
So the weirdness is I'm using EasyDaq plugin, heavily modified for my Hayward pool controller.

it should have a ton of pluginProps (channels, etc), but looks like they end up (or maybe start?) in globalProps. would not make sense because the EasyDAQ.py module is all over the pluginProps...

am I missing something between globalProps and pluginProps?

thx

Re: Differences between indigo.Dict and python dict

PostPosted: Sat Aug 22, 2020 8:47 am
by FlyingDiver
pluginPrefs and pluginProps are different things....

Re: Differences between indigo.Dict and python dict

PostPosted: Sat Aug 22, 2020 11:47 am
by matt (support)
Every plugin has its own pluginProps, so if you are executing this from a different plugin than the EasyDAQ plugin or from a script then you won't get the same pluginProps that EasyDAQ has. If that is what you want to access then you can use:

Code: Select all
easydaqProps = dev.globalProps["com.perceptiveautomation.indigoplugin.easydaq-usb-relay-cards"]

Re: Differences between indigo.Dict and python dict

PostPosted: Tue Aug 25, 2020 2:18 pm
by dclonts
ahhh. So i'm debugging my plugin using pycharm remote.

I want to look at the pluginProps of the plugin i'm debugging...but can't use the debug console since its connected to pydev debugger...and can't use the indigo scripting shell because it not in same scope as plugin. not sure there's any console way to look at the plugin.pluginProps. thoughts?

Re: Differences between indigo.Dict and python dict

PostPosted: Tue Aug 25, 2020 3:01 pm
by jay (support)
Put a breakpoint somewhere in your plugin, trip the breakpoint, then inspect it in PyCharm...

Re: Differences between indigo.Dict and python dict

PostPosted: Tue Aug 25, 2020 3:26 pm
by jay (support)
Example: in the NOAA Weather plugin, I set a breakpoint in deviceStartComm method, then used the expression evaluator to cast device.pluginProps to a dict for easy viewing:

pluginProps.png
pluginProps.png (268.91 KiB) Viewed 9346 times


Anywhere you have a device instance (or can get one), you can set a breakpoint and inspect the pluginProps as above.

Re: Differences between indigo.Dict and python dict

PostPosted: Wed Aug 26, 2020 4:18 am
by dclonts
Yup. Did figure that out. Just wanted to make sure I wasn't going crazy...