QRadioButtons in preferences file

More
08 Oct 2020 08:59 #185341 by phillc54
I am not sure of the correct way to handle QRadioButtons in the preferences file.
I have three QRadioButtons in a frame and it seems I need to load/save each of the QRadioButtons, is there a way to load/save only the QRadioButton that is checked. I tried testing the state of each QRadioButton when readin the preferences file but it still created an entry for all the QRadioButtons.

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

More
08 Oct 2020 10:34 - 08 Oct 2020 10:37 #185343 by cmorley
In Designer:
connect all the radio buttons to form slot using the signal 'toggled(bool)' and manually add the arbitrary named slot 'radio_toggled'
linuxcnc.org/docs/2.8/html/gui/qtvcp.html#cha:designer-slots

In the handler file add :
    # at this point:
    # the widgets are instantiated.
    # the HAL pins are built but HAL is not set ready
    def initialized__(self):
        rb = self.w.PREFS_.getpref('RADIOGROUP1', 'default_radiobutton_object_name', str, 'CUSTOM_FORM_ENTRIES')
        self.w[rb].setChecked(True)
    #######################
    # callbacks from form #
    #######################
    def radio_toggled(self, data):
        if data:
            name = self.w.sender().text()
            print (name)
            if self.w.PREFS_:
                self.w.PREFS_.putpref('RADIOGROUP1', self.w.sender().objectName(),str, 'CUSTOM_FORM_ENTRIES')

Noe every time the radio button group changes, the radiobutton that is true is recorded in the preference file unde the arbritrary heading 'CUSTOM_FORM_ENTRIES'
It will also set the button true on start up - note that the default radiobutton name must be correct or the first time run it will error.
Last edit: 08 Oct 2020 10:37 by cmorley.
The following user(s) said Thank You: phillc54

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

More
08 Oct 2020 10:40 #185344 by phillc54
Great, thank you again...
I'll try to go a whole day without bugging you. :)
The following user(s) said Thank You: tommylight

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

More
08 Oct 2020 10:54 #185346 by cmorley
All Good.
Give us a peak at what ur doing - I'm curious....
The following user(s) said Thank You: tommylight, rodw

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

More
08 Oct 2020 11:00 #185347 by tommylight

All Good.
Give us a peak at what ur doing - I'm curious....

+1
bit my nails to the bone waiting here ! :)
The following user(s) said Thank You: rodw

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

More
08 Oct 2020 11:52 #185348 by phillc54

All Good.
Give us a peak at what ur doing - I'm curious....

I am doing a screen based on pinders theme:
forum.linuxcnc.org/qtpyvcp/40082-monokro...-mill?start=0#182773
It is being done in master branch with python3. I almost have the main screen layout completed, I'll post the .ui .qss and handler file tomorrow. Still got a LONG way to go.
The following user(s) said Thank You: tommylight, Clive S

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

More
09 Oct 2020 07:09 - 09 Oct 2020 07:16 #185435 by phillc54
Here you go...
It is a zip file of the complete working config. A bit lazy I know but it is the easiest way for me to keep everything in one place. The Qtvcp file are all in the qtplasmac subdirectory if you want to break them out.
I think I squeezed all I can into 1024x768 but it is resizable.
I actually started this as an experiment with a copy of QtDragon so you will see there is a lot of extraneous stuff in the handler that we don't need for plasma that I will remove. I thought about starting a fresh handler file but I have too much time invested in this now to not warrant that.
Attachments:
Last edit: 09 Oct 2020 07:16 by phillc54.
The following user(s) said Thank You: tommylight

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

More
09 Oct 2020 08:10 #185439 by cmorley
It amazes me how quickly you can get up to speed with others code and create some great stuff!
I added a pic so others can get a glimpse - hope you don't mind.
Attachments:
The following user(s) said Thank You: tommylight

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

More
09 Oct 2020 08:23 - 09 Oct 2020 22:19 #185442 by phillc54
No, not a problem.

It is interesting that the progress bar displays as odd colors in your pic, it displays correctly here. Could that have something to do with display drivers. I run mine on a VMWare virtual machine on a mac.

Warning: Spoiler!
Attachments:
Last edit: 09 Oct 2020 22:19 by phillc54.
The following user(s) said Thank You: tommylight

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

More
10 Oct 2020 12:32 #185598 by rodw

Here you go...
It is a zip file of the complete working config. A bit lazy I know but it is the easiest way for me to keep everything in one place. The Qtvcp


What casues this error when giving this a go?
Machine configuration directory is '/home/rod/linuxcnc/configs/qtplasmac/qtplasmac'
Machine configuration file is 'qtplasmac.ini'
can't find package Linuxcnc
    while executing
"package require Linuxcnc "
    (file "/home/rod/linuxcnc-plasmac/lib/hallib/check_config.tcl" line 160)
check_config validation failed
LinuxCNC terminated with an error.  You can find more information in the log:

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

Moderators: cmorley
Time to create page: 0.187 seconds
Powered by Kunena Forum