GLADE BUTTON DECORATION

More
06 Jan 2019 08:06 - 06 Jan 2019 08:07 #123587 by Askjerry
Replied by Askjerry on topic GLADE BUTTON DECORATION
I have learned quite a bit since my last post... I'll have a video coming out in a few days with a really useful panel to display in the center of the AXIS... multiple tab pages, etc.

One thing that I am curious about... when looking at this section of code...
class HandlerClass:
    def __init__(self, halcomp,builder,useropts):

        self.halcomp = halcomp 	# Setup halcomp
        self.builder = builder	# Setup builder
        # self._make_hal_pin()	# Create a hal pin

I see the line self._make_hal_pin() which I believe would allow me to take something other than a button... for example an IMAGE... make it sensitive... and assign it a HALPIN so that I could tie an action to it. If so... I can really make some exciting changes as the image would work like a button to some extent... and NOT need to be rectangular in appearance. (Think rounded triangles for directional controls.)

I created an image and called it test_thing and tried to apply this concept... but it's not working... I'm missing something.

I tried: self._make_hal_pin(test_thing) which didn't throw an error... but nor did it create a gladevcp.test_thing either. :dry:

Next I tried: self._make_hal_pin"(test_thing") and that didn't work either.

So I'm just asking... if I have an image "test-thing"... can I make it behave like a button?? I.E. have a HALPIN that changes between TRUE/FALSE if clicked or not??? If so... I can see some spiffy JOG buttons to start with...

For now... I have some pretty good PROBE buttons/routines added to my layout... and they all work.



...and yes... the Monster Mill is now 5-Axis...

Thanks in advance for your help!
Jerry
2019-01-06
Attachments:
Last edit: 06 Jan 2019 08:07 by Askjerry.

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

More
06 Jan 2019 08:22 #123589 by cmorley
Replied by cmorley on topic GLADE BUTTON DECORATION
self._make_hal_pin() calls:
    def _make_hal_pin(self):
        print("Making hal pin")
        pin = self.halcomp.newpin('count-clicks-out', hal.HAL_S32, hal.HAL_OUT)

        pin = self.halcomp.newpin('pin-in', hal.HAL_S32, hal.HAL_IN)
        hal_glib.GPin(pin).connect('value_changed', self.on_pin_in_changed)

And that is where you make your pins.
This makes two pins: count-clicks-out and pin-in.
pin-in will call the function, self.on_pin_in_changed when the pin changes state.

Chris M

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

More
06 Jan 2019 11:22 - 06 Jan 2019 11:24 #123596 by newbynobi
Replied by newbynobi on topic GLADE BUTTON DECORATION
Hallo Jerry,
Hallo Chris,

please find attached a way I do it. I use a eventbox and place in that one a resized image. The eventbox does react to a button pressed event and will change the info label content.

I create also a hal pin, changing the state will also change the image of the eventbox and update the info label. The button in the glade panel is directly connected to the hal pin in.

Just copy the AskJerry Config to your config folder and start from LinuxCNC master!
All is done in the file AskJerry.py

Norbert

P.S. The images are just a screen shot of my CAD, they are about 750 x 750 Pixel, I do not know, why they are not scaled in both directions, may be because they are placed in a table.
Attachments:
Last edit: 06 Jan 2019 11:24 by newbynobi.

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

Moderators: HansU
Time to create page: 0.087 seconds
Powered by Kunena Forum