Skip to content

Commit 9bcb56f

Browse files
committed
gmoccapy: add startup message
1 parent 3dc840e commit 9bcb56f

2 files changed

Lines changed: 31 additions & 4 deletions

File tree

src/emc/usr_intf/gmoccapy/dialogs.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def yesno_dialog(self, caller, message, title = _("Operator Message")):
170170
dialog.destroy()
171171
return response == Gtk.ResponseType.YES
172172

173-
def show_user_message(self, caller, message, title = _("Operator Message")):
173+
def show_user_message(self, caller, message, title = _("Operator Message"), checkbox = False):
174174
dialog = Gtk.MessageDialog(caller.widgets.window1,
175175
Gtk.DialogFlags.DESTROY_WITH_PARENT,
176176
Gtk.MessageType.INFO,
@@ -183,13 +183,22 @@ def show_user_message(self, caller, message, title = _("Operator Message")):
183183
ok_button.connect("clicked",lambda w:dialog.response(Gtk.ResponseType.OK))
184184
box = Gtk.HButtonBox()
185185
box.add(ok_button)
186-
dialog.action_area.add(box)
186+
187+
if checkbox:
188+
cb = Gtk.CheckButton(label = _("Don't show this again"))
189+
dialog.get_content_area().add(cb)
190+
191+
dialog.get_action_area().add(box)
187192
dialog.set_border_width(5)
188193
dialog.show_all()
189194
self.emit("play_sound", "alert")
190195
response = dialog.run()
191196
dialog.destroy()
192-
return response == Gtk.ResponseType.OK
197+
198+
if checkbox and response == Gtk.ResponseType.OK:
199+
return cb.get_active()
200+
else:
201+
return response == Gtk.ResponseType.OK
193202

194203
# dialog for run from line
195204
def restart_dialog(self, caller):

src/emc/usr_intf/gmoccapy/gmoccapy.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,8 @@ def __init__(self, argv):
492492
self.elapsed_time_run = 0
493493
self.progress = 0
494494

495+
self._startup_message()
496+
495497
# This allows sourcing an user defined file
496498
rcfile = "~/.gmoccapyrc"
497499
user_command_file = self.get_ini_info.get_user_command_file()
@@ -528,7 +530,23 @@ def __init__(self, argv):
528530
self.notification.add_message(_("Error in") + " " + css_file + "\n" \
529531
+ _("Please check the console output."), ALERT_ICON)
530532

531-
533+
def _startup_message(self):
534+
title = _("Important change(s)")
535+
# This array holds information about new features or things that changed. They can be hidden using the dialog's checkbox.
536+
# It is important that strings are only appended to this array (not removed), otherwise some messages could get hidden unwanted.
537+
messages =[ _("<b>3.5.0 (LinuxCNC 2.10.0): Gmoccapy does no longer automatically retain G43 after a toolchange!</b>\n"\
538+
"Automatic reactivation of G43 is possible using a REMAP.\n"\
539+
"Examples can be found in the Gmoccapy sim configurations."),
540+
# _("<b>3.5.1 (LinuxCNC 2.10.1): </b> Example for new feature"),
541+
]
542+
hide_message = self.prefs.getpref("hide_startup_messsage", 0, int)
543+
if hide_message < len(messages):
544+
message = "\n\n".join(messages[hide_message:])
545+
message += _('\n\nFor more information see the <a href="https://linuxcnc.org/docs/html/gui/gmoccapy_release_notes.txt">release notes</a>.')
546+
547+
dont_show = self.dialogs.show_user_message(self, message, title, checkbox = True)
548+
if dont_show:
549+
self.prefs.putpref("hide_startup_messsage", len(messages), str)
532550

533551
def _get_ini_data(self):
534552
self.get_ini_info = getiniinfo.GetIniInfo()

0 commit comments

Comments
 (0)