Skip to content

Commit

Permalink
gscreen: Further tidying up to clear up runtime errors and startup ve…
Browse files Browse the repository at this point in the history
…rbosity
  • Loading branch information
andypugh committed Sep 10, 2024
1 parent c846bfe commit 1327807
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 23 deletions.
3 changes: 1 addition & 2 deletions configs/sim/gscreen/gscreen_custom/9axis.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ DEBUG = 0
[DISPLAY]

; -c sets the glade and handler file to load -d is to display extra debug messages
; In this case the glade and handler file are named gscreen so we don't need -c
DISPLAY = gscreen -c 9_axis -d -v
DISPLAY = gscreen -c 9_axis

# Cycle time, in milliseconds, that display will sleep between polls
CYCLE_TIME = 100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ MACHINE = LinuxCNC-HAL-SIM-AXIS
DEBUG = 0

[DISPLAY]
DISPLAY = gscreen -c industrial -d
DISPLAY = gscreen -c industrial
LATHE = 1
OPEN_FILE = ""
CYCLE_TIME = 0.100
Expand Down
2 changes: 1 addition & 1 deletion configs/sim/gscreen/silverdragon/silverdragon.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ DEBUG = 0

# Sections for display options ------------------------------------------------
[DISPLAY]
DISPLAY = gscreen -d -c silverdragon
DISPLAY = gscreen -c silverdragon
# Cycle time, in milliseconds, that display will sleep between polls
CYCLE_TIME = 100
#PREFERENCE_FILE_PATH = /home/jim/linuxcnc/configs/sim.gscreen.gscreen_custom/silverdragon.pref
Expand Down
14 changes: 14 additions & 0 deletions share/gscreen/skins/9_axis/9_axis_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@ def on_button_press(self,widget,data=None):
self.nhits += 1
widget.set_label("hits: %d" % self.nhits)

# This is a new method that calls a gscreen method to toggle the DRO units
# Gscreen's regular unit button saves the state
# for startup, This one just changes it for the session
def on_metric_select_clicked(self,widget):
data = (self.data.dro_units -1) * -1
self.gscreen.set_dro_units(data,False)
for i in ("1","2","3"):
for letter in self.data.axis_list:
axis = "dro_%s%s"% (letter,i)
try:
self.widgets[axis].set_property("display_units_mm",data)
except:
pass

# This method is overridden from gscreen
# We selected this method name in the glade file as a callback.
# Since this method name is the same as one in gscreen,
Expand Down
1 change: 0 additions & 1 deletion share/gscreen/skins/gaxis_no_plot/gaxis_no_plot_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ def initialize_widgets(self):
self.gscreen.homed_status_message = self.widgets.statusbar1.push(1,"Ready For Homing")
model = self.widgets.jog_speed.get_model()
for num,i in enumerate(self.data.jog_increments):
print(i)
model.append([i])
if i == "continuous":
self.data.current_jogincr_index = num
Expand Down
29 changes: 11 additions & 18 deletions share/gscreen/skins/silverdragon/silverdragon_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,12 @@ def init_button_colors(self):
# set the button background colors and digits of the DRO
self.homed_textcolor = self.gscreen.prefs.getpref("homed_textcolor", "#00FF00", str) # default green
self.unhomed_textcolor = self.gscreen.prefs.getpref("unhomed_textcolor", "#FF0000", str) # default red
self.widgets.homed_colorbtn.set_color(gdk.color_parse(self.homed_textcolor))
self.widgets.unhomed_colorbtn.set_color(gdk.color_parse(self.unhomed_textcolor))
self.homed_color = self.gscreen.convert_to_rgb(self.widgets.homed_colorbtn.get_color())
self.unhomed_color = self.gscreen.convert_to_rgb(self.widgets.unhomed_colorbtn.get_color())
self.homed_color = gdk.RGBA()
self.homed_color.parse(self.homed_textcolor)
self.widgets.homed_colorbtn.set_rgba(self.homed_color)
self.unhomed_color = gdk.RGBA()
self.unhomed_color.parse(self.unhomed_textcolor)
self.widgets.unhomed_colorbtn.set_rgba(self.unhomed_color)
self.widgets.tbtn_estop.modify_bg(gtk.StateFlags.NORMAL, gdk.color_parse("#00FF00"))
self.widgets.tbtn_estop.modify_bg(gtk.StateFlags.ACTIVE, gdk.color_parse("#FF0000"))
self.widgets.tbtn_on.modify_bg(gtk.StateFlags.NORMAL, gdk.color_parse("#FF0000"))
Expand Down Expand Up @@ -861,12 +863,10 @@ def on_change_sound(self, widget, sound=None):
self.gscreen.prefs.putpref("audio_alert", file)

