how to make my own custom page for qtdragon_hd?

More
29 Apr 2023 03:10 #270157 by cmorley
I would never mind what designer has checked because you will change it with the oteferemce file information.
I would read the prefeence file and find out which button is to be checked.

Call .setChecked(True) on that button only.
That should cause the python command to call it,s function, that I think you use to check the buttons are not straight across.

Then do the same for the other button group.

Which looks close to what you got there.
But what is this for?
self.frontBeltSelected(self.front_belt)

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

More
29 Apr 2023 03:31 #270159 by rodw

Call .setChecked(True) on that button only.
That should cause the python command to call it,s function, that I think you use to check the buttons are not straight across.

Thats what I do with an if..elif statement to map a numeric number in prefs to the relevant button. But you can see from the log it gets overridden after qt_makepins
[QTvcp.QTVCP.QT_PSTAT][INFO]  (embed) Using LOCAL ui file from: /home/rod/linuxcnc/configs/sim.qtdragon_hd.qtdragon_hd_xyz/qtvcp/panels/belts/belts.ui (qt_pstat.py:359)
 front: back =  1 : 6
 frontBeltSelected - front: back : number =  1 : 6 : 1
 backBeltSelected - front: back : number =  1 : 6 : 6
[QTvcp.QTVCP.QT_MAKEPINS][DEBUG]  QTVCP: Parsing external qtvcp belts panel for EMBEDDED HAL widgets. (qt_makepins.py:109)
 frontBeltSelected - front: back : number =  3 : 6 : 3
 backBeltSelected - front: back : number =  3 : 8 : 8

frontbeltselected and backbelt selected are called from the window by the button goups.
Their purpose is to disable the button beside the one selected so you can't have t belts on the one idler pulley sheave. 
It does not change checked.
    def frontBeltSelected(self, number):

        self.w.belt_5.setEnabled(True)
        self.w.belt_6.setEnabled(True)
        self.w.belt_7.setEnabled(True)            
        self.w.belt_8.setEnabled(True)
        self.front_belt = number
        backnumber = number + 4
        if (backnumber == 5):
            self.w.belt_5.setEnabled(False)                
        elif (backnumber == 6):
            self.w.belt_6.setEnabled(False)
        elif (backnumber == 7):
            self.w.belt_7.setEnabled(False)
        elif (backnumber == 8):
            self.w.belt_8.setEnabled(False)   
        print(" frontBeltSelected - front: back : number = ",self.front_belt,":",self.back_belt,":",number)
 

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

More
29 Apr 2023 04:56 #270166 by cmorley
Attachments:
The following user(s) said Thank You: rodw

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

More
29 Apr 2023 07:01 #270168 by rodw
Chris, thanks so much.
The prefs are loaded perfectly and buttons initialised
But the prefs file is not updated on a change to the  buttons on exit
From what I can see, closing_cleanup__() is not called as your print statement is never displayed.

I appreciate you teaching me about enumerate. Much nicer!

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

More
29 Apr 2023 08:51 #270177 by cmorley
Did you pull in my last update, where I said you need to change the python commands in designer?


Ya I did both styles to hopefully not confuse things to much.
The following user(s) said Thank You: rodw

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

More
29 Apr 2023 09:56 #270181 by rodw
Went to build debs and I got:
install: cannot stat '../lib/python/qtvcpqtvcp_plugin.py': No such file or directory
make[2]: *** [Makefile:793: install-python] Error 1
make[2]: Leaving directory '/home/rod/linuxcnc-dev/src'
make[1]: *** [debian/rules:72: override_dh_auto_install-arch] Error 2
make[1]: Leaving directory '/home/rod/linuxcnc-dev'
make: *** [debian/rules:38: binary] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
rod@penguin:~/linuxcnc-dev$ 

Seems like a typo but does not seem to be one of yours!

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

More
30 Apr 2023 00:09 - 30 Apr 2023 00:10 #270268 by rodw
Ok, installed the latest 2.9 from Sebs hidden buildbot.
Removed the INSTANCE. prefix in designer. eg.
Spindle_Extras.frontBeltSelected(1)
System performance has gone to a crawl and I see this message when clicking on a button
[QTvcp.QTVCP.WIDGETS.SIMPLE_WIDGETS][ERROR]  (belt_1 called exec in error:'NoneType' object is not subscriptable (simple_widgets.py:615)
[QTvcp.QTVCP.WIDGETS.SIMPLE_WIDGETS][WARNING]     Command was Spindle_Extras.frontBeltSelected(1) (simple_widgets.py:616)
[QTvcp.QTVCP.LIB.KEYBINDINGS][DEBUG]  Exception in KEYBINDING: no function name conversion for QT Event: '<unknown - 16777251>' (keybindings.py:27

The belts selected are now being saved so its not all bad :)
Last edit: 30 Apr 2023 00:10 by rodw.

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

More
30 Apr 2023 02:08 #270274 by rodw
Rebooted my PC and it seems to perform OK now.
Removed the Spindle_Extras prefix and behaviour is the same
eg.    format now frontBeltSelected(2)
[QTvcp.QTVCP.WIDGETS.SIMPLE_WIDGETS][ERROR]  (belt_2 called exec in error:'NoneType' object is not subscriptable (simple_widgets.py:615)
[QTvcp.QTVCP.WIDGETS.SIMPLE_WIDGETS][WARNING]     Command was frontBeltSelected(2) (simple_widgets.py:616)
false command

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

More
30 Apr 2023 02:14 #270275 by rodw
Ahh, 3rd time lucky. The original format works :)
INSTANCE.backBeltSelected(8)

I think I must be done!

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

More
30 Apr 2023 02:55 #270282 by cmorley
Glad u got it sorted.
When u got the panel just the way you like, I'd like to add it to the builtin panels - seems pretty useful.

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

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