[kepler-users] Port parameter like "combo box" - do we have something like this in Kepler

Christopher Brooks cxh at eecs.berkeley.edu
Wed Sep 24 13:27:36 PDT 2014


Hi Michal,

Ok, you want the canvas to display a choice parameter like

order: {7, 8, 9}

instead of

order: 7

One issue is that {7, 8, 9} is an array of three elements in the Ptolemy 
expression language.

There is ptolemy.data.expr.ChoiceParameter, which would be a start.  
However, that parameter has only one constructor, and that constructor 
requires that a class be added.  So, you would need to add a two 
argument constructor and then a way to read in an array and use that as 
its choices.  So, perhaps ChoiceStyle is better.

The next step would be to modify how the canvas shows the parameter.   
Probably the best thing would be to add a new type to the type lattice, 
which was a enumeration type.  This would be quite a bit of work.

Another idea would be find where the canvas shows the parameter and hack 
something in to show the choices if the parameter is a ChoiceParameter.

ptolemy.actor.vergil.icon.ValueIcon is where the parameters are 
displayed on the canvas.

The code calls getExpression(), which would return the value of the 
choice, which would be 7 in this case.

The code would need to be hacked to print something different for the 
ChoiceParameter or ChoiceStyle.

_Christopher


On 9/24/14 12:57 PM, Michal Owsiak wrote:
> Hello Christopher,
>
>> I may be confused here, but doesn't ChoiceStyle do this?
>>
>> http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII8.0/ptII/doc/codeDoc/ptolemy/actor/gui/style/ChoiceStyle.html 
>>
>>
>> (BTW - About dynamic comboboxes, see:
>> https://lists.eecs.berkeley.edu/sympa/arc/ptolemy-hackers/2008-07/msg00010.html) 
>>
>
> This is something I am looking for, I will investigate it further! 
> Thanks for sharing this one.
>
>>
>> $PTII/bin/vergil
>> http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII8.0/ptII/doc/codeDoc/ptolemy/actor/gui/style/ChoiceStyle.html 
>>
>> uses it in the AudioCapture actor:
>>
>
> When it comes to your sample file. In your png file, take a look at 
> "orred" parameter on the right to SDF director. This is exactly the 
> place I want to have values {7, 8, 9 } instead of just 7.
>
> And I want to make sure that user will be able to choose from 
> predefined list instead of being forced to type the value.
>
> Cheers
>
> Michal
>
>
>>
>>
>>
>> SoundSpectrum.xml contains:
>>> <entity name="AudioCapture" 
>>> class="ptolemy.actor.lib.javasound.AudioCapture">
>>>         <property name="sampleRate"
>>> class="ptolemy.actor.parameters.SharedParameter" value="8000">
>>>             <property name="style" 
>>> class="ptolemy.actor.gui.style.ChoiceStyle">
>>>                 <property name="8000"
>>> class="ptolemy.kernel.util.StringAttribute" value="8000">
>>>                 </property>
>>>                 <property name="11025"
>>> class="ptolemy.kernel.util.StringAttribute" value="11025">
>>>                 </property>
>>>                 <property name="22050"
>>> class="ptolemy.kernel.util.StringAttribute" value="22050">
>>>                 </property>
>>>                 <property name="44100"
>>> class="ptolemy.kernel.util.StringAttribute" value="44100">
>>>                 </property>
>>>                 <property name="48000"
>>> class="ptolemy.kernel.util.StringAttribute" value="48000">
>>>                 </property>
>>>             </property>
>>>         </property>
>> The way this appears in the model is that
>> $PTII/ptolemy/actor/lib/javasound/javasound.xml has similar code so 
>> that in
>> Vergil, when the actor is dragged in, the choices appear.
>>
>> I'm not sure how this would work in Kepler.
>>
>> _Christopher
>>
>> On 9/24/14 11:36 AM, Ben Leinfelder wrote:
>>> Hi Michal,
>>> For use at runtime, you can present a combobox dialog that prompts 
>>> for a selection and then outputs the selected value. Take a look at 
>>> the Python examples distributed with Kepler to see if this will be 
>>> useful for you.
>>> -ben
>>>
>>> On Sep 24, 2014, at 11:28 AM, Michal 
>>> Owsiak<michal.owsiak at man.poznan.pl>  wrote:
>>>
>>>> Hello Kepler team,
>>>>
>>>> I am looking for something that resembles combo box inside workflow.
>>>>
>>>> The idea here is that I define the parameter with values: {"a", 
>>>> "b", "c" } and then, I choose from one of these by right-click or 
>>>> click.
>>>>
>>>> Question here is. Do we have something like this in Kepler.
>>>>
>>>> Our approach, now, follows:
>>>>
>>>> a = "some value"
>>>> b = "some value b"
>>>> c = "some completely different value"
>>>> actual_parameter = a|b|c
>>>>
>>>> This way, we can determine the value of the parameter while still 
>>>> making everything pretty much consistent.
>>>>
>>>> However, this requires to edit the value and requires numerous 
>>>> parameters on canvas. If you have few of them with lots of options 
>>>> they can consume most of the workflow canvas.
>>>>
>>>> So, question is: do we have some sort of combo box as parameter 
>>>> inside Kepler.
>>>>
>>>> Thanks for the info
>>>>
>>>> Michal
>>>>
>>>> -- 
>>>> Michal Owsiak<michal.owsiak at man.poznan.pl>
>>>>
>>>> Institute of Bioorganic Chemistry PAS
>>>> Poznan Supercomputing and Networking Center
>>>> Noskowskiego 12/14, 61-704 Poznan, POLAND
>>>>
>>>> Phone: 00 48 61 858 21 81
>>>>
>>>> http://www.man.poznan.pl
>>>> _______________________________________________
>>>> Kepler-users mailing list
>>>> Kepler-users at kepler-project.org
>>>> http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users
>>> _______________________________________________
>>> Kepler-users mailing list
>>> Kepler-users at kepler-project.org
>>> http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users
>>
>>
>> -- 
>> Christopher Brooks, PMP                       University of California
>> Academic Program Manager & Software Engineer  US Mail: 337 Cory Hall
>> CHESS/iCyPhy/Ptolemy/TerraSwarm               Berkeley, CA 94720-1774
>> cxh at eecs.berkeley.edu, 707.332.0670           (Office: 545Q Cory)
>>
>>
>>
>> _______________________________________________
>> Kepler-users mailing list
>> Kepler-users at kepler-project.org
>> http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users
>>
>
> _______________________________________________
> Kepler-users mailing list
> Kepler-users at kepler-project.org
> http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users


-- 
Christopher Brooks, PMP                       University of California
Academic Program Manager & Software Engineer  US Mail: 337 Cory Hall
CHESS/iCyPhy/Ptolemy/TerraSwarm               Berkeley, CA 94720-1774
cxh at eecs.berkeley.edu, 707.332.0670           (Office: 545Q Cory)



More information about the Kepler-users mailing list