how to make my own custom page for qtdragon_hd?

More
26 Apr 2023 22:35 #270018 by rodw
Thanks, Chris, I probably won't get to it until tonight. I gotta do some work some time! 
My thought would be to distribute an example panel (either this one or your simple_hal one) with a handler and a limited amount of pins.
Maybe just:
hallabel
button with handler
button without handler.

The problem I found even after trawling gihub was there were no examples of a panel to follow and the ones there were much more complicated than what we need. eg mixed up with all the gcode stuff etc.

I did find the simple_hal panel useful as I simply copied and modified it.

 

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

More
27 Apr 2023 04:20 #270028 by rodw
Almost there! Thanks for the help! The events are working
I just have to learn how to select a button from the button group and enable/disable the buttons 

Handler
Warning: Spoiler!

Output
Warning: Spoiler!


The two belts are connected from the motor to the spindle via an intermediate idler pulley. Balts therefore cannot be on the same level (eg, 1, 5 or 3, 7). So we need to enable and disable buttons. The eaisest way I thought was to enable all buttons and then disable the button opposite the selected belt.

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

More
27 Apr 2023 06:20 #270035 by rodw
CHange of plans. this is just as efficient
    def frontBeltSelected(self, number):
        print('Front Belt # ',number, " pressed")
        self.belt_5.setEnabled(true)
        self.belt_6.setEnabled(true)
        self.belt_7.setEnabled(true)            
        self.belt_8.setEnabled(true)
        backnumber = number + 4
        for x in range(5,9):
            if (x == 5):
                self.belt_5.setEnabled(false)
            elif (x == 6):
                self.belt_6.setEnabled(false)
            elif (x == 7):
                self.belt_7.setEnabled(false)
            elif (x == 8):
                self.belt_8.setEnabled(false)
        #disable button backnumber    
        print("Disabling Back Number ", backnumber)

but its  generating an error.
[QTvcp.QTVCP.WIDGETS.SIMPLE_WIDGETS][ERROR]  (belt_8 called exec in error:'HandlerClass' object has no attribute 'belt_1' (simple_widgets.py:617)
[QTvcp.QTVCP.WIDGETS.SIMPLE_WIDGETS][WARNING]     Command was INSTANCE.Spindle_Extras.backBeltSelected(8) (simple_widgets.py:618)
I guess I don't understand the class methods yet.
What is  syntax to enable and disable a button?

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

More
27 Apr 2023 06:24 #270036 by cmorley
In the handler file, widgets are referenced as such:

self.w.WIDGETNAME
The following user(s) said Thank You: rodw

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

More
27 Apr 2023 06:24 #270038 by cmorley
Also true and false start with a capital in python.

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

More
27 Apr 2023 07:41 #270041 by rodw
Thanks Chris. That should be an easy fix.

So that brings me to the final requirement and that is to save the state of the 8 belts. I thought the preference file would let me do that, but I'm not seeing its extendable by the user but I know Phill saves a lot of data in QTpplasmac. How can we do that?

I did see some settings on the screen_options widget but ts not well documented.

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

More
27 Apr 2023 09:02 #270046 by phillc54

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

More
27 Apr 2023 10:21 #270052 by rodw

You can use preferences:

linuxcnc.org/docs/devel/html/gui/qtvcp-l...ode_preferences_code

Thanks. This user needs more than 6 lines of documentation 
But I have been looking at qtplasmac_handler.py which is next level crazy!
I'll have  bit of a play but a simple example would be nice.
Everything else is finished and working....

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

More
27 Apr 2023 10:34 - 27 Apr 2023 10:42 #270053 by phillc54
Something like this:

Read a preference:       
# preference name, default value, type, section name
value = self.w.PREFS_.getpref('DRO_Color', '', str, 'CUSTOM_FORM_ENTRIES')

Write a preference:
# preference name, value, type, section name
self.w.PREFS_.putpref('DRO_Color', color, str, 'CUSTOM_FORM_ENTRIES')

Edit: sorry I should have added that the type could be str, bool, int, or float

 
Last edit: 27 Apr 2023 10:42 by phillc54.
The following user(s) said Thank You: rodw

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

More
27 Apr 2023 10:50 #270054 by rodw
Thanks, what I ned to work with are the button enabled flags
Is this valid to read the value?
myval = self.w.belt_5.Enabled

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

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