Adding a progress bar
- Abdulkareem
- Offline
- Senior Member
Less
More
- Posts: 62
- Thank you received: 1
11 Sep 2024 09:56 #309890
by Abdulkareem
Adding a progress bar was created by Abdulkareem
I added a progress bar for the gcode to my ui but the % remains at zero I don't know what i am suppose to do on the handler file front. This is my handler file.
Please Log in or Create an account to join the conversation.
- Abdulkareem
- Offline
- Senior Member
Less
More
- Posts: 62
- Thank you received: 1
11 Sep 2024 09:57 #309891
by Abdulkareem
Replied by Abdulkareem on topic Adding a progress bar
Also i want to add error messages but i dont know how to
Please Log in or Create an account to join the conversation.
- cmorley
- Offline
- Moderator
Less
More
- Posts: 7787
- Thank you received: 2078
11 Sep 2024 13:05 #309897
by cmorley
Replied by cmorley on topic Adding a progress bar
You can set it up similar to Qtdragon by adapting this code:
In Designer, you must set signals from gcode_viewer and gcodegraphics to call percent_donw_changed and percent_loaded_changed.
Chris
STATUS.connect('progress', lambda w,p,t: self.updateProgress(p,t))
def updateProgress(self, p,text):
if p <0:
self.w.progressBar.setValue(0)
self.w.progressBar.setFormat(_translate("HandlerClass",'PROGRESS'))
else:
self.w.progressBar.setValue(p)
self.w.progressBar.setFormat('{}: {}%'.format(text, p))
def percent_loaded_changed(self, fraction):
if fraction <0:
self.w.progressBar.setValue(0)
self.w.progressBar.setFormat(_translate("HandlerClass",'PROGRESS'))
else:
self.w.progressBar.setValue(fraction)
txt = _translate("HandlerClass","LOADING")
self.w.progressBar.setFormat('{}: {}%'.format(txt, fraction))
def percent_done_changed(self, fraction):
self.w.progressBar.setValue(fraction)
if fraction <0:
self.w.progressBar.setValue(0)
self.w.progressBar.setFormat(_translate("HandlerClass",'PROGRESS'))
else:
txt = _translate("HandlerClass","COMPLETE")
self.w.progressBar.setFormat('{}: {}%'.format(txt, fraction))
In Designer, you must set signals from gcode_viewer and gcodegraphics to call percent_donw_changed and percent_loaded_changed.
Chris
The following user(s) said Thank You: Abdulkareem
Please Log in or Create an account to join the conversation.
- Abdulkareem
- Offline
- Senior Member
Less
More
- Posts: 62
- Thank you received: 1
12 Sep 2024 09:05 #309979
by Abdulkareem
Replied by Abdulkareem on topic Adding a progress bar
Okay thank you ill try it now
Please Log in or Create an account to join the conversation.
Moderators: cmorley
Time to create page: 0.145 seconds