From b3f0b16b8772317e2157e31364034365b3346631 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Fri, 20 Jul 2007 18:47:48 +0000 Subject: #2268 Allow removing downloads from the clipboard while in progress. --- (limited to 'downloadmanager.py') diff --git a/downloadmanager.py b/downloadmanager.py index 78e4e0d..b4486af 100644 --- a/downloadmanager.py +++ b/downloadmanager.py @@ -87,7 +87,10 @@ class Download: return cb_service = clipboardservice.get_instance() - cb_service.set_object_percent(self._cb_object_id, 100) + # Test if the object still exists in the clipboard as it could have + # been removed. + if cb_service.get_object(self._cb_object_id): + cb_service.set_object_percent(self._cb_object_id, 100) path, file_name = os.path.split(self._target_file.path) @@ -123,7 +126,10 @@ class Download: datastore.write(self._dl_jobject) cb_service = clipboardservice.get_instance() - cb_service.set_object_percent(self._cb_object_id, percent) + # Test if the object still exists in the clipboard as it could have + # been removed. + if cb_service.get_object(self._cb_object_id): + cb_service.set_object_percent(self._cb_object_id, percent) def _create_journal_object(self): path, file_name = os.path.split(self._target_file.path) -- cgit v0.9.1