[virt-tools-list] [virt-manager PATCH 3/3] addhardware: add a tool tip when USB controller already existed

Giuseppe Scrivano gscrivan at redhat.com
Mon Jun 9 12:34:52 UTC 2014


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




More information about the virt-tools-list mailing list