From: Chris M. <gi...@gi...> - 2013-01-30 03:43:27
|
gscreen configs -fix the ability to set DRO colors Changed the DRO readout slighly bigger and bolder now it sets the Initial color as per the preference file and responds to color changes in the preference page http://git.linuxcnc.org/?p=linuxcnc.git;a=commitdiff;h=a35d48e --- configs/sim/gscreen_custom/industrial.glade | 93 ++++++++++++++---------- configs/sim/gscreen_custom/industrial_handler.py | 29 +++++++- 2 files changed, 84 insertions(+), 38 deletions(-) diff --git a/configs/sim/gscreen_custom/industrial.glade b/configs/sim/gscreen_custom/industrial.glade index a51770a..b5220c9 100644 --- a/configs/sim/gscreen_custom/industrial.glade +++ b/configs/sim/gscreen_custom/industrial.glade @@ -168,6 +168,7 @@ </child> <child> <object class="GtkVBox" id="dro_frame"> + <property name="width_request">300</property> <property name="visible">True</property> <child> <object class="GtkAlignment" id="alignment1"> @@ -403,7 +404,8 @@ <property name="visible">True</property> <property name="label" translatable="yes">label</property> <attributes> - <attribute name="scale" value="1.200000"/> + <attribute name="weight" value="heavy"/> + <attribute name="scale" value="1.500000"/> </attributes> </object> <packing> @@ -416,7 +418,8 @@ <property name="label" translatable="yes">label</property> <property name="joint_number">1</property> <attributes> - <attribute name="scale" value="1.200000"/> + <attribute name="weight" value="heavy"/> + <attribute name="scale" value="1.500000"/> </attributes> </object> <packing> @@ -429,7 +432,8 @@ <property name="label" translatable="yes">label</property> <property name="joint_number">2</property> <attributes> - <attribute name="scale" value="1.200000"/> + <attribute name="weight" value="heavy"/> + <attribute name="scale" value="1.500000"/> </attributes> </object> <packing> @@ -441,7 +445,8 @@ <property name="label" translatable="yes">label</property> <property name="joint_number">3</property> <attributes> - <attribute name="scale" value="1.200000"/> + <attribute name="weight" value="heavy"/> + <attribute name="scale" value="1.500000"/> </attributes> </object> <packing> @@ -453,7 +458,8 @@ <property name="label" translatable="yes">label</property> <property name="joint_number">4</property> <attributes> - <attribute name="scale" value="1.200000"/> + <attribute name="weight" value="heavy"/> + <attribute name="scale" value="1.500000"/> </attributes> </object> <packing> @@ -465,7 +471,8 @@ <property name="label" translatable="yes">label</property> <property name="joint_number">5</property> <attributes> - <attribute name="scale" value="1.200000"/> + <attribute name="weight" value="heavy"/> + <attribute name="scale" value="1.500000"/> </attributes> </object> <packing> @@ -477,7 +484,8 @@ <property name="label" translatable="yes">label</property> <property name="joint_number">6</property> <attributes> - <attribute name="scale" value="1.200000"/> + <attribute name="weight" value="heavy"/> + <attribute name="scale" value="1.500000"/> </attributes> </object> <packing> @@ -489,7 +497,8 @@ <property name="label" translatable="yes">label</property> <property name="joint_number">7</property> <attributes> - <attribute name="scale" value="1.200000"/> + <attribute name="weight" value="heavy"/> + <attribute name="scale" value="1.500000"/> </attributes> </object> <packing> @@ -501,7 +510,8 @@ <property name="label" translatable="yes">label</property> <property name="joint_number">8</property> <attributes> - <attribute name="scale" value="1.200000"/> + <attribute name="weight" value="heavy"/> + <attribute name="scale" value="1.500000"/> </attributes> </object> <packing> @@ -540,7 +550,8 @@ <property name="label" translatable="yes">label</property> <property name="reference_type">1</property> <attributes> - <attribute name="scale" value="1.200000"/> + <attribute name="weight" value="heavy"/> + <attribute name="scale" value="1.500000"/> </attributes> </object> <packing> @@ -551,10 +562,11 @@ <object class="HAL_DRO" id="dro_y2"> <property name="visible">True</property> <property name="label" translatable="yes">label</property> - <property name="reference_type">1</property> <property name="joint_number">1</property> + <property name="reference_type">1</property> <attributes> - <attribute name="scale" value="1.200000"/> + <attribute name="weight" value="heavy"/> + <attribute name="scale" value="1.500000"/> </attributes> </object> <packing> @@ -565,10 +577,11 @@ <object class="HAL_DRO" id="dro_z2"> <property name="visible">True</property> <property name="label" translatable="yes">label</property> - <property name="reference_type">1</property> <property name="joint_number">2</property> + <property name="reference_type">1</property> <attributes> - <attribute name="scale" value="1.200000"/> + <attribute name="weight" value="heavy"/> + <attribute name="scale" value="1.500000"/> </attributes> </object> <packing> @@ -578,10 +591,11 @@ <child> <object class="HAL_DRO" id="dro_a2"> <property name="label" translatable="yes">label</property> - <property name="reference_type">1</property> <property name="joint_number">3</property> + <property name="reference_type">1</property> <attributes> - <attribute name="scale" value="1.200000"/> + <attribute name="weight" value="heavy"/> + <attribute name="scale" value="1.500000"/> </attributes> </object> <packing> @@ -591,10 +605,11 @@ <child> <object class="HAL_DRO" id="dro_b2"> <property name="label" translatable="yes">label</property> - <property name="reference_type">1</property> <property name="joint_number">4</property> + <property name="reference_type">1</property> <attributes> - <attribute name="scale" value="1.200000"/> + <attribute name="weight" value="heavy"/> + <attribute name="scale" value="1.500000"/> </attributes> </object> <packing> @@ -604,10 +619,11 @@ <child> <object class="HAL_DRO" id="dro_c2"> <property name="label" translatable="yes">label</property> - <property name="reference_type">1</property> <property name="joint_number">5</property> + <property name="reference_type">1</property> <attributes> - <attribute name="scale" value="1.200000"/> + <attribute name="weight" value="heavy"/> + <attribute name="scale" value="1.500000"/> </attributes> </object> <packing> @@ -617,10 +633,11 @@ <child> <object class="HAL_DRO" id="dro_u2"> <property name="label" translatable="yes">label</property> - <property name="reference_type">1</property> <property name="joint_number">6</property> + <property name="reference_type">1</property> <attributes> - <attribute name="scale" value="1.200000"/> + <attribute name="weight" value="heavy"/> + <attribute name="scale" value="1.500000"/> </attributes> </object> <packing> @@ -630,10 +647,11 @@ <child> <object class="HAL_DRO" id="dro_w2"> <property name="label" translatable="yes">label</property> - <property name="reference_type">1</property> <property name="joint_number">7</property> + <property name="reference_type">1</property> <attributes> - <attribute name="scale" value="1.200000"/> + <attribute name="weight" value="heavy"/> + <attribute name="scale" value="1.500000"/> </attributes> </object> <packing> @@ -643,10 +661,11 @@ <child> <object class="HAL_DRO" id="dro_v2"> <property name="label" translatable="yes">label</property> - <property name="reference_type">1</property> <property name="joint_number">8</property> + <property name="reference_type">1</property> <attributes> - <attribute name="scale" value="1.200000"/> + <attribute name="weight" value="heavy"/> + <attribute name="scale" value="1.500000"/> </attributes> </object> <packing> @@ -837,8 +856,8 @@ <child> <object class="HAL_LED" id="led_mist"> <property name="visible">True</property> - <property name="on_color">green</property> <property name="off_color">black</property> + <property name="on_color">green</property> <property name="led_shape">1</property> </object> <packing> @@ -883,8 +902,8 @@ <child> <object class="HAL_LED" id="led_flood"> <property name="visible">True</property> - <property name="on_color">green</property> <property name="off_color">black</property> + <property name="on_color">green</property> <property name="led_shape">1</property> </object> <packing> @@ -953,16 +972,16 @@ <child> <object class="HAL_HBar" id="s_display"> <property name="visible">True</property> + <property name="target_value">500</property> <property name="text_template">%d</property> - <property name="target_color">#e21911831183</property> - <property name="z0_color">#0000ffff0000</property> + <property name="show_limits">False</property> <property name="max">2000</property> - <property name="target_value">500</property> + <property name="bg_color">#bebebebebebe</property> + <property name="z0_color">#0000ffff0000</property> <property name="z1_color">#ffffffff0000</property> <property name="value">-7</property> - <property name="bg_color">#bebebebebebe</property> <property name="z2_color">#ffff00000000</property> - <property name="show_limits">False</property> + <property name="target_color">#e21911831183</property> </object> <packing> <property name="right_attach">3</property> @@ -1114,9 +1133,9 @@ <child> <object class="HAL_LED" id="spindle-at-speed"> <property name="visible">True</property> + <property name="off_color">black</property> <property name="led_size">5</property> <property name="on_color">Green</property> - <property name="off_color">black</property> <property name="led_shape">1</property> </object> </child> @@ -2058,8 +2077,8 @@ status</property> <child> <object class="HAL_LED" id="led_on"> <property name="visible">True</property> - <property name="on_color">green</property> <property name="off_color">black</property> + <property name="on_color">green</property> <property name="led_shape">1</property> </object> <packing> @@ -2379,8 +2398,8 @@ Limits</property> <child> <object class="HAL_LED" id="led_ignore_limits"> <property name="visible">True</property> - <property name="led_size">5</property> <property name="off_color">black</property> + <property name="led_size">5</property> <property name="has_hal_pin">False</property> </object> <packing> @@ -2489,8 +2508,8 @@ Override</property> <child> <object class="HAL_LED" id="led_estop"> <property name="visible">True</property> - <property name="led_blink_rate">200</property> <property name="off_color">black</property> + <property name="led_blink_rate">200</property> <property name="led_shape">1</property> </object> <packing> diff --git a/configs/sim/gscreen_custom/industrial_handler.py b/configs/sim/gscreen_custom/industrial_handler.py index 220ba12..f8d397c 100644 --- a/configs/sim/gscreen_custom/industrial_handler.py +++ b/configs/sim/gscreen_custom/industrial_handler.py @@ -161,6 +161,26 @@ class HandlerClass: if code == _UNLOCKCODE: return True return False + def on_abs_colorbutton_color_set(self,widget): + self.gscreen.set_abs_color() + color = self.data.abs_color + fg_color = pango.AttrForeground(color[0],color[1],color[2], 0, 11) + for i in self.data.axis_list: + axis = "dro_%s1"% i + attr = self.widgets[axis].get_attributes() + attr.insert(fg_color) + self.widgets[axis].set_attributes(attr) + + def on_rel_colorbutton_color_set(self,widget): + self.gscreen.set_rel_color() + color = self.data.rel_color + fg_color = pango.AttrForeground(color[0],color[1],color[2], 0, 11) + for i in self.data.axis_list: + axis = "dro_%s2"% i + attr = self.widgets[axis].get_attributes() + attr.insert(fg_color) + self.widgets[axis].set_attributes(attr) + # Connect to gscreens regular signals and add a couple more def connect_signals(self,handlers): self.gscreen.connect_signals(handlers) @@ -170,6 +190,8 @@ class HandlerClass: for cb in temp: i = "_sighandler_%s"% (cb) self.data[i] = int(self.widgets[cb].connect("toggled", self["on_%s_clicked"%cb])) + self.widgets.abs_colorbutton.connect("color-set", self.on_abs_colorbutton_color_set) + self.widgets.rel_colorbutton.connect("color-set", self.on_rel_colorbutton_color_set) # We don't want Gscreen to initialize ALL it's regular widgets because this custom # screen doesn't have them all -just most of them. So we call the ones we want @@ -180,7 +202,8 @@ class HandlerClass: self.gscreen.init_fullscreen1() self.gscreen.init_gremlin() self.gscreen.init_manual_spindle_controls() - #self.gscreen.init_dro() + self.gscreen.init_dro_colors() + self.init_dro() # local function self.gscreen.init_audio() self.gscreen.init_statusbar() self.gscreen.init_entry() @@ -210,6 +233,10 @@ class HandlerClass: self.data.sensitive_edit_mode = ["button_menu","button_graphics","button_override","restart","button_v1_3","button_v1_0", "run_button","setup_button","mdi_button","system_button","tooledit_button","ignore_limits"] + def init_dro(self): + self.on_abs_colorbutton_color_set(None) + self.on_rel_colorbutton_color_set(None) + # every 100 milli seconds this gets called # we add calls to the regular functions for the widgets we are using. # and add any extra calls/code |