extends Panel # Declare member variables here. Examples: # var a = 2 # var b = "text" var last_downloaded=0 var last_update=OS.get_ticks_msec() # Called when the node enters the scene tree for the first time. func _ready(): Messenger.connect("statusUpdate", self, "_on_status_updated") # Called every frame. 'delta' is the elapsed time since the previous frame. #func _process(delta): # pass func _on_status_updated(download): var now = OS.get_ticks_msec() var timeElapsed=1#(now-last_update)/1000 last_update = now var diff = (download._downloaded_size - last_downloaded) / 1024 var speed = diff / timeElapsed last_downloaded = download._downloaded_size rect_size = $VBoxContainer.rect_size $VBoxContainer/name.text = download._current_url $VBoxContainer/size.text = "size: %s"%download._file_size $VBoxContainer/downloaded.text = "downloaded: %s"%download._downloaded_size $VBoxContainer/speed.text = "%skb/s"%speed $VBoxContainer/ProgressBar.value = download._downloaded_percent