- Posts: 4739
- Thank you received: 2
Lable Change by HAL Radio Button?
- Todd Zuercher
- Topic Author
- Offline
- Platinum Member
-
Less
More
10 years 8 months ago #69651
by Todd Zuercher
That is right, It is just a easy (for the operator not for me) way for the operator to make simple incremental adjustments to the G54 machine coordinate system, rather than use the "touchoff system" This is much simpler for the way we use this machine. (It is for a gang router that is used for engraving multiple items.)
I've already made a similar pyvcp panel (and a huge pile of halui commands and subroutines) for another of our carving machines. This time I wanted to try glade which removed the need for halui and most of the subs, but the python part is kicking my butt.
Replied by Todd Zuercher on topic Lable Change by HAL Radio Button?
cmorley wrote: I am also curious what you are doing as your 'jog' commands seem to actually just move the origin using g10?
Chris M
That is right, It is just a easy (for the operator not for me) way for the operator to make simple incremental adjustments to the G54 machine coordinate system, rather than use the "touchoff system" This is much simpler for the way we use this machine. (It is for a gang router that is used for engraving multiple items.)
I've already made a similar pyvcp panel (and a huge pile of halui commands and subroutines) for another of our carving machines. This time I wanted to try glade which removed the need for halui and most of the subs, but the python part is kicking my butt.
Please Log in to join the conversation.
- Todd Zuercher
- Topic Author
- Offline
- Platinum Member
-
Less
More
- Posts: 4739
- Thank you received: 2
10 years 8 months ago #69652
by Todd Zuercher
Replied by Todd Zuercher on topic Lable Change by HAL Radio Button?
That did the trick for me. (other than a couple of typos).
Now on to the next battle, I want to make the large ZW change depending on the state of a hal pin.
If false I'd like it to be black and ZW, if true blue and ZZ.
Now on to the next battle, I want to make the large ZW change depending on the state of a hal pin.
If false I'd like it to be black and ZW, if true blue and ZZ.
Code:
class HandlerClass:
def __init__(self, halcomp,builder,useropts):
self.builder = builder
self.jog_increment = self.builder.get_object('jog_increment')
self.g54inch = self.builder.get_object('g54inch_jog')
self.g54tenth = self.builder.get_object('g54tenth_jog')
self.g54hundredth = self.builder.get_object('g54hundedth_jog')
self.g54thousandth = self.builder.get_object('g54thousandth_jog')
def activ_inc(self, widget):
if widget.get_active():
if widget == self.g54inch: self.jog_increment.set_text('1.000')
elif widget == self.g54tenth: self.jog_increment.set_text('0.100')
elif widget == self.g54hundredth: self.jog_increment.set_text('0.010')
elif widget == self.g54thousandth: self.jog_increment.set_text('0.001')
# This is boiler code, required for gladevcp
def get_handlers(halcomp,builder,useropts):
return [HandlerClass(halcomp,builder,useropts)]
Please Log in to join the conversation.
10 years 8 months ago #69687
by cmorley
You should be able to change this to what you want
Chris M
Replied by cmorley on topic Lable Change by HAL Radio Button?
Code:
import hal_glib
import hal
import pango
class HandlerClass:
def __init__(self, halcomp,builder,useropts):
self.builder = builder
self.halcomp = halcomp
self.jog_increment = self.builder.get_object('jog_increment')
self.g54inch = self.builder.get_object('g54inch_jog')
self.g54tenths = self.builder.get_object('g54tenth_jog')
self.g54hundredths = self.builder.get_object('g54hundedth_jog')
self.g54thousandths = self.builder.get_object('g54thousandth_jog')
self.z_label = self.builder.get_object('z_label')
self.w_label = self.builder.get_object('w_label')
self.example_trigger = hal_glib.GPin(halcomp.newpin('label-trigger', hal.HAL_BIT, hal.HAL_IN))
self.example_trigger.connect('value-changed', self.on_label_trigger_value_changed)
self.attr_true = pango.AttrList()
fg_color = pango.AttrForeground(65535, 0, 0, 0, -1)
size = pango.AttrSize(30000, 0, -1)
weight = pango.AttrWeight(pango.WEIGHT_BOLD, 0, -1)
self.attr_true.insert(fg_color)
self.attr_true.insert(size)
self.attr_true.insert(weight)
self.attr_false = pango.AttrList()
fg_color = pango.AttrForeground(0, 0, 0, 0, -1)
self.attr_false.insert(fg_color)
self.attr_false.insert(size)
self.attr_false.insert(weight)
def on_label_trigger_value_changed(self, pin):
state = pin.get()
if state:
self.z_label.set_attributes(self.attr_true)
self.w_label.set_attributes(self.attr_true)
else:
self.z_label.set_attributes(self.attr_false)
self.w_label.set_attributes(self.attr_false)
def activ_inc(self, widget):
if widget.get_active():
if widget == self.g54inch: self.jog_increment.set_text('1.000')
elif widget == self.g54tenths: self.jog_increment.set_text('0.100')
elif widget == self.g54hundedths: self.jog_increment.set_text('0.010')
elif widget == self.g54thousandths: self.jog_increment.set_text('0.001')
# This is boiler code, required for gladevcp
def get_handlers(halcomp,builder,useropts):
return [HandlerClass(halcomp,builder,useropts)]
You should be able to change this to what you want
Chris M
Please Log in to join the conversation.
- Todd Zuercher
- Topic Author
- Offline
- Platinum Member
-
Less
More
- Posts: 4739
- Thank you received: 2
10 years 8 months ago #69854
by Todd Zuercher
Replied by Todd Zuercher on topic Lable Change by HAL Radio Button?
Thanks alot. Here is what I think I'll end up using.
Code:
import hal_glib
import hal
import pango
class HandlerClass:
def __init__(self, halcomp,builder,useropts):
self.builder = builder
self.halcomp = halcomp
self.jog_increment = self.builder.get_object('jog_increment')
self.g54inch = self.builder.get_object('g54inch_jog')
self.g54tenths = self.builder.get_object('g54tenth_jog')
self.g54hundredths = self.builder.get_object('g54hundedth_jog')
self.g54thousandths = self.builder.get_object('g54thousandth_jog')
self.zw_label = self.builder.get_object('zw_label')
self.example_trigger = hal_glib.GPin(halcomp.newpin('label-trigger', hal.HAL_BIT, hal.HAL_IN))
self.example_trigger.connect('value-changed', self.on_label_trigger_value_changed)
self.attr_true = pango.AttrList()
fg_color = pango.AttrForeground(0, 0, 65535, 0, -1)
size = pango.AttrSize(30000, 0, -1)
weight = pango.AttrWeight(pango.WEIGHT_BOLD, 0, -1)
self.attr_true.insert(fg_color)
self.attr_true.insert(size)
self.attr_true.insert(weight)
self.attr_false = pango.AttrList()
fg_color = pango.AttrForeground(0, 0, 0, 0, -1)
self.attr_false.insert(fg_color)
self.attr_false.insert(size)
self.attr_false.insert(weight)
def on_label_trigger_value_changed(self, pin):
state = pin.get()
if state:
self.zw_label.set_attributes(self.attr_true)
self.zw_label.set_text('ZZ')
else:
self.zw_label.set_attributes(self.attr_false)
self.zw_label.set_text('ZW')
def activ_inc(self, widget):
if widget.get_active():
if widget == self.g54inch: self.jog_increment.set_text('1.000')
elif widget == self.g54tenths: self.jog_increment.set_text('0.100')
elif widget == self.g54hundredths: self.jog_increment.set_text('0.010')
elif widget == self.g54thousandths: self.jog_increment.set_text('0.001')
# This is boiler code, required for gladevcp
def get_handlers(halcomp,builder,useropts):
return [HandlerClass(halcomp,builder,useropts)]
Please Log in to join the conversation.
Time to create page: 0.091 seconds
