|
Page 1 of 1
|
[ 12 posts ] |
|
| Author |
Message |
|
berkinet
Joined: Nov 18, 2008 Posts: 1721 Location: Berkeley, CA
|
 HELP!
Ok, this serious non-OO coder is trying to get the hang of the new paradigm. It was going fairly well until I tried to creative a dynamic list in Devices.xml, like: - Code: Select all
<Field id="analog0" type="menu" defaultValue="sensor-0"> <Label>Input 0:</Label> <List> <List class="self" method="phidgetSensorsList" /> </List> </Field>
My method, phidgetSensorsList, is declared in plugin.py as: - Code: Select all
def phidgetSensorsList(self, filter="", ValuesDict="None", typeId="", targetId=0): csvfile = open('/Users/rdp/phidgets-sensors.txt') sensorOptions = [ row.strip().split(',') for row in csvfile] return (sensorOptions)
When I get to the point in the create device dialog where the list is loaded, I get: Error (client) runDialogForDevice() caught exception: Dynamic <List> elements must contain a class attribute. -- filter with no class: (null)The list I am passing in looks like: - Code: Select all
[['sensor-0', ' -- None --'], ['sensor-1', '1101 - IR Distance Adapter'], ['sensor-2', '1102 - IR Reflective Sensor 5mm'], ['sensor-3', '1103 - IR Reflective Sensor 10cm'], ['sensor-4', '1104 - Vibration Sensor'], ['sensor-5', '1105 - Light Sensor'], ['sensor-6', '1106 - Force Sensor'], ['sensor-7', '1107 - Humidity Sensor'], ['sensor-8', '1108 - Magnetic Sensor'], ['sensor-9', '1109 - Rotation Sensor'], ['sensor-10', '1110 - Touch Sensor'], ['sensor-11', '1111 - Motion Sensor'], ['sensor-12', '1112 - Slider 60'], ['sensor-13', '1113 - Mini Joy Stick Sensor'], ['sensor-14', '1114 - Temperature Sensor'], ['sensor-15', '1115 - Pressure Sensor'], ['sensor-16', '1116 - Multi-turn Rotation Sensor'], ['sensor-17', '1117 - Voltage Sensor'], ['sensor-18', '1118 - 50Amp Current Sensor AC+DC'], ['sensor-19', '1119 - 20Amp Current Sensor AC+DC'], ['sensor-20', '1120 - FlexiForce Adapter'], ['sensor-21', '1121 - Voltage Divider'], ['sensor-22', '1122 - 30 Amp Current Sensor AC+DC'], ['sensor-23', '1123 - Precision Voltage Sensor'], ['sensor-24', '1124 - Precision Temperature Sensor'], ['sensor-25', '1125 - Humidity/Temperature Sensor'], ['sensor-26', '1126 - Differential Gas Pressure Sensor'], ['sensor-27', '1127 - Precision Light Sensor'], ['sensor-28', '1128 - MaxBotix EZ-1 Sonar Sensor'], ['sensor-29', '1129 - Touch Sensor'], ['sensor-30', '1130 - pH/ORP Adapter'], ['sensor-31', '1131 - Thin Force Sensor'], ['sensor-32', '1132 - 4-20mA Adapter'], ['sensor-33', '1133 - Sound Sensor'], ['sensor-34', '1134 - Switchable Voltage Divider'], ['sensor-35', '1135 - Precision Voltage Sensor']]
BTW, this works fine if I enter the same text manually into the List definition. I know I am doing something wrong, but, for the life of me, I cannot figure out what.
|
| Tue Oct 25, 2011 6:43 pm |
|
 |
|
matt (support)
Site Admin
Joined: Jan 27, 2003 Posts: 11689 Location: Texas
|
 Re: HELP!
Your Field node has a List inside of a List, so remove the outer most List definition: - Code: Select all
<Field id="analog0" type="menu" defaultValue="sensor-0"> <Label>Input 0:</Label> <List class="self" method="phidgetSensorsList" /> </Field>
_________________
|
| Tue Oct 25, 2011 7:38 pm |
|
 |
|
berkinet
Joined: Nov 18, 2008 Posts: 1721 Location: Berkeley, CA
|
 Re: HELP!
DOH! It's amazing how long I looked at that and just didn't see what was right in front of my eyes.
Thanks Matt.
|
| Tue Oct 25, 2011 8:43 pm |
|
 |
