summaryrefslogtreecommitdiff
path: root/configs/sim/axis/remap/manual-toolchange-with-tool-length-switch/python/gladevcp-handler.py
blob: 5a04dbff5ff7bf1a7e466db0e84b8dfda0925e7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python

import hal

class HandlerClass:

    def on_led_change(self,hal_led,data=None):
        '''
        the gladevcp.change led had a transition
        '''
        if hal_led.hal_pin.get():
            if self.halcomp["number"] > 0.0:
                self.change_text.set_label("Insert too number %d" % (int(self.halcomp["number"])))
            else:
                self.change_text.set_label("Remove tool")
        else:
            self.change_text.set_label("")         

    def __init__(self, halcomp,builder,useropts):
        self.halcomp = halcomp
        self.change_text = builder.get_object("change-text")
        self.halcomp.newpin("number", hal.HAL_FLOAT, hal.HAL_IN)

def get_handlers(halcomp,builder,useropts):
    return [HandlerClass(halcomp,builder,useropts)]