From c08aea63ef7f45d1c77d288a2105768110adf98c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Sat, 25 Feb 2017 00:02:19 +0100 Subject: [PATCH] [plugin_installer] Improve progressbar --- plugin_installer/plugin_installer.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugin_installer/plugin_installer.py b/plugin_installer/plugin_installer.py index f483d7e..e30e2e3 100644 --- a/plugin_installer/plugin_installer.py +++ b/plugin_installer/plugin_installer.py @@ -365,6 +365,7 @@ class DownloadAsync(threading.Thread): self.upgrading = upgrading self.secure = secure self.check_update = check_update + self.pulse = None icon = Gtk.Image() self.def_icon = icon.render_icon( Gtk.STOCK_PREFERENCES, Gtk.IconSize.MENU) @@ -382,6 +383,8 @@ class DownloadAsync(threading.Thread): if self.check_update: self.run_check_update() else: + GLib.idle_add(self.progressbar.show) + self.pulse = GLib.timeout_add(150, self.progressbar_pulse) self.run_download_plugin_list() except urllib.error.URLError as exc: if isinstance(exc.reason, ssl.SSLError): @@ -393,9 +396,10 @@ class DownloadAsync(threading.Thread): GLib.idle_add(self.plugin.on_error, str(exc)) log.exception('Error fetching plugin list') finally: - if 'plugins' in gajim.interface.instances: + if self.pulse: GLib.source_remove(self.pulse) GLib.idle_add(self.progressbar.hide) + self.pulse = None def parse_manifest(self, buf): ''' @@ -451,8 +455,6 @@ class DownloadAsync(threading.Thread): GLib.idle_add(self.plugin.warn_update, to_update) def run_download_plugin_list(self): - GLib.idle_add(self.progressbar.show) - self.pulse = GLib.timeout_add(150, self.progressbar_pulse) if not self.remote_dirs: log.info('Downloading Pluginlist...') buf = self.download_url(MANIFEST_IMAGE_URL) @@ -500,8 +502,6 @@ class DownloadAsync(threading.Thread): config.get('info', 'homepage'), ]) else: self.download_plugin() - GLib.source_remove(self.pulse) - GLib.idle_add(self.progressbar.hide) GLib.idle_add(self.plugin.select_root_iter) def download_plugin(self):