how to make my own custom page for qtdragon_hd?
26 Apr 2023 22:35 #270018
by rodw
Replied by rodw on topic how to make my own custom page for qtdragon_hd?
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.
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.
27 Apr 2023 04:20 #270028
by rodw
Replied by rodw on topic how to make my own custom page for qtdragon_hd?
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
Output
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.
I just have to learn how to select a button from the button group and enable/disable the buttons
Handler
Warning: Spoiler!
def frontBeltSelected(self, number):
print('Front Belt # ',number, " pressed")
backnumber = number + 4
for x in range(5,9):
#enable button x
print("Enabling Back button ",x)
#disable button backnumber
print("Disabling Back Number ", backnumber)
def backBeltSelected(self, number):
print('Back Belt # ',number, " pressed")
frontnumber = number - 4
for x in range(1,5):
#enable button x
print("Enabling Front button ",x)
#disable button frontnumber
print("Disabling Front Number ", frontnumber)
Output
Warning: Spoiler!
Front Belt # 3 pressed
Enabling Back button 5
Enabling Back button 6
Enabling Back button 7
Enabling Back button 8
Disabling Back Number 7
false command
false command
false command
false command
Back Belt # 8 pressed
Enabling Front button 1
Enabling Front button 2
Enabling Front button 3
Enabling Front button 4
Disabling Front Number 4
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.
27 Apr 2023 06:20 #270035
by rodw
Replied by rodw on topic how to make my own custom page for qtdragon_hd?
CHange of plans. this is just as efficient
but its generating an error.
I guess I don't understand the class methods yet.
What is syntax to enable and disable a button?
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)
What is syntax to enable and disable a button?
Please Log in or Create an account to join the conversation.
27 Apr 2023 06:24 #270036
by cmorley
Replied by cmorley on topic how to make my own custom page for qtdragon_hd?
In the handler file, widgets are referenced as such:
self.w.WIDGETNAME
self.w.WIDGETNAME
The following user(s) said Thank You: rodw
Please Log in or Create an account to join the conversation.
27 Apr 2023 06:24 #270038
by cmorley
Replied by cmorley on topic how to make my own custom page for qtdragon_hd?
Also true and false start with a capital in python.
Please Log in or Create an account to join the conversation.
27 Apr 2023 07:41 #270041
by rodw
Replied by rodw on topic how to make my own custom page for qtdragon_hd?
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.
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.
27 Apr 2023 09:02 #270046
by phillc54
Replied by phillc54 on topic how to make my own custom page for qtdragon_hd?
Please Log in or Create an account to join the conversation.
27 Apr 2023 10:21 #270052
by rodw
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....
Replied by rodw on topic how to make my own custom page for qtdragon_hd?
Thanks. This user needs more than 6 lines of documentationYou can use preferences:
linuxcnc.org/docs/devel/html/gui/qtvcp-l...ode_preferences_code
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.
27 Apr 2023 10:34 - 27 Apr 2023 10:42 #270053
by phillc54
Replied by phillc54 on topic how to make my own custom page for qtdragon_hd?
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
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.
27 Apr 2023 10:50 #270054
by rodw
Replied by rodw on topic how to make my own custom page for qtdragon_hd?
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
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.353 seconds