how to make my own custom page for qtdragon_hd?
- phillc54
 - 
				
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 5711
 - Thank you received: 2093
 
			
	
						27 Apr 2023 10:54				#270056
		by phillc54
	
	
		
			
	
			
			 		
													
	
				Replied by phillc54 on topic how to make my own custom page for qtdragon_hd?			
			
				I think it would be isEnabled			
					Please Log in or Create an account to join the conversation.
- cmorley
 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 7230
 - Thank you received: 2106
 
			
	
						27 Apr 2023 11:16				#270057
		by cmorley
	
	
		
			
	
	
			 		
													
	
				Replied by cmorley on topic how to make my own custom page for qtdragon_hd?			
			
					
		The following user(s) said Thank You: rodw 	
			Please Log in or Create an account to join the conversation.
- rodw
 - 
				
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 11472
 - Thank you received: 3848
 
			
	
						27 Apr 2023 12:14				#270060
		by rodw
	
	
		
			
	
			
			 		
													
	
				Replied by rodw on topic how to make my own custom page for qtdragon_hd?			
			
				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 			
					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.
- rodw
 - 
				
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 11472
 - Thank you received: 3848
 
			
	
						27 Apr 2023 17:39				#270072
		by rodw
	
	
		
			
	
	
			
			 		
													
	
				Replied by rodw on topic how to make my own custom page for qtdragon_hd?			
			
				Well that did not work
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
 			
					 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
Please Log in or Create an account to join the conversation.
- cmorley
 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 7230
 - Thank you received: 2106
 
			
	
						28 Apr 2023 04:57				#270095
		by cmorley
	
	
		
			
	
			
			 		
													
	
				Replied by cmorley on topic how to make my own custom page for qtdragon_hd?			
			
				Wait..instead of self.w.PREFS_
Try
self.w.MAIN.PREFS_
					Try
self.w.MAIN.PREFS_
Please Log in or Create an account to join the conversation.
- rodw
 - 
				
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 11472
 - Thank you received: 3848
 
			
	
						28 Apr 2023 05:57				#270097
		by rodw
	
	
		
			
	
			
			 		
													
	
				Replied by rodw on topic how to make my own custom page for qtdragon_hd?			
			
				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
					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.
- rodw
 - 
				
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 11472
 - Thank you received: 3848
 
			
	
						28 Apr 2023 11:01				#270108
		by rodw
	
	
		
			
	
	
		
			
			 		
													
	
				Replied by rodw on topic how to make my own custom page for qtdragon_hd?			
			
					Attachments:
Please Log in or Create an account to join the conversation.
- cmorley
 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 7230
 - Thank you received: 2106
 
			
	
						28 Apr 2023 14:18				#270112
		by cmorley
	
	
		
			
	
			
			 		
													
	
				Replied by cmorley on topic how to make my own custom page for qtdragon_hd?			
			
				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
					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.
- cmorley
 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 7230
 - Thank you received: 2106
 
			
	
						28 Apr 2023 14:21				#270113
		by cmorley
	
	
		
			
				
But I think one of the buttons will always be checked.
 			
					
	
			
			 		
													
	
				Replied by cmorley on topic how to make my own custom page for qtdragon_hd?			
			Look at the property 'checked'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?
But I think one of the buttons will always be checked.
Please Log in or Create an account to join the conversation.
- rodw
 - 
				
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 11472
 - Thank you received: 3848
 
			
	
						28 Apr 2023 23:39				#270144
		by rodw
	
	
		
			
	
			
			 		
													
	
				Replied by rodw on topic how to make my own custom page for qtdragon_hd?			
			
				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
	
		
			
		
		
			
							
		
	
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?
 			
					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!		
		            self.front_belt = self.w.MAIN.PREFS_.getpref('FrontBelt', 1, int, 'SPINDLE_EXTRAS')
            self.back_belt = self.w.MAIN.PREFS_.getpref('BackBelt', 6, int, 'SPINDLE_EXTRAS')
            print(" front: back = ",self.front_belt,":",self.back_belt)
            self.frontBeltSelected(self.front_belt)
            if self.frontBeltSelected == 1:
                self.w.belt_1.setChecked(True)
            if self.frontBeltSelected == 2:
                self.w.belt_2.setChecked(True)
            if self.frontBeltSelected == 3:
                self.w.belt_3.setChecked(True)
            if self.frontBeltSelected == 4:
                self.w.belt_4.setChecked(True)
            self.backBeltSelected(self.back_belt)
            if self.backBeltSelected  == 5:
                self.w.belt_5.setChecked(True)
            if self.backBeltSelected  == 6:
                self.w.belt_6.setChecked(True)
            if self.backBeltSelected  == 7:
                self.w.belt_7.setChecked(True)
            if self.backBeltSelected  == 8:
                self.w.belt_8.setChecked(True)
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.202 seconds