Rename existing application download events
This commit is contained in:
parent
2ee1d50a13
commit
9cb88ea386
3 changed files with 6 additions and 6 deletions
|
@ -83,11 +83,11 @@ class ApplicationVersionController:
|
||||||
response_buffer.write(data)
|
response_buffer.write(data)
|
||||||
progress = (bytes_written / response_size) * 100 if response_size > 0 else 0
|
progress = (bytes_written / response_size) * 100 if response_size > 0 else 0
|
||||||
|
|
||||||
application_version_observer.notify('download_progress', application_version, dict(
|
application_version_observer.notify('download_progressing', application_version, dict(
|
||||||
progress=progress
|
progress=progress
|
||||||
))
|
))
|
||||||
|
|
||||||
application_version_observer.notify('download_finished', application_version)
|
application_version_observer.notify('downloaded', application_version)
|
||||||
response_buffer.seek(0)
|
response_buffer.seek(0)
|
||||||
|
|
||||||
file_hash = ApplicationVersionController.__calculate_file_hash(response_buffer)
|
file_hash = ApplicationVersionController.__calculate_file_hash(response_buffer)
|
||||||
|
|
|
@ -6,5 +6,5 @@ class ApplicationVersionObserver(BaseObserver):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
self.on_downloading = []
|
self.on_downloading = []
|
||||||
self.on_download_progress = []
|
self.on_download_progressing = []
|
||||||
self.on_download_finished = []
|
self.on_downloaded = []
|
||||||
|
|
4
main.py
4
main.py
|
@ -37,8 +37,8 @@ if __name__ == '__main__':
|
||||||
profile_observer = ProfileObserver()
|
profile_observer = ProfileObserver()
|
||||||
|
|
||||||
application_version_observer.subscribe('downloading', lambda event: print(f'Downloading {ApplicationController.get(event.subject.application_code).name}, version {event.subject.version_number}...'))
|
application_version_observer.subscribe('downloading', lambda event: print(f'Downloading {ApplicationController.get(event.subject.application_code).name}, version {event.subject.version_number}...'))
|
||||||
application_version_observer.subscribe('download_progress', lambda event: print(f'Current progress: {event.meta.get('progress'):.2f}%', flush=True, end='\r'))
|
application_version_observer.subscribe('download_progressing', lambda event: print(f'Current progress: {event.meta.get('progress'):.2f}%', flush=True, end='\r'))
|
||||||
application_version_observer.subscribe('download_finished', lambda event: print('\n'))
|
application_version_observer.subscribe('downloaded', lambda event: print('\n'))
|
||||||
|
|
||||||
client_observer.subscribe('synchronizing', lambda event: print('Synchronizing...\n'))
|
client_observer.subscribe('synchronizing', lambda event: print('Synchronizing...\n'))
|
||||||
connection_observer.subscribe('connecting', lambda event: print(f'[{event.subject.get("attempt_count")}/{event.subject.get("maximum_number_of_attempts")}] Performing connection attempt...\n'))
|
connection_observer.subscribe('connecting', lambda event: print(f'[{event.subject.get("attempt_count")}/{event.subject.get("maximum_number_of_attempts")}] Performing connection attempt...\n'))
|
||||||
|
|
Loading…
Reference in a new issue