update GeDialog while download [SOLVED]
On 24/11/2014 at 13:14, xxxxxxxx wrote:
hey I try to set a progress while downloading a file
u = urlopen('http:/url/'+filename) ... while True: ... self.SetString(1014,message) self.LayoutChanged(1009)
It update the dialog after the full download of the file .
On 25/11/2014 at 02:34, xxxxxxxx wrote:
without knowing in which context you are using the above code it is hard to say anything. There are differences in PC and Mac when it comes to redrawing dialogs, please see this thread.
On 26/11/2014 at 04:53, xxxxxxxx wrote:
thanks for you reply - I try that :
class RB_Client(c4d.threading.C4DThread) : def Main(self) : u = urlopen('url') ... while True: buffer = u.read(block_size) if not buffer: break message2 = str(round(float(downloaded_bytes)/file_size*100-0.5))+" %" UpdaterDialog.progressmessage = message2 c4d.SpecialEventAdd(betaupdatefunction_ID) f.close() pass Cthread = RB_Client() Cthread.Start(mode=c4d.THREADMODE_ASYNC, priority=c4d.THREADPRIORITY_NORMAL) Cthread.Wait(False) def CoreMessage(self, id, msg) : if id==betaupdatefunction_ID: self.SetString(1005,self.progressmessage) self.LayoutChanged(1006) return True return gui.GeDialog.CoreMessage(self, id, msg)
the dialog refresh after the end of the function not during the while
On 27/11/2014 at 02:23, xxxxxxxx wrote:
maybe your thread works too fast for Cinema to send the messages. You could add a sleep() call from the time lib in your while loop to give Cinema a chance to send the message.
On 05/12/2014 at 08:24, xxxxxxxx wrote:
was your question answered?
On 06/12/2014 at 07:55, xxxxxxxx wrote: