QRadioButtons in preferences file
- phillc54
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 5698
- Thank you received: 2081
08 Oct 2020 08:59 #185341
by phillc54
QRadioButtons in preferences file was created 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.
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.
- cmorley
- Away
- Moderator
Less
More
- Posts: 7771
- Thank you received: 2055
08 Oct 2020 10:34 - 08 Oct 2020 10:37 #185343
by cmorley
Replied by cmorley on topic QRadioButtons in preferences file
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 :
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.
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.
- phillc54
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 5698
- Thank you received: 2081
08 Oct 2020 10:40 #185344
by phillc54
Replied by phillc54 on topic QRadioButtons in preferences file
Great, thank you again...
I'll try to go a whole day without bugging you.
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.
- cmorley
- Away
- Moderator
Less
More
- Posts: 7771
- Thank you received: 2055
08 Oct 2020 10:54 #185346
by cmorley
Replied by cmorley on topic QRadioButtons in preferences file
All Good.
Give us a peak at what ur doing - I'm curious....
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.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19408
- Thank you received: 6507
08 Oct 2020 11:00 #185347
by tommylight
bit my nails to the bone waiting here !
Replied by tommylight on topic QRadioButtons in preferences file
+1All Good.
Give us a peak at what ur doing - I'm curious....
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.
- phillc54
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 5698
- Thank you received: 2081
08 Oct 2020 11:52 #185348
by phillc54
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.
Replied by phillc54 on topic QRadioButtons in preferences file
I am doing a screen based on pinders theme:All Good.
Give us a peak at what ur doing - I'm curious....
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.
- phillc54
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 5698
- Thank you received: 2081
09 Oct 2020 07:09 - 09 Oct 2020 07:16 #185435
by phillc54
Replied by phillc54 on topic QRadioButtons in preferences file
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.
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.
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.
- cmorley
- Away
- Moderator
Less
More
- Posts: 7771
- Thank you received: 2055
09 Oct 2020 08:10 #185439
by cmorley
Replied by cmorley on topic QRadioButtons in preferences file
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.
I added a pic so others can get a glimpse - hope you don't mind.
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
- phillc54
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 5698
- Thank you received: 2081
09 Oct 2020 08:23 - 09 Oct 2020 22:19 #185442
by phillc54
Replied by phillc54 on topic QRadioButtons in preferences file
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.
- rodw
- Online
- Platinum Member
Less
More
- Posts: 10737
- Thank you received: 3541
10 Oct 2020 12:32 #185598
by rodw
What casues this error when giving this a go?
Replied by rodw on topic QRadioButtons in preferences file
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.088 seconds