how to auto-set widget?
- dab77
- Offline
- Elite Member
- Posts: 202
- Thank you received: 2
for example: a meter, used to show jog speed.
i would like that the MAX value for the meter should be taken directly from the traj_max_linear_velocity pin, so whenever i change that speed, i don't have to change all the meters referred to that value by hand.
Is it possible in some way?
thanks, davide.
Please Log in or Create an account to join the conversation.
- mhaberler
- Offline
- Moderator
- Posts: 197
- Thank you received: 11
in the callback handler read the value from the ini file using the emc module, and set the property accordingly
-Michael
Please Log in or Create an account to join the conversation.
- dab77
- Offline
- Elite Member
- Posts: 202
- Thank you received: 2
How can i set that property, if in the widget i can only put a number in a box?
can you help me a little more, please?
Please Log in or Create an account to join the conversation.
- mhaberler
- Offline
- Moderator
- Posts: 197
- Thank you received: 11
actually the realize event isnt needed at all. I'll add that to master.
- Michael
Please Log in or Create an account to join the conversation.
- mhaberler
- Offline
- Moderator
- Posts: 197
- Thank you received: 11
I adapted the example in master to accept a widget property via a HAL pin: git.linuxcnc.org/gitweb?p=emc2.git;a=tre...fa5d6887c0df38fbb178
to run, start axis, and in a second window cd to configs/gladevcp/set-param-from-ini and run:
$ export INI_FILE_NAME=demo.ini
$ gladevcp -u meter_scale.py meter_scale.ui
Then adjust the meter_scale.max-value pin and observe the HAL meter widget,
-Michael
Please Log in or Create an account to join the conversation.
- dab77
- Offline
- Elite Member
- Posts: 202
- Thank you received: 2
i think you got what i meant.
Please Log in or Create an account to join the conversation.
- dab77
- Offline
- Elite Member
- Posts: 202
- Thank you received: 2
sorry, I misread your request - you wanted to set a widget property from a HAL pin, not an INI value
I adapted the example in master to accept a widget property via a HAL pin: git.linuxcnc.org/gitweb?p=emc2.git;a=tre...fa5d6887c0df38fbb178
to run, start axis, and in a second window cd to configs/gladevcp/set-param-from-ini and run:
$ export INI_FILE_NAME=demo.ini
$ gladevcp -u meter_scale.py meter_scale.ui
Then adjust the meter_scale.max-value pin and observe the HAL meter widget,
-Michael
Hi! finally i could spend some time on your suggestion.
Your files work (except it doesn't take the min value from demo.ini..), meaning i can change the max_value using setp into the hal command line, into the 'watch hal config' window.
so i menaged to glue this into my setup, first trying only to change one meter, but i've found out that if i want my gladevcp panel inside the emc2 window, it doesn't create the pin. Maybe because to create that it must have the 'gladevcp' name, and not the name of the python file..?
If i run my setup into a terminal window after running emc2 (like you suggested) it works.
I would like to manage that problem, since i want gladevcp panel inside the same windows.
do you have any suggestion?
thanks, Davide.
Please Log in or Create an account to join the conversation.
- mhaberler
- Offline
- Moderator
- Posts: 197
- Thank you received: 11
mhaberler wrote:
so i menaged to glue this into my setup, first trying only to change one meter, but i've found out that if i want my gladevcp panel inside the emc2 window, it doesn't create the pin. Maybe because to create that it must have the 'gladevcp' name, and not the name of the python file..?
I am fairly sure that the pin is created as gladevcp.max-value pin , since running gladevcp inside
an Axis pane requires the HAL component name 'gladevcp'.
Please investigate the gladevcp component's pins with 'Show HAL configuration'.
If you find it, use that name. Otherwise I'm sure there's an error message which gives some hints as to what happened. If so, post that here.
- Michael
Please Log in or Create an account to join the conversation.
- dab77
- Offline
- Elite Member
- Posts: 202
- Thank you received: 2
That's why i'm asking help here, 'cause it seems strange that it didn't create the pin!mhaberler wrote:
I am fairly sure that the pin is created as gladevcp.max-value pin , since running gladevcp inside
an Axis pane requires the HAL component name 'gladevcp'.
Please investigate the gladevcp component's pins with 'Show HAL configuration'.
If you find it, use that name. Otherwise I'm sure there's an error message which gives some hints as to what happened. If so, post that here.
- Michael
now i'll post my files, which work now, but only if i run them after emc2:
then i try again to set them to work inside the emc2 window, and call all the pins gladevcp.xxx...
Please Log in or Create an account to join the conversation.
- dab77
- Offline
- Elite Member
- Posts: 202
- Thank you received: 2
GLADEVCP = -u gladevcp.py gladevcp.ui
using these files:
i have this error:
gladevcp.hal:109: Pin 'gladevcp.max-value1' does not exist
infact, if i don't load my hal file, i can't see the pin:
p.s. another question for you, in the .py file instead of this line:
how can i write directly the name of the file? ..i couldn't..inifile = emc.ini(os.getenv("INI_FILE_NAME"))
thanks, Davide.
Please Log in or Create an account to join the conversation.