From 97f5717ef718db179a7dd94319189d506dffb994 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sat, 5 Oct 2013 10:03:56 -0400 Subject: [PATCH] snapshots: Fix showing async dialogs for revert/delete --- ui/snapshots.ui | 3 ++- virtManager/asyncjob.py | 14 +++++++------- virtManager/engine.py | 4 ++-- virtManager/snapshots.py | 10 +++++++--- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/ui/snapshots.ui b/ui/snapshots.ui index 537e63a9c..4e461fdbf 100644 --- a/ui/snapshots.ui +++ b/ui/snapshots.ui @@ -1,5 +1,5 @@ - + @@ -215,6 +215,7 @@ True False 0 + 0 Screenshot: diff --git a/virtManager/asyncjob.py b/virtManager/asyncjob.py index 2c275fc66..bbe9f8e66 100644 --- a/virtManager/asyncjob.py +++ b/virtManager/asyncjob.py @@ -113,7 +113,7 @@ def _simple_async_done_cb(error, details, errorintro, finish_cb() -def _simple_async(callback, args, title, text, parent, errorintro, +def _simple_async(callback, args, parent, title, text, errorintro, show_progress, simplecb, errorcb, finish_cb): """ @show_progress: Whether to actually show a progress dialog @@ -129,7 +129,7 @@ def _simple_async(callback, args, title, text, parent, errorintro, asyncjob = vmmAsyncJob(docb, args, _simple_async_done_cb, - (errorintro, errorcb, parent, finish_cb), + (parent, errorintro, errorcb, finish_cb), title, text, parent.topwin, show_progress=show_progress) asyncjob.run() @@ -146,17 +146,17 @@ class vmmAsyncJob(vmmGObjectUI): Displays a progress bar while executing the "callback" method. """ @staticmethod - def simple_async(callback, args, title, text, parent, errorintro, + def simple_async(callback, args, parent, title, text, errorintro, simplecb=True, errorcb=None, finish_cb=None): - _simple_async(callback, args, - title, text, parent, errorintro, True, + _simple_async(callback, args, parent, + title, text, errorintro, True, simplecb, errorcb, finish_cb) @staticmethod def simple_async_noshow(callback, args, parent, errorintro, simplecb=True, errorcb=None, finish_cb=None): - _simple_async(callback, args, - "", "", parent, errorintro, False, + _simple_async(callback, args, parent, + "", "", errorintro, False, simplecb, errorcb, finish_cb) diff --git a/virtManager/engine.py b/virtManager/engine.py index ea086378d..9d946643b 100644 --- a/virtManager/engine.py +++ b/virtManager/engine.py @@ -1033,8 +1033,8 @@ class vmmEngine(vmmGObject): # VM will be restored, which can take some time, so show progress title = _("Restoring Virtual Machine") text = _("Restoring virtual machine memory from disk") - vmmAsyncJob.simple_async(vm.startup, - [], title, text, src, "", errorcb=errorcb) + vmmAsyncJob.simple_async(vm.startup, [], src, + title, text, "", errorcb=errorcb) else: # Regular startup diff --git a/virtManager/snapshots.py b/virtManager/snapshots.py index 84b2becae..5dc75ef7c 100644 --- a/virtManager/snapshots.py +++ b/virtManager/snapshots.py @@ -517,9 +517,11 @@ class vmmSnapshotPage(vmmGObjectUI): return logging.debug("Reverting to snapshot '%s'", snap.get_name()) - vmmAsyncJob.simple_async_noshow(self.vm.revert_to_snapshot, + vmmAsyncJob.simple_async(self.vm.revert_to_snapshot, [snap], self, - _("Error reverting to snapshot '%s'") % + _("Restoring snapshot"), + _("Restoring snapshot '%s'") % snap.get_name(), + _("Error restoring snapshot '%s'") % snap.get_name(), finish_cb=self._refresh_snapshots) @@ -535,7 +537,9 @@ class vmmSnapshotPage(vmmGObjectUI): return logging.debug("Deleting snapshot '%s'", snap.get_name()) - vmmAsyncJob.simple_async_noshow(snap.delete, [], self, + vmmAsyncJob.simple_async(snap.delete, [], self, + _("Deleting snapshot"), + _("Deleting snapshot '%s'") % snap.get_name(), _("Error deleting snapshot '%s'") % snap.get_name(), finish_cb=self._refresh_snapshots)