From 6c64246ca8160ff0e3d9c12e5d25d0a559d71b6e Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Thu, 27 Dec 2018 11:30:37 -0600 Subject: [PATCH] Fixed unresponsiveness of dialogs during updates --- src/update/wxUpdater.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/update/wxUpdater.py b/src/update/wxUpdater.py index 44d06b6..26a0d12 100644 --- a/src/update/wxUpdater.py +++ b/src/update/wxUpdater.py @@ -12,11 +12,13 @@ def available_update_dialog(version, description): else: return False - def create_progress_dialog(): return wx.ProgressDialog(_(u"Download in Progress"), _(u"Downloading the new version..."), parent=None, maximum=100) def progress_callback(total_downloaded, total_size): + wx.CallAfter(_progress_callback, total_downloaded, total_size) + +def _progress_callback(total_downloaded, total_size): global progress_dialog if progress_dialog == None: progress_dialog = create_progress_dialog() @@ -27,4 +29,4 @@ def progress_callback(total_downloaded, total_size): progress_dialog.Update((total_downloaded*100)/total_size, _(u"Updating... %s of %s") % (str(utils.convert_bytes(total_downloaded)), str(utils.convert_bytes(total_size)))) def update_finished(): - ms = wx.MessageDialog(None, _(u"The update has been downloaded and installed successfully. Press OK to continue."), _(u"Done!")).ShowModal() \ No newline at end of file + return wx.MessageDialog(None, _(u"The update has been downloaded and installed successfully. Press OK to continue."), _(u"Done!")).ShowModal() \ No newline at end of file