LCNC 2.10 - Ask for AUTOMATIC_G43

More
1 year 9 months ago #318954 by Aciera
Not every user used to the old behavior that switches to 2.10 is going to use the update script. The point is that EVERY user that starts Gmoccapy the first time in 2.10 gets the notice.

The popup needs a checkbox with "do not show again" and after clicking the message ist gone for ever.


Sounds good to me. The state of whether to show the message or not would be stored in the .pref file I suppose.
However I don't have the time to figure out the popup with the checkbox right now so if somebody knows how to do that then please go ahead.

thanks

Please Log in to join the conversation.

More
1 year 9 months ago #319009 by Aciera
Turned out to be not too difficult, adds an entry 'show_startup_message' in the .pref file:  
 

Attachment not found

Please Log in to join the conversation.

More
1 year 9 months ago #319010 by Aciera
code snippets:

gmoccapy.py:
Code:
if self.prefs.getpref("show_startup_messsage", True, bool): title = "Important change for version 2.10" message = "Gmoccapy does no longer automatically retain G43 after a toolchange!" sub_message = "Automatic reactivation of G43 is possible using a REMAP.\nAn example can be found in any Gmoccapy SIM configuration." cb_value = self.dialogs.show_startup_message(self, _(message), _(sub_message), _(title)) if cb_value: self.prefs.putpref("show_startup_messsage", False, bool)

dialogs.py:
Code:
def show_startup_message(self, caller, message, sub_message, title = _("Operator Message")): dialog = Gtk.MessageDialog(caller.widgets.window1, Gtk.DialogFlags.DESTROY_WITH_PARENT, Gtk.MessageType.WARNING, Gtk.ButtonsType.NONE) dialog.set_title(str(title)) dialog.set_markup("<span size='12000'><b>" + message + "</b></span>") dialog.format_secondary_text(sub_message) ok_button = Gtk.Button.new_with_mnemonic(_("_Ok")) ok_button.set_size_request(-1, 56) ok_button.connect("clicked",lambda w:dialog.response(Gtk.ResponseType.OK)) box = Gtk.HButtonBox() box.add(ok_button) cb = Gtk.CheckButton(label = "Don't show this again") box.pack_start(cb, True, True, 0) dialog.action_area.add(box) dialog.set_border_width(5) dialog.show_all() self.emit("play_sound", "alert") response = dialog.run() dialog.destroy() return cb.get_active()

Please Log in to join the conversation.

More
1 year 8 months ago #320344 by zz912
Hello,

I am trying modify PNCconf:

Here github.com/LinuxCNC/linuxcnc/blob/1c72d4...nf/build_INI.py#L176 I added:
Code:
        if self.d.frontend == _PD._GMOCCAPY:             print("SUBROUTINE_PATH = ./macros", file=file)             print("REMAP=M6  modalgroup=6 prolog=change_prolog ngc=change_g43 epilog=change_epilog", file=file)             print("REMAP=M61  modalgroup=6 prolog=settool_prolog ngc=settool_g43 epilog=settool_epilog", file=file)             print(file=file)             print("# the Python plugins serves interpreter and task", file=file)             print("[PYTHON]", file=file)             print("PATH_PREPEND = ./python", file=file)             print("TOPLEVEL = ./python/toplevel.py", file=file)             print("LOG_LEVEL = 0", file=file)

It works.

Then I added folders macros and python to /linuxcnc-master/src/emc/usr_intf/pncconf

I want copy it to new configuration, so I added here github.com/LinuxCNC/linuxcnc/blob/1c72d4...conf/pncconf.py#L389 :
Code:
            if self.d.frontend == _PD._GMOCCAPY:                 dirbase = "%s/macros" % base                 dirpython = "%s/python" % base                 if not os.path.exists(dirbase):                     shutil.copytree('/home/zdenek/linuxcnc/linuxcnc-master/src/emc/usr_intf/pncconf/macros', dirbase)                                  if not os.path.exists(dirpython):                     shutil.copytree('/home/zdenek/linuxcnc/linuxcnc-master/src/emc/usr_intf/pncconf/python', dirpython)   

It works, but I dont want absolute path: /home/zdenek/linuxcnc/linuxcnc-master/src/emc/usr_intf/pncconf/

Can I ask for help?

Is good idea has the files in src folder?

Please Log in to join the conversation.

More
1 year 8 months ago #320349 by Aciera
You could also copy the macros directly from the gmoccapy sim config (untested):
Code:
src_fpath = os.path.expanduser("~/linuxcnc/configs/sim/gmoccapy/macros/change_g43.ngc") dest_fpath = "%s/macros/change_g43.ngc" % base os.makedirs(os.path.dirname(dest_fpath), exist_ok=True) shutil.copy(src_fpath, dest_fpath)

That way you do not need to have duplicate gmoccapy specific files in the pncconf sources.

Please Log in to join the conversation.

More
1 year 8 months ago #320387 by zz912
It looks good BUT the file
~/linuxcnc/configs/sim/gmoccapy/macros/change_g43.ngc
is created after load sim configuration. For example in my computer this file dont exist.

In my RIP installation file is here:
/home/zdenek/linuxcnc/linuxcnc-master/configs/sim/gmoccapy/macros/change_g43.ngc

This scripts must work also in debian instalation.

It is defined here:
github.com/LinuxCNC/linuxcnc/blob/1c72d4...ipts/linuxcnc.in#L53
But I dont know, how to use it.
 

Please Log in to join the conversation.

More
1 year 8 months ago #320411 by Aciera
I see. But surely the files, eg 'change_g43.ngc', have to be somewhere.

Alas, I have no way to check as all my setups are local builds.

Please Log in to join the conversation.

More
1 year 8 months ago #320986 by HansU
I think it's good to have an information system that notifies also about new features that are disabled by default (for compatibility reasons).

I implemented such, based on Acieras snippet.
It is able to hide the messages you have read but displays new ones id there will be any in the future.

You can try it out using this branch: github.com/hansu/linuxcnc/tree/gmoccapy-info-message

Please Log in to join the conversation.

More
1 year 8 months ago #321050 by HansU
Looks like this

Please Log in to join the conversation.

More
1 year 8 months ago #321051 by Aciera
I like it.
Thanks

Please Log in to join the conversation.

Time to create page: 0.069 seconds
Powered by Kunena Forum