From efa40e57654c4efe8e4df31605fe8f22912cfc7e Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Wed, 15 Mar 2023 16:04:46 +1100 Subject: [PATCH] gscreen: multiple squashed commits switch audio play to python3 gstreamer switch notifications to gst notifications switch terminal to spawn_async rather than fork remove some trailing whitespace fix some typos rework some print statements comment out some debug print statements python3 updates silence deprecation messages at startup use markup for dro colors quieten gtk dont know color warnings fix hide-show pointer fix some dialog deprecations utilise the QtVCP logging library use theme from preferences file make glade file gtk3 compliant make a start for gtk3 stylesheet play nicely if audio file is incorrect or missing --- .../sim/gscreen/gscreen_theme/gtk-3.0/gtk.css | 34 + .../gscreen_theme/{gtk-2.0 => gtk-3.0}/gtkrc | 28 +- lib/python/gladevcp/offsetpage_widget.py | 8 - src/emc/usr_intf/gscreen/gscreen.glade | 6923 +++++++++-------- src/emc/usr_intf/gscreen/gscreen.py | 1001 +-- 5 files changed, 4185 insertions(+), 3809 deletions(-) create mode 100644 configs/sim/gscreen/gscreen_theme/gtk-3.0/gtk.css rename configs/sim/gscreen/gscreen_theme/{gtk-2.0 => gtk-3.0}/gtkrc (91%) diff --git a/configs/sim/gscreen/gscreen_theme/gtk-3.0/gtk.css b/configs/sim/gscreen/gscreen_theme/gtk-3.0/gtk.css new file mode 100644 index 00000000000..30fc59b360e --- /dev/null +++ b/configs/sim/gscreen/gscreen_theme/gtk-3.0/gtk.css @@ -0,0 +1,34 @@ +.background { + color: #ffffff; + background-color: #232323; +} + +*:active { + color: #dadada; + background-color: #151515; +} + +*:disabled { + color: #151515; + background-color: #303030; +} + +*:hover { + color: #fcfcfc; + background-color: #003263; +} + +*:checked { + color: #fcfcfc; + background-color: #002849; +} + +button, notebook tab label { + border: 1px solid #808080; + margin:1px; +} + +*button:active { + color: #dadada; + background-color: #151515; +} diff --git a/configs/sim/gscreen/gscreen_theme/gtk-2.0/gtkrc b/configs/sim/gscreen/gscreen_theme/gtk-3.0/gtkrc similarity index 91% rename from configs/sim/gscreen/gscreen_theme/gtk-2.0/gtkrc rename to configs/sim/gscreen/gscreen_theme/gtk-3.0/gtkrc index 6346f9ae4fd..3030a7c9533 100644 --- a/configs/sim/gscreen/gscreen_theme/gtk-2.0/gtkrc +++ b/configs/sim/gscreen/gscreen_theme/gtk-3.0/gtkrc @@ -1,3 +1,9 @@ +*********************************** +old Gtk2 styling +kept for obtaining original styling +*********************************** + + style "default" { GtkButton::default_border = {0, 0, 0, 0} @@ -23,16 +29,16 @@ style "default" GtkScrollbar::min_slider_length = 10 GtkToolbar::shadow_type = out GtkWidget::focus-line-width = 1 - GtkWidget::focus_padding = 1 - GtkWidget::interior_focus = 1 - GtkWidget::internal_padding = 2 + GtkWidget::focus_padding = 1 + GtkWidget::interior_focus = 1 + GtkWidget::internal_padding = 2 GtkEntry::cursor_color = "#fcfcfc" GtkEntry::secondary_cursor_color = "#fcfcfc" GtkTextView::cursor_color = "#fcfcfc" GtkTextView::secondary_cursor_color = "#fcfcfc" GtkEntry::cursor_aspect_ratio = 0.1 GtkEntry::cursor_aspect_ratio = 0.1 - + xthickness = 1 ythickness = 1 @@ -81,7 +87,7 @@ style "button" = "default" xthickness = 2 ythickness = 2 - engine "xfce" + engine "xfce" { smooth_edge = true grip_style = none @@ -109,7 +115,7 @@ style "sbstyle" = "default" { xthickness = 2 ythickness = 2 - engine "xfce" + engine "xfce" { smooth_edge = true grip_style = none @@ -132,8 +138,8 @@ style "progress" = "default" xthickness = 2 ythickness = 2 } -widget_class "*GtkProgress*" style "progress" -class "*GtkProgress*" style "progress" +widget_class "*GtkProgress*" style "progress" +class "*GtkProgress*" style "progress" style "menuitem" = "default" { @@ -152,7 +158,7 @@ style "flat" = "default" widget_class "*HandleBox" style "flat" # This is for the window borders (xfwm4 & metacity) -# +# style "titlebar" { bg[SELECTED] = "#003263" @@ -165,8 +171,8 @@ class "MetaFrames" style "titlebar" widget_class "MetaFrames" style "titlebar" -# These custom themed widget require the widget name -# to match in the glade file +# These custom themed widget require the widget name +# to match in the glade file style "halsourceview" = "default" { base[SELECTED] = "#FFFFFF" # highlight color diff --git a/lib/python/gladevcp/offsetpage_widget.py b/lib/python/gladevcp/offsetpage_widget.py index 48e7aadb1c7..eb0978696e9 100755 --- a/lib/python/gladevcp/offsetpage_widget.py +++ b/lib/python/gladevcp/offsetpage_widget.py @@ -94,17 +94,9 @@ def __init__(self, filename = None, *a, **kw): self.display_follows_program = False # display units are chosen indepenadently of G20/G21 self.font = "sans 12" self.editing_mode = False - # color = Gdk.RGBA() - # color.parse("lightblue") - # self.highlight_color = color - # color.parse("red") - # self.foreground_color = color - # color.parse("lightgray") - # self.unselectable_color = color self.highlight_color = self.color_parse("lightblue") self.foreground_color = self.color_parse("red") self.unselectable_color = self.color_parse("lightgray") - self.hidejointslist = [] self.hidecollist = [] self.wTree = Gtk.Builder() diff --git a/src/emc/usr_intf/gscreen/gscreen.glade b/src/emc/usr_intf/gscreen/gscreen.glade index daa868f778f..ecc6658fa6b 100644 --- a/src/emc/usr_intf/gscreen/gscreen.glade +++ b/src/emc/usr_intf/gscreen/gscreen.glade @@ -1,2768 +1,2691 @@ - + + - - - - - 800 + + + + -10000 + 10000 + 1 + + + 100 + 0.25 + + + 1 + 10000 + 300 + 50 + + + + True + False + 0 + none - + + True - 11 - 7 + False + 2 + 2 + True + True - + + S 1000 + True + True + True + + + 1 + 1 + + + + + Start + True + True + True + + + 1 + 0 + + + + + + + True + True + True + + + 0 + 0 + + + + + - + True + True + True + + + 0 + 1 + + + + True - True + True + True - + True - 5 - 3 + False + True - + True - 0 - etched-out - - - 300 - True - - - True - 0 - etched-out - - - True - 1 - - - True - 3 - 3 - - - True - 0000.0000 - - - 1 - 2 - - - - - - True - 0000.0000 - - - 1 - 2 - 1 - 2 - - - - - - True - 5 - REL - 0.5 - - - 2 - 3 - - - - - - True - 5 - DTG - 0.5 - - - 2 - 3 - 1 - 2 - - - - - - True - 5 - ABS - 0.5 - - - 2 - 3 - 2 - 3 - - - - - - True - 0 - 0.5 - - - X - True - True - True - - - - - 2 - - - - - True - 1 - 0 - - - True - 0000.0000 - - - - - 2 - 2 - 3 - - - - - - - - - True - True - - - - - 0 - - - - - 0 - etched-out - - - True - 1 - - - True - 3 - 3 - - - True - 0000.0000 - - - 1 - 2 - - - - - - True - 0000.0000 - - - 1 - 2 - 1 - 2 - - - - - - True - 5 - REL - 0.5 - - - 2 - 3 - - - - - - True - 5 - DTG - 0.5 - - - 2 - 3 - 1 - 2 - - - - - - True - 5 - ABS - 0.5 - - - 2 - 3 - 2 - 3 - GTK_FILL - - - - - True - 0 - 0.5 - - - Y - True - True - True - - - - - 2 - - - - - True - 1 - 0 - - - True - 0 - 0000.0000 - - - - - 2 - 2 - 3 - - - - - - - - - True - True - - - - - 1 - - - - - True - 0 - etched-out - - - True - 1 - - - True - 3 - 3 - - - True - 0000.0000 - - - 1 - 2 - - - - - - True - 0000.0000 - - - 1 - 2 - 1 - 2 - - - - - - True - 5 - REL - - - 2 - 3 - - - - - - True - 5 - DTG - 0.5 - - - 2 - 3 - 1 - 2 - - - - - - True - 5 - ABS - - - 2 - 3 - 2 - 3 - - - - - - True - 0 - 0.5 - - - Z - True - True - True - - - - - 2 - - - - - True - 1 - 0 - - - True - 0000.0000 - - - - - 2 - 2 - 3 - - - - - - - - - True - True - - - - - 2 - - - - - 0 - etched-out - - - True - 1 - - - True - 3 - 3 - - - True - 0000.0000 - - - 1 - 2 - - - - - - True - 0000.0000 - - - 1 - 2 - 1 - 2 - - - - - - True - 5 - REL - - - 2 - 3 - - - - - - True - 5 - DTG - 0.5 - - - 2 - 3 - 1 - 2 - - - - - - True - 5 - ABS - 0.5 - - - 2 - 3 - 2 - 3 - - - - - - True - 0 - 0.5 - - - A - True - True - True - - - - - 2 - - - - - True - 1 - 0 - - - True - 0000.0000 - - - - - 2 - 2 - 3 - - - - - - - - - True - True - - - - - 3 - - - - - 0 - etched-out - - - True - 1 - - - True - 3 - 3 - - - True - 0000.0000 - - - 1 - 2 - - - - - - True - 0000.0000 - - - 1 - 2 - 1 - 2 - - - - - - True - 5 - REL - 0.5 - - - 2 - 3 - - - - - - True - 5 - DTG - 0.5 - - - 2 - 3 - 1 - 2 - - - - - - True - 5 - ABS - - - 2 - 3 - 2 - 3 - - - - - - True - 0 - 0.5 - - - B - True - True - True - - - - - 2 - - - - - True - 1 - 0 - - - True - 0000.0000 - - - - - 2 - 2 - 3 - - - - - - - - - True - True - - - - - 4 - - - - - 0 - etched-out - - - True - 1 - - - True - 3 - 3 - - - True - 0000.0000 - - - 1 - 2 - - - - - - True - 0000.0000 - - - 1 - 2 - 1 - 2 - - - - - - True - 5 - REL - 0.5 - - - 2 - 3 - - - - - - True - 5 - DTG - 0.5 - - - 2 - 3 - 1 - 2 - - - - - - True - 5 - ABS - 0.5 - - - 2 - 3 - 2 - 3 - - - - - - True - 0 - 0.5 - - - C - True - True - True - - - - - 2 - - - - - True - 1 - 0 - - - True - 0000.0000 - - - - - 2 - 2 - 3 - - - - - - - - - True - True - - - - - 5 - - - - - 0 - etched-out - - - True - 1 - - - True - 3 - 3 - - - True - 0000.0000 - - - 1 - 2 - - - - - - True - 0000.0000 - - - 1 - 2 - 1 - 2 - - - - - - True - 5 - REL - 0.5 - - - 2 - 3 - - - - - - True - 5 - DTG - 0.5 - - - 2 - 3 - 1 - 2 - - - - - - True - 5 - ABS - 0.5 - - - 2 - 3 - 2 - 3 - - - - - - True - 0 - 0.5 - - - U - True - True - True - - - - - 2 - - - - - True - 1 - 0 - - - True - 0000.0000 - - - - - 2 - 2 - 3 - - - - - - - - - True - True - - - - - 6 - - - - - 0 - etched-out - - - True - 1 - - - True - 3 - 3 - - - True - 0000.0000 - - - 1 - 2 - - - - - - True - 0000.0000 - - - 1 - 2 - 1 - 2 - - - - - - True - 5 - REL - 0.5 - - - 2 - 3 - - - - - - True - 5 - DTG - 0.5 - - - 2 - 3 - 1 - 2 - - - - - - True - 5 - ABS - 0.5 - - - 2 - 3 - 2 - 3 - - - - - - True - 0 - 0.5 - - - V - True - True - True - - - - - 2 - - - - - True - 1 - 0 - - - True - 0000.0000 - - - - - 2 - 2 - 3 - - - - - - - - - True - True - - - - - 7 - - - - - 0 - etched-out - - - True - 1 - - - True - 3 - 3 - - - True - 0000.0000 - - - 1 - 2 - - - - - - True - 0000.0000 - - - 1 - 2 - 1 - 2 - - - - - - True - 5 - REL - 0.5 - - - 2 - 3 - - - - - - True - 5 - DTG - 0.5 - - - 2 - 3 - 1 - 2 - - - - - - True - 5 - ABS - 0.5 - - - 2 - 3 - 2 - 3 - - - - - - True - 0 - 0.5 - - - W - True - True - True - - - - - 2 - - - - - True - 1 - 0 - - - True - 0000.0000 - - - - - 2 - 2 - 3 - - - - - - - - - True - True - - - - - 8 - - - - - True - ../gscreen/images/linuxcnc-wizard.gif - - - 10 - - - - - - - True - - - - - 5 - GTK_FILL - GTK_FILL - - - - - True - 0 - none - - - True - - - True - - - True - - - True - False - False - - - - - 0 - - - - - True - - - - - - False - 1 - - - - - 0 - - - - - True - 0 - 0.5 - - - - - - - - - - False - False - 1 - - - - - - - True - True - automatic - automatic - - - True - False - True - 2 - 2 - True - True - True - True - True - - - - - - - True - G-code - - - False - - - - - - - - - - - - - - - - - 2 - - - - - True - - - True - 0 - etched-out - - - True - - - True - 0 - 0.5 - 12 - - - True - 0 - label - True - - - - - 0 - - - - - True - 0 - 0 - 12 - - - True - label - True - - - - - 1 - - - - - True - 0 - 0 - 12 - - - True - label - True - - - - - 2 - - - - - - - True - <b>G-Codes Active</b> - True - - - - - False - 0 - - - - - True - 0.70999997854232788 - 1 - 0.60000002384185791 - 0.5 - 1 - - - True - 0 - etched-out - - - True - 4 - 4 - - - True - 0 - 10 - FO: 100% - 10 - - - GTK_FILL - - - - - True - 0 - 10 - SO: 100% - 10 - - - 1 - 2 - GTK_FILL - - - - - True - 0 - 10 - MV:100% - 10 - - - 2 - 3 - GTK_FILL - - - - - True - 4 - 4 - - - True - 0 - 5 - Mist - - - GTK_FILL - - - - - True - 0 - 5 - Flood - - - 1 - 2 - GTK_FILL - - - - - True - 1 - yellow - - - 1 - 2 - - - - - - True - 1 - green - - - 1 - 2 - 1 - 2 - - - - - - True - 1 - Green - - - 1 - 2 - 3 - 4 - - - - - True - 0 - 5 - At Speed - - - 3 - 4 - GTK_FILL - - - - - True - 0 - 5 - Jog mode - - - 2 - 3 - GTK_FILL - - - - - True - #0635fa5df476 - 1 - blue - - - 1 - 2 - 2 - 3 - - - - - - True - 0 - 5 - continuous - - - 3 - 4 - GTK_FILL - - - - - 0 - 5 - continuous - - - 3 - 4 - 2 - 3 - GTK_FILL - - - - - 0 - 5 - 10 DPM - 10 - - - 3 - 4 - 3 - 4 - GTK_FILL - - - - - True - 0 - 5 - 10 Ipm - 10 - - - 3 - 4 - 1 - 2 - GTK_FILL - - - - - True - - - 2 - 3 - 4 - - - - - 2 - 3 - 4 - - - - - True - #bebebebebebe - #0000ffff0000 - #e21911831183 - #ffffffff0000 - False - 500 - 2000 - %d - #ffff00000000 - -7 - - - 2 - 3 - 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - True - <b>Status</b> - True - - - - - - - False - False - 1 - - - - - False - 3 - - - - - - - True - 0.49000000953674316 - Search -Text: - 0.5 - - - 0 - - - - - True - True - - - - 1 - - - - - True - - - 2 - - - - - True - Replace -Text: - 0.5 - - - 3 - - - - - True - True - - - - 4 - - - - - Replace -All - 0.5 - True - True - False - True - - - 5 - - - - - Ignore -Case - 0.5 - True - True - False - True - True - - - 6 - - - - - - - - False - 4 - - - - - - - True - <b>Mode</b> - True - - + False + end + 2 + ../../share/gscreen/images/spindle_cw.gif + + + True + True + 0 + + + + + True + False + start + 2 + FWD + + + False + True + 1 + + + + + + + 2 + 0 + + + + + True + True + True + + + True + False + True + + + True + False + end + 2 + ../../share/gscreen/images/spindle_ccw.gif + + + True + True + 0 + + + + + True + False + start + 2 + REV + + + True + True + 1 + + + + + + + 2 + 1 + + + + + + + True + False + True + + + + + gtk-open + + + + + + emblem-important + True + + + + gtk-media-pause + + + gtk-media-play + True + + + gtk-stop + + + True + False + application-exit + + + True + False + edit-delete + + + True + False + emblem-default + + + 500 + 400 + False + 5 + popup + Data Entry + center + True + dialog + True + False + False + + + True + False + 2 + + + True + False + end + + + True + True + True + image11 + + + False + False + 0 + + + + + True + True + True + image10 + + + False + False + 1 + + + + + False + False + end + 0 + + + + + True + False + 0 + out + + + True + False + sans 20 + True + + + + + True + False + <b>Calculator Entry</b> + True + + + + + False + True + 1 + + + + + + button_yes + button_no + + + + True + False + media-seek-forward + + + True + False + 32 + emblem-important + 3 + + + True + False + document-save-as + 3 + + + True + False + 27 + document-save + 3 + + + True + False + list-add + 3 + + + True + False + list-remove + 3 + + + + + + + + + test + + + test2 + + + + + 1000000 + 1 + + + False + 5 + popup + Program Restart + center-on-parent + True + dialog + + + True + False + 2 + + + True + False + end + + + Restart + True + True + True + + + False + False + 0 + + + + + Cancel + True + True + True + + + False + False + 1 + + + + + False + False + end + 0 + + + + + True + False + vertical + + + True + False + Highlighting the run-at-line with the +up / down buttons or entering the line +directly. + + + False + True + 0 + + + + + True + False + + + Line +Up + True + True + True - 1 - 3 - 5 + True + True + 0 + + + + + True + True + + restart_adjustment + + + True + True + 1 + + + + + Line +Down + True + True + True + + + True + True + 2 - - - - - True - Main Level - False + True + False + 1 + + + False + True + 1 + + + + + + restart_ok + restart_cancel + + + + gtk-save + True + gcode_view + + + gtk-save-as + document-save + gcode_view + + + False + + + + True + False + + + True + True - + + True - 0 - none + False - + True - 3 - - - True - 9 - 2 - - - True - liststore1 - - - - 0 - - - - - 1 - 2 - - - - - - - True - Themes - - - - - - - - - True - True - True - #000000000000 - - - 1 - 2 - 1 - 2 - - - - - True - Relative Text Color - - - 1 - 2 - - - - - True - Absolute Text Color - - - 2 - 3 - - - - - True - True - True - #000000000000 - - - 1 - 2 - 2 - 3 - - - - - True - True - True - #000000000000 - - - 1 - 2 - 3 - 4 - - - - - True - DTG Text Color - - - 3 - 4 - - - - - True - - - 1 - 2 - 5 - 6 - - - - - True - Warning Audio - - - 5 - 6 - - - - - True - Alert Audio - - - 6 - 7 - - - - - True - - - 1 - 2 - 6 - 7 - - - - - True - Grid Size - - - 4 - 5 - - - - - True - True - - adjustment2 - 3 - - - 1 - 2 - 4 - 5 - - - - - True - True - - adjustment3 - - - 1 - 2 - 7 - 8 - - - - - True - Starting RPM - - - 7 - 8 - - - - - - - - - - - 1 - 2 - GTK_EXPAND - GTK_EXPAND - - + False + 0 + etched-out - + + 300 True - 6 - 2 - True - - - Metric - True - True - True - - - 1 - 2 - GTK_FILL - GTK_FILL - - - - - Display -Aux Screen - 0.5 - True - True - True - - - 1 - 2 - 1 - 2 - - - - - Diameter -Mode - 0.5 - True - True - True - - - 1 - 2 - 2 - 3 - GTK_FILL - GTK_FILL - - + False + vertical - - Show -Offsets - 0.5 + True - True - True + False + 0 + etched-out + + + + True + False + + + 180 + True + False + end + 0000.0000 + 1 + + + 1 + 0 + + + + + True + False + end + 0000.0000 + 1 + + + 1 + 1 + + + + + True + False + start + 5 + REL + 0.5 + + + 2 + 0 + + + + + True + False + start + 5 + DTG + 0.5 + + + 2 + 1 + + + + + True + False + start + 5 + ABS + 0.5 + + + 2 + 2 + + + + + True + False + end + 0000.0000 + 1 + + + 0 + 2 + 2 + + + + + X + 80 + True + True + True + + + 0 + 0 + 2 + + + + + + + True + False + True + + - 1 - 2 - 3 - 4 - GTK_FILL - GTK_FILL + True + True + 0 - - Show -DTG - 0.5 + True - True - True + False + 0 + etched-out + + + + True + False + + + 180 + True + False + end + 0000.0000 + 1 + + + 1 + 0 + + + + + True + False + end + 0000.0000 + 1 + + + 1 + 1 + + + + + True + False + start + 5 + REL + 0.5 + + + 2 + 0 + + + + + True + False + start + 5 + DTG + 0.5 + + + 2 + 1 + + + + + True + False + start + 5 + ABS + 0.5 + + + 2 + 2 + + + + + Y + 80 + True + True + True + + + 0 + 0 + 2 + + + + + True + False + end + 0000.0000 + 1 + + + 0 + 2 + 2 + + + + + + + True + False + True + + - 1 - 2 - 4 - 5 - GTK_FILL - GTK_FILL + True + True + 1 - - Gscreen -Fullscreen - 0.5 - True - True - True - - - - - gtk-quit + True - True - True - True + False + 0 + etched-out + + + + True + False + + + 180 + True + False + end + 0000.0000 + 1 + + + 1 + 0 + + + + + True + False + end + 0000.0000 + 1 + + + 1 + 1 + + + + + True + False + start + 5 + REL + + + 2 + 0 + + + + + True + False + start + 5 + DTG + 0.5 + + + 2 + 1 + + + + + True + False + start + 5 + ABS + + + 2 + 2 + + + + + True + False + end + 0000.0000 + 1 + + + 0 + 2 + 2 + + + + + Z + 80 + True + True + True + + + 0 + 0 + 2 + + + + + + + True + False + True + + - 4 - 5 + True + True + 2 - - On M7 Use -Aux Coolant - 0.5 - True - True - True + + False + 0 + etched-out + + + + True + False + + + 180 + True + False + end + 0000.0000 + 1 + + + 1 + 0 + + + + + True + False + end + 0000.0000 + 1 + + + 1 + 1 + + + + + True + False + start + 5 + REL + + + 2 + 0 + + + + + True + False + start + 5 + DTG + 0.5 + + + 2 + 1 + + + + + True + False + start + 5 + ABS + 0.5 + + + 2 + 2 + + + + + True + False + end + 0000.0000 + 1 + + + 0 + 2 + 2 + + + + + A + 80 + True + True + True + + + 0 + 0 + 2 + + + + + + + True + False + True + + - 2 - 3 + True + True + 3 - - On M8 Use -Aux Coolant - 0.5 - True - True - True + + False + 0 + etched-out + + + + True + False + + + 180 + True + False + end + 0000.0000 + 1 + + + 1 + 0 + + + + + True + False + end + 0000.0000 + 1 + + + 1 + 1 + + + + + True + False + start + 5 + REL + 0.5 + + + 2 + 0 + + + + + True + False + start + 5 + DTG + 0.5 + + + 2 + 1 + + + + + True + False + 5 + ABS + + + 2 + 2 + + + + + True + False + end + 0000.0000 + 1 + + + 0 + 2 + 2 + + + + + B + 80 + True + True + True + + + 0 + 0 + 2 + + + + + + + True + False + True + + - 3 - 4 + True + True + 4 - - Hide Pointer - True - True - True + + False + 0 + etched-out + + + + True + False + + + 180 + True + False + end + 0000.0000 + 1 + + + 1 + 0 + + + + + True + False + end + 0000.0000 + 1 + + + 1 + 1 + + + + + True + False + start + 5 + REL + 0.5 + + + 2 + 0 + + + + + True + False + start + 5 + DTG + 0.5 + + + 2 + 1 + + + + + True + False + start + 5 + ABS + 0.5 + + + 2 + 2 + + + + + True + False + end + 0000.0000 + 1 + + + 0 + 2 + 2 + + + + + C + 80 + True + True + True + + + 0 + 0 + 2 + + + + + + + True + False + True + + - 1 - 2 + True + True + 5 - - Desktop -Notification - 0.5 - True - True - True + + False + 0 + etched-out + + + + True + False + + + 180 + True + False + end + 0000.0000 + 1 + + + 1 + 0 + + + + + True + False + end + 0000.0000 + 1 + + + 1 + 1 + + + + + True + False + start + 5 + REL + 0.5 + + + 2 + 0 + + + + + True + False + start + 5 + DTG + 0.5 + + + 2 + 1 + + + + + True + False + start + 5 + ABS + 0.5 + + + 2 + 2 + + + + + True + False + end + 0000.0000 + 1 + + + 0 + 2 + 2 + + + + + U + 80 + True + True + True + + + 0 + 0 + 2 + + + + + + + True + False + True + + - 1 - 2 - 5 - 6 - GTK_FILL - GTK_FILL - - - - - - - - GTK_EXPAND - GTK_EXPAND - - - - - - - - - - True - True - - - - - 1 - False - - - - - True - Preferences - - - 1 - False - - - - - True - - - True - True - - - True - True - never - out - - - - - - - - True - Debug - - - False - - - - - - - - - - - True - True - automatic - automatic - - - True - True - False - False - alarm_buffer + True + True + 6 + + + + + False + 0 + etched-out + + + + True + False + + + 180 + True + False + end + 0000.0000 + 1 + + + 1 + 0 + + + + + True + False + end + 0000.0000 + 1 + + + 1 + 1 + + + + + True + False + start + 5 + REL + 0.5 + + + 2 + 0 + + + + + True + False + start + 5 + DTG + 0.5 + + + 2 + 1 + + + + + True + False + start + 5 + ABS + 0.5 + + + 2 + 2 + + + + + True + False + end + 0000.0000 + 1 + + + 0 + 2 + 2 + + + + + V + 80 + True + True + True + + + 0 + 0 + 2 + + + + + + + True + False + True + + + + True + True + 7 + - - - 2 - - - - - True - Alarm History - - - 2 - False - - - - - 0 - - - - - True - True - - - Launch -Halshow - 0.5 - True - True - True - - - 0 - - - - - Calibration - True - True - True - - - 1 - - - - - Halmeter - True - True - True - - - 2 - - - - - LinuxCNC -Status - 0.5 - True - True - True - - - 3 - - - - - Halscope - True - True - True - - - 4 - - - - - Ladder - True - True - True - - - 5 - - - - - - - - - - - False - False - 1 - - - - - 2 - - - - - True - Debug - - - 2 - False - - - - - True - - - 3 - - - - - True - Tooleditor - - - 3 - False - - - - - True - - - 4 - - - - - True - Offset -Page - 0.5 - - - 2 - False - - - - - 6 - 1 - 9 - - - - - True - 0.50999999046325684 - - - True + + + False + 0 + etched-out + + + + True + False + + + 180 + True + False + end + 0000.0000 + 1 + + + 1 + 0 + + + + + True + False + end + 0000.0000 + 1 + + + 1 + 1 + + + + + True + False + start + 5 + REL + 0.5 + + + 2 + 0 + + + + + True + False + start + 5 + DTG + 0.5 + + + 2 + 1 + + + + + True + False + start + 5 + ABS + 0.5 + + + 2 + 2 + + + + + True + False + end + 0000.0000 + 1 + + + 0 + 2 + 2 + + + + + W + 80 + True + True + True + + + 0 + 0 + 2 + + + + + + + True + False + True + + + + + True + True + 8 + + + + + True + False + True + ../../share/gscreen/images/linuxcnc-wizard.gif + + + True + True + 10 + + + + + + + False + True + + + + + 0 + 0 + + - + True - True - True + False + True + 0.009999999776482582 + none - + True + False + vertical + + + True + False + vertical + + + True + False + + + True + False + False + True + True + False + + + + + True + True + 0 + + + + + True + False + + + + + + False + True + 1 + + + + + True + True + 0 + + + + + False + + + + + + True + True + 1 + + + + + False + + + True + True + + + True + False + True + 2 + 2 + True + True + True + True + True + + + + + + + True + False + G-code + + + False + + + + + + + + + + + + + + + + + True + True + 2 + + + + + True + False + + + True + False + 2.2351741291171123e-10 + etched-out + + + True + False + True + vertical + + + True + False + start + True + label + True + 0 + + + True + True + 0 + + + + + True + False + start + True + label + True + + + True + True + 1 + + + + + True + False + start + True + label + True + + + True + True + 2 + + + + + + + True + False + <b>Active Codes</b> + True + + + + + True + True + 0 + + + + + True + False + 0 + etched-out + + + + True + False + True + + + True + False + 10 + FO: 100% + 10 + 0 + + + 0 + 0 + + + + + True + False + 10 + SO: 100% + 10 + 0 + + + 0 + 1 + + + + + True + False + 10 + MV:100% + 10 + 0 + + + 0 + 2 + + + + + + True + False + True + + + True + False + 5 + Mist + 0 + + + 0 + 0 + + + + + True + False + 5 + Flood + 0 + + + 0 + 1 + + + + + True + False + 0 + 1 + yellow + + + 1 + 0 + + + + + True + False + 0 + 1 + + + 1 + 1 + + + + + True + False + 0 + 1 + Green + + + 1 + 3 + + + + + True + False + 5 + At Speed + 0 + + + 0 + 3 + + + + + True + False + 5 + Jog mode + 0 + + + 0 + 2 + + + + + True + False + 0 + 1 + blue + #0635fa5df476 + + + 1 + 2 + + + + + True + False + 5 + continuous + 0 + + + 3 + 0 + + + + + False + 5 + continuous + 0 + + + 3 + 2 + + + + + False + 5 + 10 DPM + 10 + 0 + + + 3 + 3 + + + + + True + False + 5 + 10 Ipm + 10 + 0 + + + 3 + 1 + + + + + True + False + 2 + 2 + vertical + + + 2 + 0 + 4 + + + + + 2 + 0 + 4 + + + + + True + False + #bebebebebebe + 2000 + False + #e21911831183 + 500 + %d + -7 + #0000ffff0000 + #ffffffff0000 + #ffff00000000 + + + 0 + 3 + + + + + + + + + + + + + + + + + + + True + False + <b>Status</b> + True + + + + + True + True + 1 + + + + + False + True + 3 + + - - True - True + + False - + True - 5 - Estop + False + Search +Text: + 0.5 + True + True 0 - + True - 5 - Machine off + True + + True + True 1 - - - 0 - - - - - True - + True - 1 - green - 200 + False - False - 0 + True + True + 2 + + + + + True + False + Replace +Text: + 0.5 + + + True + True + 3 - + True - 1 - green - red + True + - False - 1 + True + True + 4 + + + + + Replace +All + True + True + False + True + + + True + True + 5 + + + + + Ignore +Case + True + True + False + True + True + + + True + True + 6 + + + False - 1 + True + 4 + + + True + False + <b>Mode</b> + True + + - False - False - 0 + 1 + 0 + + + + + True + False + Main Level + + + False + + + + + True + False + center + center + False + False + 0 + none - + + + 100 + 80 True + False + 40 - + + True - True + False + 4 + True + + + True + False + liststore1 + + + + 0 + + + + + 1 + 0 + + - + True - True - True - hal_action_stop - image15 - right + False + 4 + Themes + 1 - 0 + 0 + 0 - - Zero Origin + True - True - True + True + True - 1 + 1 + 1 - - Offset Origin + True - True - True + False + 4 + Relative Text Color + 1 - 2 + 0 + 1 - + True - True - True - image8 - bottom + False + 4 + Absolute Text Color + 1 - 3 + 0 + 2 - + True - True - True - image9 + True + True - 4 + 1 + 2 - - + True - True - True + True + True - 5 + 1 + 3 - - Tool Setting + True - True - True + False + 4 + DTG Text Color + 1 - 6 + 0 + 3 - - True - True + + True + False - 7 + 1 + 5 + + + + + True + False + 4 + Warning Audio + 1 + + + 0 + 5 + + + + + True + False + 4 + Alert Audio + 1 + + + 0 + 6 + + + + + True + False + + + 1 + 6 + + + + + True + False + 4 + Grid Size + 1 + + + 0 + 4 + + + + + True + True + + 0.000 + adjustment2 + 3 + + + 1 + 4 + + + + + True + True + + 300 + adjustment3 + 300 + + + 1 + 7 + + + + + True + False + 4 + Starting RPM + 1 + + + 0 + 7 + + + + + 1 + 0 + + + + + + True + False + 4 + 4 + True + True + + + Metric + True + True + True + + + 1 + 0 + + + + + Display +Aux Screen + True + True + True + + + 1 + 1 + + + + + Diameter +Mode + True + True + True + + + 1 + 2 + + + + + Show +Offsets + True + True + True + + + 1 + 3 - - - 0 - - - - - True - + + Show +DTG True - hal_toggleaction_stop - Stop - True + True + True - 0 + 1 + 4 - + + Gscreen +Fullscreen True - hal_toggleaction_run - Run - True - gtk-media-play - + True + True - 1 + 0 + 0 - + + Quit True - hal_toggleaction_pause - Pause - True - gtk-media-pause + True + True + image-exit - 2 + 0 + 4 - - Single -Step - 0.5 + + On M7 Use +Aux Coolant True - True - True - hal_action_step + True + True - 3 + 0 + 2 - - Run At -Line - 0.5 + + On M8 Use +Aux Coolant True - True - True + True + True - 4 + 0 + 3 - - Change -View - 0.5 + + Hide Pointer True - True - True + True + True - 5 + 0 + 1 - - Edit + + Desktop +Notification True - True - True + True + True - 6 + 1 + 5 @@ -2770,237 +2693,315 @@ View - 1 + 0 + 0 + + + + + True + False + True + + + + + 1 + False + + + + + True + False + Preferences + + + 1 + False + + + + + True + False + vertical + + + True + True - - True - - - - - - - - - + + True + True + never + out + + + + + True + False + Debug + + + False + + + + + + + + + + + True + True - + + True + True + False + False + alarm_buffer + 2 + + + True + False + Alarm History + + + 2 + False + + - 1 + True + True + 0 - - - - - - - - - - + True - 0 - none + False + True - + + Launch +Halshow True - - - - - True - True - - - 0 - - - - - Homing - True - True - True - - - 1 - - - - - True - True - True - - - True - - - True - Ignore -Limits - 0.5 - - - 0 - - - - - True - 5 - False - - - False - 1 - - - - - - - False - False - 2 - - - - - Set -Override - 0.5 - True - True - True - - - False - False - 3 - - - - - Graphics - True - True - True - - - False - False - 4 - - - - - Menu -Level - 0.5 - True - True - - - False - False - 5 - - - - - Launch -Keyboard - 0.5 - True - True - True - - - False - False - 6 - - + True + True + + True + True + 0 + - - + + + Calibration + True + True + True + + + True + True + 1 + + + + + Halmeter + True + True + True + + + True + True + 2 + + + + + LinuxCNC +Status + True + True + True + + + True + True + 3 + + + + + Halscope + True + True + True + + + True + True + 4 + + + + + Ladder True - <b>Select Buttons</b> - True + True + True + + True + True + 5 + + + + + + + False False - 5 + 1 + + 2 + + + + + True + False + Debug + + + 2 + False + + + + + True + False + + + 3 + + + + + True + False + Tooleditor + + + 3 + False + + + + + True + False + + + 4 + + + + + True + False + Offset +Page + 0.5 + + + 2 + False + - 6 - 7 - 1 - 9 - GTK_FILL + 0 + 1 + 6 + 8 button True - True - True + True + True image12 - right + right - 6 - 7 - 9 - 10 - GTK_FILL - GTK_FILL + 6 + 9 - + True + False + vertical True - + + False True True + False + True + True 0 True + False + True + True 1 @@ -3008,10 +3009,12 @@ Keyboard Home All True - True - True + True + True + True + True 2 @@ -3019,10 +3022,12 @@ Keyboard Home Axis True - True - True + True + True + True + True 3 @@ -3030,12 +3035,13 @@ Keyboard Unhome All - 0.5 True - True - True + True + True + True + True 4 @@ -3043,12 +3049,13 @@ All Unhome Axis - 0.5 True - True - True + True + True + True + True 5 @@ -3056,12 +3063,13 @@ Axis Toggle Readout - 0.5 True - True - True + True + True + True + True 6 @@ -3071,23 +3079,27 @@ Readout False + True 0 - + True + False True Jogging Mode - 0.5 True - True - True + True + True + 0.5 + True + True 0 @@ -3095,44 +3107,51 @@ Mode coordinate System - 0.5 True - True - True + True + True + True + True 1 True - True - True + True + True True - ../gscreen/images/coolant_mist_plain.gif + False + ../../share/gscreen/images/coolant_mist_plain.gif + True + True 2 True - True - True + True + True True - ../gscreen/images/coolant_flood_plain.gif + False + ../../share/gscreen/images/coolant_flood_plain.gif + True + True 3 @@ -3140,12 +3159,13 @@ System Index Tool - 0.5 True - True - True + True + True + True + True 4 @@ -3153,12 +3173,13 @@ Tool Spindle Controls - 0.5 True - True - True + True + True + True + True 5 @@ -3166,12 +3187,13 @@ Controls Toggle Readout - 0.5 True - True - True + True + True + True + True 6 @@ -3179,60 +3201,72 @@ Readout Show Offsets - 0.5 True - True - True + True + True + True + True 7 + True + True 1 - + + False True True - True - True + True + True + True + True 0 True - True - True + True + True + True + True 1 True - True - True + True + True + True + True 2 True - True - True + True + True + True + True 3 @@ -3241,20 +3275,24 @@ Offsets True - True - True + True + True + True + True 4 True - True - True + True + True + True + True 5 @@ -3266,22 +3304,28 @@ Offsets + True + True 2 - + + False True + hal_action_open True - Load Program - hal_action_open + False + Load Program Open - True - gtk-open + True + document-open + True + True 0 @@ -3289,12 +3333,13 @@ Offsets Block Delete - 0.5 True - True - True + True + True + True + True 1 @@ -3302,12 +3347,13 @@ Delete Optional Stop - 0.5 True - True - True + True + True + True + True 2 @@ -3315,36 +3361,46 @@ Stop Full View - 0.5 True - True - True + True + True + True + True 3 True + False + True + True 4 True + False + True + True 5 True + False + True + True 6 @@ -3352,34 +3408,38 @@ View Next Tab - 0.5 True - True - True + True + True + True + True 7 + True + True 3 - + + False True Feed Override - 0.5 True - True - True + True + True False + True 0 @@ -3387,13 +3447,13 @@ Override Spindle Override - 0.5 True - True - True + True + True False + True 1 @@ -3401,21 +3461,24 @@ Override Rapid Override - 0.5 True - True - True + True + True False + True 2 True + False + True + True 3 @@ -3423,13 +3486,13 @@ Override Jog Speed - 0.5 True - True - True + True + True False + True 4 @@ -3437,13 +3500,13 @@ Speed Jog Increments - 0.5 True - True - True + True + True False + True 5 @@ -3454,59 +3517,68 @@ Increments Adjust Rotary - 0.5 True - True - True + True + True False + True 7 False + True 4 - + + False True Change View - 0.5 True - True - True + True + True + True + True 0 True - True - True + True + True True - ../gscreen/images/tool_clear.gif + False + ../../share/gscreen/images/tool_clear.gif + True + True 1 True + False + True + True 2 @@ -3514,11 +3586,12 @@ Rotary Zoom True - True - True + True + True False + True 3 @@ -3526,13 +3599,13 @@ Rotary Pan Vertical - 0.5 True - True - True + True + True False + True 4 @@ -3540,13 +3613,13 @@ Vertical Pan Horizontal - 0.5 True - True - True + True + True False + True 5 @@ -3554,13 +3627,13 @@ Horizontal Rotate Horiontal - 0.5 True - True - True + True + True False + True 6 @@ -3568,34 +3641,37 @@ Horiontal Rotate Vertical - 0.5 - True - True + True + True False + True 7 False + True 5 - + + False True Search Bwd - 0.5 True - True - True + True + True + True + True 0 @@ -3603,12 +3679,13 @@ Bwd Search Fwd - 0.5 True - True - True + True + True + True + True 1 @@ -3616,10 +3693,12 @@ Fwd Undo True - True - True + True + True + True + True 2 @@ -3627,34 +3706,40 @@ Fwd Redo True - True - True + True + True + True + True 3 + hal_action_save True - True - True - hal_action_save + True + True image3 + True + True 4 + hal_action_saveas True - True - True - hal_action_saveas + True + True image2 + True + True 5 @@ -3662,13 +3747,14 @@ Fwd Reload Program - 0.5 + hal_action_reload True - True - True - hal_action_reload + True + True + True + True 6 @@ -3676,38 +3762,43 @@ Program Replace Text - 0.5 True - True - True + True + True + True + True 7 + True + True 6 - 6 - 9 - 10 - GTK_FILL - GTK_FILL + 0 + 9 + 6 - + True + False True + False 1 + True + True 0 @@ -3715,10 +3806,9 @@ Text Clear status - 0.5 True - True - True + True + True False @@ -3728,43 +3818,46 @@ status - 5 - GTK_FILL - GTK_FILL + 0 + 0 + 5 - + True + False True - 0 - etched-out + False + 0 + 0 + etched-out True + False G54 - - - True - True - + + + True + True 0 calc - 50 + 50 True - True - True + True + True False @@ -3773,498 +3866,656 @@ status - - Inch - 50 - True - True - True - - - False - False - 2 - - - - - 5 - 7 - GTK_FILL - - - - - - - - - - - - - - - - - - - - - - - - - - - - -10000 - 10000 - 1 - - - - True - gtk-save-as - 3 - - - - - - - - - test - - - test2 - - - - - gtk-media-play - True - - - gtk-stop - - - gtk-open - - - - gtk-media-pause - - - - True - gtk-add - 3 - - - True - gtk-remove - 3 - - - gtk-save-as - document-save - gcode_view - - - gtk-save - True - gcode_view - - - True - 27 - document-save - 3 - - - 500 - 400 - 5 - popup - Data Entry - center - True - dialog - True - False - False - - - True - 2 - - - True - 0 - out - - - True - sans 20 - True - - - - - True - <b>Calculator Entry</b> - True - - - - - 1 - - - - - True - end - - - True - True - True - image11 - - - False - False - 0 - - - - - True - True - True - image10 - - - False - False - 1 - - - - - False - end - 0 - - - - - - button_yes - button_no - - - - True - gtk-cancel - - - True - gtk-apply - - - True - gtk-media-forward - - - - emblem-important - True - - - True - 32 - emblem-important - 3 - - - 100 - 0.25 - - - 300 - 1 - 10000 - 50 - - - 5 - popup - Program Restart - center-on-parent - True - dialog - - - True - 2 + + Inch + 50 + True + True + True + + + False + False + 2 + + + + + 5 + 0 + 2 + + - + True + False + vertical - + True - Highlighting the run-at-line with the -up / down buttons or entering the line -directly. + True + True + + + True + False + + + True + False + vertical + True + + + True + False + 5 + Estop + + + True + True + 0 + + + + + True + False + 5 + Machine off + + + True + True + 1 + + + + + True + True + 0 + + + + + True + False + vertical + + + True + False + 200 + 1 + green + + + False + True + 0 + + + + + True + False + 0 + 1 + + + False + True + 1 + + + + + False + True + 1 + + + + False + False 0 - + True + False - - Line -Up - 0.5 + True - True - True + False + vertical + True + + + hal_action_stop + True + True + True + image15 + True + right + True + + + True + True + 0 + + + + + Zero Origin + True + True + True + + + True + True + 1 + + + + + Offset Origin + True + True + True + + + True + True + 2 + + + + + True + True + True + image8 + bottom + + + True + True + 3 + + + + + True + True + True + image9 + + + True + True + 4 + + + + + True + True + True + + + True + True + 5 + + + + + Tool Setting + True + True + True + + + True + True + 6 + + + + + True + True + + + True + True + 7 + + + True + True 0 - + + False + vertical + True + + + hal_toggleaction_stop + True + False + Stop + True + + + True + True + 0 + + + + + hal_toggleaction_run + True + False + Run + True + media-playback-start + + + + True + True + 1 + + + + + hal_toggleaction_pause + True + False + Pause + True + media-playback-pause + + + True + True + 2 + + + + + hal_action_step + True + True + True + True + + + True + True + 3 + + + + + Run At +Line + True + True + True + + + True + True + 4 + + + + + Change +View + True + True + True + + + True + True + 5 + + + + + Edit + True + True + True + + + True + True + 6 + + + + + + + + True + True + 1 + + + + + False + vertical + True + + + + + + + + + + + + + + + + + + True + True + 2 + + + + + True + True + 1 + + + + + + + + + + + + + + True + False + 0 + none + + True - True - - restart_adjustment + False + vertical + + + + + True + True + + + True + True + 0 + + + + + Homing + True + True + True + + + True + True + 1 + + + + + True + True + True + + + True + False + + + True + False + Ignore +Limits + 0.5 + + + True + True + 0 + + + + + True + False + False + 0 + 5 + + + False + True + 1 + + + + + + + False + False + 2 + + + + + Set +Override + True + True + True + + + False + False + 3 + + + + + Graphics + True + True + True + + + False + False + 4 + + + + + Menu +Level + True + True + + + False + False + 5 + + + + + Launch +Keyboard + True + True + True + + + False + False + 6 + + - - 1 - - - - Line -Down - 0.5 + + True - True - True + False + <b>Select Buttons</b> + True - - 2 - - - False - 1 - - - - - 1 - - - - - True - end - - - Restart - True - True - True - - - False - False - 0 - - - - - Cancel - True - True - True - False False - 1 + 5 - False - end - 0 + 6 + 1 + 8 - - - - restart_ok - restart_cancel - - - - 1000000 - 1 - - - - True - 0 - none - - - True - 2 - 3 - True - - S 1000 - True - True - True - - - 1 - 2 - 1 - 2 - GTK_FILL - + - - Start - True - True - True - - - 1 - 2 - GTK_FILL - + - - + - True - True - True - - - GTK_FILL - + - - - - True - True - True - - - 1 - 2 - GTK_FILL - + - - True - True - True - - - True - - - True - ../gscreen/images/spindle_cw.gif - - - 0 - - - - - True - FWD - - - False - 1 - - - - - - - 2 - 3 - + - - True - True - True - - - True - - - True - ../gscreen/images/spindle_ccw.gif - - - 0 - - - - - True - REV - - - 1 - - - - - - - 2 - 3 - 1 - 2 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - True - True diff --git a/src/emc/usr_intf/gscreen/gscreen.py b/src/emc/usr_intf/gscreen/gscreen.py index 0d707adb94c..8d28e0efe20 100755 --- a/src/emc/usr_intf/gscreen/gscreen.py +++ b/src/emc/usr_intf/gscreen/gscreen.py @@ -18,7 +18,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. """ -# Gscreen is made for running linuxcnc CNC machines +# Gscreen is made for running LinuxCNC CNC machines # Gscreen was built with touchscreens in mind though a mouse works too. # a keyboard is necessary for editing gcode # Gscreen is, at it's heart, a gladevcp program though loaded in a non standard way. @@ -27,48 +27,73 @@ # you would need to calibrate your touchscreen to just work on a single screen """ import sys,os,subprocess + def _print_help(): - print(""" Gscreen a customizable operator screen for linuxcnc based on pyGTK / GLADE.\n - It is usually loaded from linuxcnc's INI file under the [DISPLAY] HEADER - eg. DISPLAY = gscreen\n - Options: - --INI.................Designates the configuration file path for linuxcnc - -c....................Loads an optional skin for Gscreen - -d....................Debug mode - -v....................Verbose debug mode - -F....................Prints documentation of internal functions to standard output - """) - sys.exit(0) + print("""\nGscreen is a customizable operator screen for LinuxCNC based on PyGTK3 / Glade.\n + It is usually loaded from LinuxCNC's INI file under the [DISPLAY] section. + eg. DISPLAY = gscreen\n + Options: + --INI.................Designates the configuration file path for LinuxCNC + -c....................Loads an optional skin for Gscreen + -q....................Quiet logging - only log errors and critical + -i....................Info logging + -d....................Debug logging + -v....................Verbose logging + -F....................Prints names of internal functions to standard output + -FD...................Prints names and documentation of internal functions to standard output + -h or --help..........Show this help text\n + If q, i, v, or d are not specified then logging will default to Warning logging. + """) + sys.exit(0) for num,temp in enumerate(sys.argv): - if temp == '-h' or temp == '--help' or len(sys.argv) == 1: - _print_help() + if temp == '-h' or temp == '--help' or len(sys.argv) == 1: + _print_help() # Set up the base logger # We have do do this before importing other modules because on import # they set up their own loggers as children of the base logger. + +# If log_file is none, logger.py will attempt to find the log file specified in +# INI [DISPLAY] LOG_FILE, failing that it will log to $HOME/.log + +# Note: In all other modules it is best to use the `__name__` attribute +# to ensure we get a logger with the correct hierarchy. +# Ex: LOG = logger.getLogger(__name__) + +# we set the log level early so the imported modules get the right level +# The order is: VERBOSE, DEBUG, INFO, WARNING, ERROR, CRITICAL. + from qtvcp import logger -LOG = logger.initBaseLogger('GScreen', log_file=None, log_level=logger.INFO) +LOG = logger.initBaseLogger('GScreen', log_file=None, log_level=logger.WARNING) + +if '-d' in sys.argv: + # Log level defaults to WARNING, so set lower if in debug mode + logger.setGlobalLevel(logger.DEBUG) + LOG.debug('DEBUGGING logging on') +elif '-i' in sys.argv: + # Log level defaults to WARNING, so set lower if in info mode + logger.setGlobalLevel(logger.INFO) + LOG.info('INFO logging on') +elif '-v' in sys.argv: + # Log level defaults to WARNING, so set lowest if in verbose mode + logger.setGlobalLevel(logger.VERBOSE) + LOG.verbose('VERBOSE logging on') + # Log level defaults to WARNING, so set higher if in quiet mode (error and critical) +elif '-q' in sys.argv: + logger.setGlobalLevel(logger.ERROR) import gi gi.require_version("Gtk","3.0") gi.require_version("Gdk","3.0") -gi.require_version('PangoCairo', '1.0') -from gi.repository import Gtk,Gdk,GObject,Pango,PangoCairo,cairo,GLib +from gi.repository import Gtk, Gdk, GLib from gi.repository import Pango as pango -try: - from gi.repository import Vte as vte -except: - LOG.error("**** WARNING GSCREEN: could not import vte terminal - is package installed?") import hal import errno import gladevcp.makepins -from gladevcp.gladebuilder import GladeBuilder -#import pango import traceback import atexit - import time from time import strftime,localtime import hal_glib @@ -90,30 +115,40 @@ def _print_help(): # https://launchpad.net/~leolik/+archive/leolik?field.series_filter=lucid NOTIFY_AVAILABLE = False try: - import pynotify - if not pynotify.init("Gscreen"): - print("**** GSCREEN INFO: There was a problem initializing the pynotify module") - else: + gi.require_version('Notify', '0.7') + from gi.repository import Notify + if Notify.init("Gscreen"): NOTIFY_AVAILABLE = True + LOG.info(_("Desktop notifications are available")) + else: + LOG.warning(_("Desktop notifications are not available")) except: - print("**** GSCREEN INFO: You don't seem to have pynotify installed") + LOG.warning(_("There was a problem initializing the notification module")) -_AUDIO_AVAILABLE = False # try to add ability for audio feedback to user. try: - import pygst - pygst.require("0.10") - import gst + gi.require_version('Gst', '1.0') + from gi.repository import Gst _AUDIO_AVAILABLE = True - print("**** GSCREEN INFO: audio available!") + LOG.info(_("Audio alerts are available!")) except: - print("**** GSCREEN WARNING: no audio alerts available - Is python-gst0.10 library installed?") + _AUDIO_AVAILABLE = False + LOG.warning(_("No audio alerts are available - Is gir1.2-gstreamer-1.0 package installed?")) + +# try to add ability to show an embedded terminal for debugging +try: + gi.require_version('Vte', '2.91') + from gi.repository import Vte + _TERMINAL_AVAILABLE = True +except: + _TERMINAL_AVAILABLE = False + LOG.warning("Could not import Vte terminal - is gir1.2-vte-2.91 package installed?") # BASE is the absolute path to linuxcnc base # libdir is the path to Gscreen python files # datadir is where the standard GLADE files are # imagedir is for icons -# themedir is path to system's GTK2 theme folder +# themedir is path to system's GTK3 theme folder BASE = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "..")) libdir = os.path.join(BASE, "lib", "python") datadir = os.path.join(BASE, "share", "linuxcnc") @@ -123,6 +158,23 @@ def _print_help(): themedir = "/usr/share/themes" userthemedir = os.path.join(os.path.expanduser("~"), ".themes") +# set soundsdir based on distribution +soundsdir = '/usr/share/sounds/freedesktop/stereo' +if not os.path.exists(soundsdir): + try: + import distro + if 'mint' in distro.id().lower(): + soundsdir = '/usr/share/sounds/LinuxMint/stereo' + if not os.path.exists(soundsdir): + LOG.error(f'Audio player - Mint sound file directory not found: {soundsdir}') + soundsdir = None + else: + LOG.error(f'Audio player - Could not find sounds directory for {distro.id()} distro') + soundsdir = None + except: + LOG.error(f'Audio player - Could not find sounds directory - Is python3-distro installed?') + soundsdir = None + xmlname = os.path.join(datadir,"gscreen.glade") xmlname2 = os.path.join(datadir,"gscreen2.glade") ALERT_ICON = os.path.join(imagedir,"applet-critical.png") @@ -131,7 +183,6 @@ def _print_help(): # internationalization and localization import locale, gettext - # path to TCL for external programs eg. halshow try: TCLPATH = os.environ['LINUXCNC_TCL_DIR'] @@ -149,22 +200,10 @@ def _print_help(): from gscreen import preferences from gscreen import keybindings -# this is for hiding the pointer when using a touch screen -#pixmap = gdk.Pixmap(None, 1, 1, 1) -#color = gdk.Color() -#INVISABLE = gdk.Cursor(pixmap, pixmap, color, color, 0, 0) +# this is for hiding/showing the pointer when using a touch screen +VISIBLE = Gdk.Cursor(Gdk.CursorType.ARROW) INVISIBLE = Gdk.Cursor(Gdk.CursorType.BLANK_CURSOR) -# to help with debugging new screens -verbose_debug = False -# print debug messages if debug is true -gscreen_debug = False - -def dbg(str): - global gscreen_debug - if not gscreen_debug: return - print(str) - # Throws up a dialog with debug info when an error is encountered def excepthook(exc_type, exc_obj, exc_tb): try: @@ -174,18 +213,21 @@ def excepthook(exc_type, exc_obj, exc_tb): except NameError: w = None lines = traceback.format_exception(exc_type, exc_obj, exc_tb) - global excepthook_msg_ct,excepthook_msg_ct_max + text = '' + for n in lines: + text += n + e = Gscreen.get_exception_list(None, text) + global excepthook_msg_ct, excepthook_msg_ct_max excepthook_msg_ct += 1 if excepthook_msg_ct < excepthook_msg_ct_max: - print("*******************************************************\n",excepthook_msg_ct) - print("".join(lines)) - print("*******************************************************\n",excepthook_msg_ct) + gap = ' ' * 18 + LOG.error(f"Exception #{excepthook_msg_ct}\n{gap}{gap.join(e)}") if excepthook_msg_ct < 1: m = Gtk.MessageDialog( parent = w, message_type = Gtk.MessageType.ERROR, buttons = Gtk.ButtonsType.OK, - text = ("Gscreen encountered an error. The following " + text = ("Gscreen encountered an error. The following " "information may be useful in troubleshooting:\n\n") + "".join(lines), modal=True, @@ -205,16 +247,17 @@ def excepthook(exc_type, exc_obj, exc_tb): # http://pygstdocs.berlios.de/pygst-tutorial/introduction.html class Player: def __init__(self): + Gst.init(None) #Element playbin automatic plays any file - self.player = gst.element_factory_make("playbin", "player") + self.player = Gst.ElementFactory.make("playbin", "player") #Enable message bus to check for errors in the pipeline bus = self.player.get_bus() bus.add_signal_watch() bus.connect("message", self.on_message) - self.loop = gobject.MainLoop() + self.loop = GLib.MainLoop() def run(self): - self.player.set_state(gst.STATE_PLAYING) + self.player.set_state(Gst.State.PLAYING) self.loop.run() def set_sound(self,file): @@ -223,15 +266,15 @@ def set_sound(self,file): def on_message(self, bus, message): t = message.type - if t == gst.MESSAGE_EOS: + if t == Gst.MessageType.EOS: #file ended, stop - self.player.set_state(gst.STATE_NULL) + self.player.set_state(Gst.State.NULL) self.loop.quit() - elif t == gst.MESSAGE_ERROR: + elif t == Gst.MessageType.ERROR: #Error occurred, print and stop - self.player.set_state(gst.STATE_NULL) + self.player.set_state(Gst.State.NULL) err, debug = message.parse_error() - print( "Error: %s" % err, debug) + LOG.error("{} {}".format(err, debug)) self.loop.quit() # a class for holding the glade widgets rather then searching for them each time @@ -240,11 +283,11 @@ def __init__(self, xml): self._xml = xml def __getattr__(self, attr): r = self._xml.get_object(attr) - if r is None: raise AttributeError( "No widget %r" % attr) + if r is None: raise AttributeError(_("No widget '{}'").format(attr)) return r def __getitem__(self, attr): r = self._xml.get_object(attr) - if r is None: raise IndexError( "No widget %r" % attr) + if r is None: raise IndexError(_("No widget '{}'").format(attr)) return r # a class for holding data @@ -356,8 +399,8 @@ def __init__(self): self.diameter_mode = True self.tooleditor = "" self.tooltable = "" - self.alert_sound = "/usr/share/sounds/ubuntu/stereo/bell.ogg" - self.error_sound = "/usr/share/sounds/ubuntu/stereo/dialog-question.ogg" + self.alert_sound = "" + self.error_sound = "" self.ob = None self.index_tool_dialog = None self.keyboard_dialog = None @@ -398,33 +441,33 @@ def add_handler(method, f): directory = '.' if directory not in sys.path: sys.path.insert(0,directory) - print(_('adding import dir %s' % directory)) + LOG.info(_("Adding import dir {}").format(directory)) try: mod = __import__(basename) except ImportError as msg: - print("module '%s' skipped - import error: %s" %(basename,msg)) + LOG.error(_("Module '{}' skipped - import error: {}").format(basename, msg)) continue - print(_("module '%s' imported OK" % mod.__name__)) + LOG.info(_("Module '{}' imported OK").format(mod.__name__)) try: # look for functions for temp in ("periodic","connect_signals","initialize_widgets"): h = getattr(mod,temp,None) if h and callable(h): - print( ("module '%s' : '%s' function found" % (mod.__name__,temp))) + LOG.info(_("Module '{}': '{}' function found").format(mod.__name__, temp)) # look for 'get_handlers' function h = getattr(mod,hdl_func,None) if h and callable(h): - print( ("module '%s' : '%s' function found" % (mod.__name__,hdl_func))) + LOG.info(_("Module '{}': '{}' function found").format(mod.__name__, hdl_func)) objlist = h(halcomp,builder,useropts,gscreen) else: # the module has no get_handlers() callable. # in this case we permit any callable except class Objects in the module to register as handler - dbg("module '%s': no '%s' function - registering only functions as callbacks" % (mod.__name__,hdl_func)) + LOG.debug(_("Module '{}': no '{}' function - registering only functions as callbacks").format(mod.__name__,hdl_func)) objlist = [mod] # extract callback candidates for object in objlist: - dbg("Registering handlers in module %s object %s" % (mod.__name__, object)) + LOG.debug(_("Registering handlers in module '{}' object '{}'").format(mod.__name__, object)) if isinstance(object, dict): methods = list(dict.items()) else: @@ -433,10 +476,10 @@ def add_handler(method, f): if method.startswith('_'): continue if callable(f): - dbg("Register callback '%s' in %s" % (method, basename)) + LOG.debug(("Register callback '{}' in {}").format(method, basename)) add_handler(method, f) except Exception as e: - print ("**** GSCREEN ERROR: trouble looking for handlers in '%s': %s" %(basename, e)) + LOG.error(_("Trouble looking for handlers in '{}': {}").format(basename, e)) traceback.print_exc() # Wrap lists in Trampoline, unwrap single functions @@ -455,13 +498,11 @@ def add_handler(method, f): # emc_interface.py which does most of the commands and status of linuxcnc # keep in mind some of the gladeVCP widgets send-commands-to/monitor linuxcnc also -class Gscreen: +class Gscreen: def __init__(self): global xmlname global xmlname2 - global gscreen_debug - global verbose_debug self.skinname = "gscreen" (progdir, progname) = os.path.split(sys.argv[0]) @@ -471,19 +512,20 @@ def __init__(self): for num,temp in enumerate(sys.argv): if temp == '-c': try: - print (("**** GSCREEN INFO: Skin name ="),sys.argv[num+1]) + LOG.info(_("Skin name = {}").format(sys.argv[num+1])) self.skinname = sys.argv[num+1] except: pass - if temp == '-d': gscreen_debug = True - if temp == '-v': verbose_debug = True if temp == '-F': self._print_functions() sys.exit(0) + if temp == '-FD': + self._print_functions(True) + sys.exit(0) try: self.inipath = sys.argv[2] except: - print(_("**** GSCREEN ERROR: INI file path missing from Gscreen launch command ****\n")) + LOG.error(_("INI file path missing from Gscreen launch command")) _print_help() sys.exit(0) # check for a local translation folder @@ -491,13 +533,13 @@ def __init__(self): if os.path.exists(locallocale): LOCALEDIR = locallocale domain = self.skinname - print(_("**** GSCREEN INFO: CUSTOM locale name =",LOCALEDIR,self.skinname)) + LOG.info(_("Custom locale name = {}").format(LOCALEDIR, self.skinname)) else: locallocale = os.path.join(SKINPATH,"%s/locale"%self.skinname) if os.path.exists(locallocale): LOCALEDIR = locallocale domain = self.skinname - print(_("**** GSCREEN INFO: SKIN locale name =",LOCALEDIR,self.skinname)) + LOG.info(_("Skin locale name = {}").format(LOCALEDIR, self.skinname)) else: LOCALEDIR = os.path.join(BASE, "share", "locale") domain = "linuxcnc" @@ -509,20 +551,20 @@ def __init__(self): # main screen localglade = os.path.join(CONFIGPATH,"%s.glade"%self.skinname) if os.path.exists(localglade): - print(_("\n**** GSCREEN INFO: Using CUSTOM glade file from %s ****"% localglade)) + LOG.info(_("Using custom glade file from {}").format(localglade)) xmlname = localglade else: localglade = os.path.join(SKINPATH,"%s/%s.glade"%(self.skinname,self.skinname)) if os.path.exists(localglade): - print(_("\n**** GSCREEN INFO: Using SKIN glade file from %s ****"% localglade)) + LOG.info(_(" Using skin glade file from {}").format(localglade)) xmlname = localglade else: - print(_("\n**** GSCREEN INFO: using STOCK glade file from: %s ****"% xmlname2)) + LOG.info(_("Using stock glade file from: {}").format(xmlname2)) try: self.xml = Gtk.Builder() self.xml.set_translation_domain(domain) # for locale translations self.xml.add_from_file(xmlname) - # this is a fix for themeing - it sets the widgets style name to + # this is a fix for themeing - it sets the widgets style name to # the widget id name. You can over ride it later with: # self.widgets..set_name('