[virt-tools-list] [virt-manager PATCH 3/3] addhardware: add a tool tip when USB controller already existed
chenhanxiao at cn.fujitsu.com
chenhanxiao at cn.fujitsu.com
Tue Jun 10 07:12:04 UTC 2014
> -----Original Message-----
> From: Giuseppe Scrivano [mailto:gscrivan at redhat.com]
> Sent: Monday, June 09, 2014 8:35 PM
> To: Chen, Hanxiao/陈 晗霄
> Cc: virt-tools-list at redhat.com
> Subject: Re: [virt-tools-list] [virt-manager PATCH 3/3] addhardware: add a tool
> tip when USB controller already existed
>
> Chen Hanxiao <chenhanxiao at cn.fujitsu.com> writes:
>
> > diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
> > index 0678f03..4c1e21c 100644
> > --- a/virtManager/addhardware.py
> > +++ b/virtManager/addhardware.py
> > @@ -869,9 +869,20 @@ class vmmAddHardware(vmmGObjectUI):
> > def populate_controller_model(self, src):
> > ignore = src
> >
> > + def show_tooltip(tooltip):
>
> maybe you can add a "value" parameter here?
>
>
> > + vmname = self.vm.get_name()
> > + tooltip = (_("%s already has a USB controller attached.\n"
> > + "Adding more than one USB controller is not supported.\n"
> > + "You can change the USB controller type in the VM details screen.")
> > + % vmname)
> > + model_tooltip.set_visible(True)
> > + model_tooltip.set_tooltip_text(tooltip)
> > +
> > controller_type = self.get_config_controller_type()
> > modellist = self.widget("controller-model")
> > modellist.set_sensitive(True)
> > + model_tooltip = self.widget("controller-tooltip")
> > + model_tooltip.set_visible(False)
>
> so that the function can be used instead of these two lines:
>
> show_tooltip(model_tooltip, False)
>
>
> >
> > controllers = self.vm.get_controller_devices()
> > if controller_type == VirtualController.TYPE_USB:
> > @@ -883,6 +894,7 @@ class vmmAddHardware(vmmGObjectUI):
> > self._remove_usb_controller = usb_controllers[0]
> > self.widget("create-finish").set_sensitive(True)
> > else:
> > + show_tooltip(model_tooltip)
>
> and this will become: show_tooltip(model_tooltip, True)
>
> Regards,
> Giuseppe
Thanks for your suggestion.
I'll post a v2 patch set.
- Chen
More information about the virt-tools-list
mailing list