|
berkinet
Joined: Nov 18, 2008 Posts: 1721 Location: Berkeley, CA
|
 Re: HELP!
Moving ahead in tiny steps... My field definition is now: <Field id="analog0" type="menu" defaultValue="sensor-0"> <Label>Input 0:</Label> <List class="self" method="phidgetSensorsList" /> And it seems to generally work as intended, with one exception. The defaultValue is ignored and in its place, the default label of " - no selection - " is used. For this plugin it is ok to not have a selection, but the word "None" is more meaningful, since there is No sensor attached. Is there anyway to alter the default entry/label for dynamic lists?
|
| Tue Oct 25, 2011 9:24 pm |
|
 |
|
jay (support)
Site Admin
Joined: Mar 19, 2008 Posts: 6651 Location: Austin, Texas
|
 Re: HELP!
No way to change it currently. I'll add it to the feature request list.
_________________ Jay (Indigo Support)
|
| Wed Oct 26, 2011 8:39 am |
|
 |
|
nlagaros
Joined: Dec 20, 2010 Posts: 393
|
 Re: HELP!
I see this defaultValue issue is still the case with Indigo 6. Any update on it?
|
| Sat Jan 05, 2013 8:15 am |
|
 |
|
jay (support)
Site Admin
Joined: Mar 19, 2008 Posts: 6651 Location: Austin, Texas
|
 Re: HELP!
Nope - and in all honesty it isn't super high on the list. Do you have an example that might make it a higher priority?
_________________ Jay (Indigo Support)
|
| Sat Jan 05, 2013 1:37 pm |
|
 |
|
nlagaros
Joined: Dec 20, 2010 Posts: 393
|
 Re: HELP!
I have several actions in my Sonos plugin that could benefit from this. For example, I have an action that has 12 lists that allow one to add ZonePlayers to a Group. By default, the Indigo "--no selection--" is selected, it would be convenient for me to use my own "No Selection" option. When I iterate through the inputs, I can look for that one selection, vs. having to check for mine and the Indigo default.
It is not the highest priority by any means - just a convenience thing.
|
| Sat Jan 05, 2013 1:42 pm |
|
 |
|
jay (support)
Site Admin
Joined: Mar 19, 2008 Posts: 6651 Location: Austin, Texas
|
 Re: HELP!
So you have a "No Selection" option as well as the default "- no selection -" option? Just trying to understand a little more clearly.
_________________ Jay (Indigo Support)
|
| Sat Jan 05, 2013 1:55 pm |
|
 |
|
berkinet
Joined: Nov 18, 2008 Posts: 1721 Location: Berkeley, CA
|
 Re: HELP!
I believe the issue here is that while "--No Selection--" represents a null choice, "No Selection" is, in fact, a choice.
|
| Sat Jan 05, 2013 2:10 pm |
|
 |
|
nlagaros
Joined: Dec 20, 2010 Posts: 393
|
 Re: HELP!
If one selects a true menu item and then changes their mind, they will no longer have the option of using the Indigo "--no selection'--". That disappears, so the user would have to create a brand new action if they want to negate that particular menu option. The issue is that the menu selections are optional. In my case, the user can select up to 12.
|
| Sat Jan 05, 2013 2:16 pm |
|
 |
|
jay (support)
Site Admin
Joined: Mar 19, 2008 Posts: 6651 Location: Austin, Texas
|
 Re: HELP!
nlagaros wrote:If one selects a true menu item and then changes their mind, they will no longer have the option of using the Indigo "--no selection'--". That disappears, so the user would have to create a brand new action if they want to negate that particular menu option. The issue is that the menu selections are optional. In my case, the user can select up to 12.
Ah, I see, that makes a lot more sense. Seems like these are the options that would be nice to have on all popup fields: - Specify a default value (tricky on dynamic fields since they are, well, [i]dynamic[/i - should probably allow a flag to select the 1st item regardless of what it is)
- Specify text for a "null" selection (mainly for UI customization)
- Specify if a "null" selection is always available (which would take care of your use case)
I'll think more on this though I'm not sure if we'll get it in to Indigo 6 GM - we'll just have to see.
_________________ Jay (Indigo Support)
|
| Sat Jan 05, 2013 4:48 pm |
|
|
|
Page 1 of 1
|
[ 12 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 1 guest |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|