def on_homed_colorbtn_color_set(self, widget):
self.homed_color = self.gscreen.convert_to_rgb(widget.get_color())
self.gscreen.prefs.putpref('homed_textcolor', widget.get_color(), str)
self.gscreen.prefs.putpref('homed_textcolor', gdk.RGBA.to_string(widget.get_rgba()), str)

def on_unhomed_colorbtn_color_set(self, widget):
self.unhomed_color = self.gscreen.convert_to_rgb(widget.get_color())
self.gscreen.prefs.putpref('unhomed_textcolor', widget.get_color(), str)
self.gscreen.prefs.putpref('unhomed_textcolor', gdk.RGBA.to_string(widget.get_rgba()), str)

def _from_internal_linear_unit(self, v, unit=None):
if unit is None:
Expand Down Expand Up @@ -936,7 +936,7 @@ def on_hal_status_all_homed(self, widget):
self.command.wait_complete()
self.gscreen.sensitize_widgets(self.data.sensitive_all_homed, True)
self.set_motion_mode(1)
self.widgets.statusbar1.remove_message(self.gscreen.statusbar_id, self.gscreen.homed_status_message)
self.widgets.statusbar1.remove(self.gscreen.statusbar_id, self.gscreen.homed_status_message)
self.gscreen.notify(_("INFO"), _("All axes have been homed"), INFO_ICON)
if self.widgets.chk_reload_tool.get_active():
if self.stat.tool_in_spindle == 0:
Expand Down Expand Up @@ -1300,14 +1300,7 @@ def update_dro(self):
self["label_home_%s"%i].modify_fg(gtk.StateFlags.NORMAL, gdk.color_parse("#FF0000"))
color = self.unhomed_color
j += 1
attr = pango.AttrList()
fg_color = pango.AttrForeground(color[0],color[1],color[2], 0, 11)
size = pango.AttrSize(22000, 0, -1)
weight = pango.AttrWeight(600, 0, -1)
attr.insert(fg_color)
attr.insert(size)
attr.insert(weight)
self.widgets["hal_dro_%s"%i].set_attributes(attr)
self.widgets["hal_dro_%s"%i].override_color(gtk.StateFlags.NORMAL, color)

def _set_spindle(self, command):
if self.stat.task_state == linuxcnc.STATE_ESTOP:
Expand Down Expand Up @@ -1445,7 +1438,7 @@ def init_offsetpage(self):
self.widgets.offsetpage1.machine_units_mm = _INCH
self.widgets.offsetpage1.set_row_visible("1", False)
self.widgets.offsetpage1.set_font("sans 12")
self.widgets.offsetpage1.set_foreground_color(gdk.color_parse("#28D0D9"))
self.widgets.offsetpage1.set_foreground_color(gdk.RGBA(0.151, 0.813, 0.845, 1.0))
self.widgets.offsetpage1.selection_mask = ("Tool", "G5x", "Rot")
systemlist = ["Tool", "G5x", "Rot", "G92", "G54", "G55", "G56", "G57", "G58", "G59", "G59.1",
"G59.2", "G59.3"]
Expand Down

0 comments on commit 1327807

Please sign in to comment.