how to make my own custom page for qtdragon_hd?

More
3 years 6 months ago #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 to join the conversation.

More
3 years 6 months ago #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
Code:
[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.
Code:
    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 to join the conversation.

More
3 years 6 months ago #270166 by cmorley

Please Log in to join the conversation.

More
3 years 6 months ago #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 to join the conversation.

More
3 years 6 months ago #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.

Please Log in to join the conversation.

More
3 years 6 months ago #270181 by rodw
Went to build debs and I got:
Code:
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 to join the conversation.

More
3 years 6 months ago #270268 by rodw
Ok, installed the latest 2.9 from Sebs hidden buildbot.
Removed the INSTANCE. prefix in designer. eg.
Code:
Spindle_Extras.frontBeltSelected(1)
System performance has gone to a crawl and I see this message when clicking on a button
Code:
[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 :)

Please Log in to join the conversation.

More
3 years 6 months ago #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)
Code:
[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 to join the conversation.

More
3 years 6 months ago #270275 by rodw
Ahh, 3rd time lucky. The original format works :)
INSTANCE.backBeltSelected(8)

I think I must be done!

Please Log in to join the conversation.

More
3 years 6 months ago #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 to join the conversation.

Time to create page: 0.207 seconds
Powered by Kunena Forum