SpeedControl widget 100% [solved]

More
19 Jul 2021 15:50 #215327 by AlessandroT
Hello, 

I'm trying to make some customization at gmocappy display. 
I added another "Speedcontrol" widget from gladevcp and I would like to introduce a "100%" button like in the feed override.
The problem is that from hal I can't see parameters or pin to change the value directly to a preferred one. 

Owner   Type  Dir         Value  Name
    53  bit   IN         FALSE  GUI.decrease
    53  bit   IN         FALSE  GUI.increase
    53  float IN            100  GUI.scale
    53  float OUT             1  GUI.scaled-value
    53  float OUT        100  GUI.value


What can be a possible solution?
Attachments:

Please Log in or Create an account to join the conversation.

More
19 Jul 2021 20:54 #215338 by cmorley
Replied by cmorley on topic SpeedControl widget 100%
Unfortunately it can only be changed directly with python code.
I don't think GMoccapy exposes away for users to add python code.
Hopefully Norbert will have advice for you.

Please Log in or Create an account to join the conversation.

More
26 Jul 2021 10:06 - 26 Jul 2021 10:17 #215941 by AlessandroT
I solved, with the following code, where "btn_feed_100" is a GtkButton widget and "extr_scale" is a SpeedControl widget. Thanks


#!/usr/bin/env python
    
import linuxcnc
import os
import hal
import hal_glib

class HandlerClass:

    def on_btn_feed_100_clicked(self,data=None):
        self.extr_scale.set_value(float(100))                 # set the widget value to 100
        self.extr_scale.queue_draw()                            # force a widget redraw

    def __init__(self, halcomp,builder,useropts):
        self.builder = builder

        # hal pin with change callback.
        # When the pin's value changes the callback is executed.

        self.extr_scale = self.builder.get_object('extr_scale')
        self.btn_feed_100 = self.builder.get_object('btn_feed_100')
        
def get_handlers(halcomp,builder,useropts):
    return [HandlerClass(halcomp,builder,useropts)]
Last edit: 26 Jul 2021 10:17 by AlessandroT.

Please Log in or Create an account to join the conversation.

Moderators: newbynobiHansU
Time to create page: 0.189 seconds
Powered by Kunena Forum