LCNC 2.10 - Ask for AUTOMATIC_G43

More
14 Jan 2025 15:55 - 14 Jan 2025 16:05 #318954 by Aciera
Replied by Aciera on topic LCNC 2.10 - Ask for AUTOMATIC_G43
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
Last edit: 14 Jan 2025 16:05 by Aciera.

Please Log in or Create an account to join the conversation.

More
15 Jan 2025 08:17 - 15 Jan 2025 08:22 #319009 by Aciera
Replied by Aciera on topic LCNC 2.10 - Ask for AUTOMATIC_G43
Turned out to be not too difficult, adds an entry 'show_startup_message' in the .pref file:  
 
Attachments:
Last edit: 15 Jan 2025 08:22 by Aciera.
The following user(s) said Thank You: zz912

Please Log in or Create an account to join the conversation.

More
15 Jan 2025 08:27 #319010 by Aciera
Replied by Aciera on topic LCNC 2.10 - Ask for AUTOMATIC_G43
code snippets:

gmoccapy.py:
        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:
    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()
The following user(s) said Thank You: zz912, HansU

Please Log in or Create an account to join the conversation.

  • zz912
  • zz912's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
01 Feb 2025 19:19 #320344 by zz912
Replied by zz912 on topic LCNC 2.10 - Ask for AUTOMATIC_G43
Hello,

I am trying modify PNCconf:

Here github.com/LinuxCNC/linuxcnc/blob/1c72d4...nf/build_INI.py#L176 I added:
        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 :
            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 or Create an account to join the conversation.

More
01 Feb 2025 20:38 #320349 by Aciera
Replied by Aciera on topic LCNC 2.10 - Ask for AUTOMATIC_G43
You could also copy the macros directly from the gmoccapy sim config (untested):
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.
The following user(s) said Thank You: zz912

Please Log in or Create an account to join the conversation.

  • zz912
  • zz912's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
02 Feb 2025 06:44 #320387 by zz912
Replied by zz912 on topic LCNC 2.10 - Ask for AUTOMATIC_G43
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 or Create an account to join the conversation.

More
02 Feb 2025 12:42 #320411 by Aciera
Replied by Aciera on topic LCNC 2.10 - Ask for AUTOMATIC_G43
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.
The following user(s) said Thank You: zz912

Please Log in or Create an account to join the conversation.

More
08 Feb 2025 11:45 #320986 by HansU
Replied by HansU on topic LCNC 2.10 - Ask for AUTOMATIC_G43
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
The following user(s) said Thank You: Aciera, zz912

Please Log in or Create an account to join the conversation.

More
09 Feb 2025 08:59 - 09 Feb 2025 09:03 #321050 by HansU
Replied by HansU on topic LCNC 2.10 - Ask for AUTOMATIC_G43
Looks like this
Attachments:
Last edit: 09 Feb 2025 09:03 by HansU.
The following user(s) said Thank You: zz912

Please Log in or Create an account to join the conversation.

More
09 Feb 2025 09:18 #321051 by Aciera
Replied by Aciera on topic LCNC 2.10 - Ask for AUTOMATIC_G43
I like it.
Thanks
The following user(s) said Thank You: zz912

Please Log in or Create an account to join the conversation.

Moderators: newbynobiHansU
Time to create page: 0.204 seconds
Powered by Kunena Forum