how to make my own custom page for qtdragon_hd?

More
27 Apr 2023 10:54 #270056 by phillc54
I think it would be isEnabled

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

More
27 Apr 2023 11:16 #270057 by cmorley
The following user(s) said Thank You: rodw

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

More
27 Apr 2023 12:14 #270060 by rodw
Thanks guys. I can't believe you still have to write code in this day and age when even back in the DOS days, I could design a complete business application and have it generate the code to produce a complete working multi user business application. I think it was a Microsoft thing that destroyed such innovation...

But I digress, I think I need to do something like this
def initialized__(self):
  if self.w.PREFS_:
    self.belt1_en = self.w.PREFS_.getpref('Belt_1_enabled', True, bool, 'SPINDLE_EXTRAS')
    self.w.belt_1.setEnabled(self.belt1_en)
    )
def closing_cleanup__():   
  if self.w.PREFS_:
    self.w.PREFS_.putpref('Belt_1_enabled', self.belt1_en, bool, 'SPINDLE_EXTRAS')
 

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

More
27 Apr 2023 17:39 #270072 by rodw
Well that did not work
 File "/home/rod/linuxcnc/configs/sim.qtdragon_hd.qtdragon_hd_xyz/qtvcp/panels/belts/belts_handler.py", line 39, in initialized__
    if self.w.PREFS_:
AttributeError: 'MainPage' object has no attribute 'PREFS_'

I changed the prefs file name to agree with the ini file

I also tried Qsettings which generated a similar error
Not sure what I have wrong. so I attached my files
 
Attachments:

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

More
28 Apr 2023 04:57 #270095 by cmorley
Wait..instead of self.w.PREFS_
Try
self.w.MAIN.PREFS_

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

More
28 Apr 2023 05:57 #270097 by rodw
Chris, thanks that was it.
Its finding its way into the prefs file. :)
It shows as true in the initialize procedure but its being overwritten  to false later. I'll wait until I get the code written for all 8 buttons before panicing too much as I may have set some defaults somewhere
Do I need to refresh the screen from the handler?

The bad news is its not over yet. I got a probe connected today, The outside corner probing works but the  inside pocket is getting a probe triggered while not probing when it hits the first edge. It might be a setting as I was probing a 10mm dia hole on a 123 block

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

More
28 Apr 2023 11:01 #270108 by rodw
Somewhere  in Designer I seemed to have set default values for the buttons selected in each of my button groups. I can't for the life of me find where I have done this. They show up as shaded in Designer. This interferes with my preference saving.

 

Any idea how to undo this?
 
Attachments:

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

More
28 Apr 2023 14:18 #270112 by cmorley
I just pushed work to fix the call to closing_cleanup.
But you will also need to change the python_command entries in designer for the buttons.
back to:
INSTANCE.backBeltSelected(1) etc

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

More
28 Apr 2023 14:21 #270113 by cmorley

Somewhere  in Designer I seemed to have set default values for the buttons selected in each of my button groups. I can't for the life of me find where I have done this. They show up as shaded in Designer. This interferes with my preference saving.

 

Any idea how to undo this?

 

Look at the property 'checked'
But I think one of the buttons will always be checked.
 

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

More
28 Apr 2023 23:39 #270144 by rodw
Thanks Chris.

This is getting annoying. As you say, I have to have one button checked in the button groups
I changed my logic. This is my initialise code now
Warning: Spoiler!

I assumed that the system would honour the belf groups if I checked another button and keep it exclusive.
So the init code seems to work OK but then the window triggers the defaults again overwriting the values with those in designer (3,8 not 1,6).
I put some print statements in backbeltselected and frontbeltselected
I see calls to these procedures when the window opens with the designer defaults (3,8)
is setChecked() the correct method to call? 

any ideas here?
 

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

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