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.

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: HansU

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

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