Differences between indigo.Dict and python dict

Posted on
Wed Aug 19, 2020 9:53 am
dclonts offline
Posts: 49
Joined: Nov 05, 2006

Re: Differences between indigo.Dict and python dict

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...

David Clonts

Posted on
Wed Aug 19, 2020 1:29 pm
jay (support) offline
Site Admin
User avatar
Posts: 16767
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Differences between indigo.Dict and python dict

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?

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Aug 22, 2020 8:43 am
dclonts offline
Posts: 49
Joined: Nov 05, 2006

Re: Differences between indigo.Dict and python dict

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

David Clonts

Posted on
Sat Aug 22, 2020 8:47 am
FlyingDiver offline
User avatar
Posts: 5305
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Differences between indigo.Dict and python dict

pluginPrefs and pluginProps are different things....

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

Posted on
Sat Aug 22, 2020 11:47 am
matt (support) offline
Site Admin
User avatar
Posts: 20538
Joined: Jan 27, 2003
Location: Texas

Re: Differences between indigo.Dict and python dict

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"]

Image

Posted on
Tue Aug 25, 2020 2:18 pm
dclonts offline
Posts: 49
Joined: Nov 05, 2006

Re: Differences between indigo.Dict and python dict

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?

David Clonts

Posted on
Tue Aug 25, 2020 3:01 pm
jay (support) offline
Site Admin
User avatar
Posts: 16767
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Differences between indigo.Dict and python dict

Put a breakpoint somewhere in your plugin, trip the breakpoint, then inspect it in PyCharm...

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Aug 25, 2020 3:26 pm
jay (support) offline
Site Admin
User avatar
Posts: 16767
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Differences between indigo.Dict and python dict

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 2065 times


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

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Aug 26, 2020 4:18 am
dclonts offline
Posts: 49
Joined: Nov 05, 2006

Re: Differences between indigo.Dict and python dict

Yup. Did figure that out. Just wanted to make sure I wasn't going crazy...

David Clonts

Who is online

Users browsing this forum: No registered users and 2 guests

cron