[virt-tools-list] [virt-manager PATCH 2/2] console: don't use _close_viewer directly
Pavel Hrdina
phrdina at redhat.com
Thu Aug 18 08:19:17 UTC 2016
On Wed, Aug 17, 2016 at 03:06:53PM -0400, Cole Robinson wrote:
> On 08/17/2016 12:38 PM, Pavel Hrdina wrote:
> > Function _close_viewer should be always called together with setting
> > unavailable page. Call only _activate_unavailable_page which does both things.
> >
> > Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> > ---
> > virtManager/console.py | 15 +++++----------
> > 1 file changed, 5 insertions(+), 10 deletions(-)
> >
> > diff --git a/virtManager/console.py b/virtManager/console.py
> > index 6e3d4eb..3f8cfb9 100644
> > --- a/virtManager/console.py
> > +++ b/virtManager/console.py
> > @@ -601,7 +601,7 @@ class vmmConsolePages(vmmGObjectUI):
> > # Page Navigation #
> > ###################
> >
> > - def _activate_unavailable_page(self, msg):
> > + def _activate_unavailable_page(self, msg=None):
> > """
> > This function is passed to serialcon.py at least, so change
> > with care
> > @@ -609,7 +609,8 @@ class vmmConsolePages(vmmGObjectUI):
> > self._close_viewer()
> > self.widget("console-pages").set_current_page(
> > _CONSOLE_PAGE_UNAVAILABLE)
> > - self.widget("console-unavailable").set_label("<b>" + msg + "</b>")
> > + if msg:
> > + self.widget("console-unavailable").set_label("<b>" + msg + "</b>")
> >
>
> Rather than the msg=None handling I'd rather have callers always pass a
> string, otherwise future code re-org might end up showing an empty screen to
> the user. Can you change the msg=None callers to use something like _("Viewer
> disconnected.") ? Even though users shouldn't see it. ACK both with that
> change if you agree
OK, that makes sense, I was thinking about it but cannot come up with good error
message.
Thanks, I'll push it shortly.
Pavel
More information about the virt-tools-list
mailing list