[virt-tools-list] [virt-manager PATCH 4/5] details: Fix the tooltip error on config-remove

Lin Ma lma at suse.com
Wed Jul 18 10:00:22 UTC 2018


The tooltip of config-remove will be changed after clicking the 'Keyboard'
or 'Mouse' in details page, We need to restore it in the refresh_XXX_page
functions.

How to reproduce:
1. Click 'Keyboard' item in details page.
2. Observe the tooltip of the 'Remove' button. the tooltip is
   "Hypervisor does not support to removing this device"
3. Click a nic item.
4. Observe the tooltip of the 'Remove' button.

Expected:
"Remove this device from the virtual machine"

Actual:
"Hypervisor does not support to removing this device"

Signed-off-by: Lin Ma <lma at suse.com>
---
 virtManager/details.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/virtManager/details.py b/virtManager/details.py
index 00e18949..cb298f3f 100644
--- a/virtManager/details.py
+++ b/virtManager/details.py
@@ -2630,6 +2630,7 @@ class vmmDetails(vmmGObjectUI):
         if not disk:
             return
 
+        self.widget("config-remove").set_tooltip_text(_remove_tooltip)
         path = disk.path
         devtype = disk.device
         ro = disk.read_only
@@ -2705,6 +2706,7 @@ class vmmDetails(vmmGObjectUI):
         if not net:
             return
 
+        self.widget("config-remove").set_tooltip_text(_remove_tooltip)
         vmmAddHardware.populate_network_model_combo(
             self.vm, self.widget("network-model"))
         uiutil.set_list_selection(self.widget("network-model"), net.model)
@@ -2751,6 +2753,7 @@ class vmmDetails(vmmGObjectUI):
 
         title = self.gfxdetails.set_dev(gfx)
         self.widget("graphics-title").set_markup("<b>%s</b>" % title)
+        self.widget("config-remove").set_tooltip_text(_remove_tooltip)
 
     def refresh_sound_page(self):
         sound = self.get_hw_selection(HW_LIST_COL_DEVICE)
@@ -2758,6 +2761,7 @@ class vmmDetails(vmmGObjectUI):
             return
 
         uiutil.set_list_selection(self.widget("sound-model"), sound.model)
+        self.widget("config-remove").set_tooltip_text(_remove_tooltip)
 
     def refresh_smartcard_page(self):
         sc = self.get_hw_selection(HW_LIST_COL_DEVICE)
@@ -2765,6 +2769,7 @@ class vmmDetails(vmmGObjectUI):
             return
 
         uiutil.set_list_selection(self.widget("smartcard-mode"), sc.mode)
+        self.widget("config-remove").set_tooltip_text(_remove_tooltip)
 
     def refresh_redir_page(self):
         rd = self.get_hw_selection(HW_LIST_COL_DEVICE)
@@ -2781,6 +2786,7 @@ class vmmDetails(vmmGObjectUI):
         self.widget("redir-address").set_text(address or "")
         uiutil.set_grid_row_visible(
             self.widget("redir-address"), bool(address))
+        self.widget("config-remove").set_tooltip_text(_remove_tooltip)
 
     def refresh_tpm_page(self):
         tpmdev = self.get_hw_selection(HW_LIST_COL_DEVICE)
@@ -2804,6 +2810,7 @@ class vmmDetails(vmmGObjectUI):
         vmmAddHardware.populate_tpm_model_combo(
             self.vm, self.widget("tpm-model"), tpmdev.version)
         uiutil.set_list_selection(self.widget("tpm-model"), tpmdev.model)
+        self.widget("config-remove").set_tooltip_text(_remove_tooltip)
 
         # Device type specific properties, only show if apply to the cur dev
         show_ui("device_path")
@@ -2817,9 +2824,11 @@ class vmmDetails(vmmGObjectUI):
         model = dev.model or "isa"
         pmodel = virtinst.DevicePanic.get_pretty_model(model)
         self.widget("panic-model").set_text(pmodel)
+        self.widget("config-remove").set_tooltip_text(_remove_tooltip)
 
     def refresh_rng_page(self):
         dev = self.get_hw_selection(HW_LIST_COL_DEVICE)
+        self.widget("config-remove").set_tooltip_text(_remove_tooltip)
         values = {
             "rng-bind-host": "bind_host",
             "rng-bind-service": "bind_service",
@@ -2876,6 +2885,7 @@ class vmmDetails(vmmGObjectUI):
         show_target_type = not (chardev.DEVICE_TYPE in
                                 ["serial", "parallel"])
         show_target_name = chardev.DEVICE_TYPE == "channel"
+        self.widget("config-remove").set_tooltip_text(_remove_tooltip)
 
         def show_ui(param, val=None):
             widgetname = "char-" + param.replace("_", "-")
@@ -2974,6 +2984,7 @@ class vmmDetails(vmmGObjectUI):
         self.widget("hostdev-title").set_markup(devlabel)
         self.widget("hostdev-source").set_text(pretty_name)
         self.widget("hostdev-rombar").set_active(rom_bar)
+        self.widget("config-remove").set_tooltip_text(_remove_tooltip)
 
     def refresh_video_page(self):
         vid = self.get_hw_selection(HW_LIST_COL_DEVICE)
@@ -3001,10 +3012,12 @@ class vmmDetails(vmmGObjectUI):
         else:
             self.widget("video-3d").set_active(vid.accel3d)
 
+        tooltip = _remove_tooltip
         can_remove = True
         if self.vm.xmlobj.devices.graphics:
             can_remove = False
         self.widget("config-remove").set_sensitive(can_remove)
+        self.widget("config-remove").set_tooltip_text(tooltip)
 
     def refresh_watchdog_page(self):
         watch = self.get_hw_selection(HW_LIST_COL_DEVICE)
@@ -3016,6 +3029,7 @@ class vmmDetails(vmmGObjectUI):
 
         uiutil.set_list_selection(self.widget("watchdog-model"), model)
         uiutil.set_list_selection(self.widget("watchdog-action"), action)
+        self.widget("config-remove").set_tooltip_text(_remove_tooltip)
 
     def refresh_controller_page(self):
         controller = self.get_hw_selection(HW_LIST_COL_DEVICE)
@@ -3025,6 +3039,7 @@ class vmmDetails(vmmGObjectUI):
         uiutil.set_grid_row_visible(self.widget("device-list-label"), False)
         uiutil.set_grid_row_visible(self.widget("controller-device-box"), False)
 
+        tooltip = _remove_tooltip
         can_remove = True
         if self.vm.get_xmlobj().os.is_x86() and controller.type == "usb":
             can_remove = False
@@ -3056,6 +3071,7 @@ class vmmDetails(vmmGObjectUI):
                     break
 
         self.widget("config-remove").set_sensitive(can_remove)
+        self.widget("config-remove").set_tooltip_text(tooltip)
 
         type_label = controller.pretty_desc()
         self.widget("controller-type").set_text(type_label)
@@ -3076,6 +3092,7 @@ class vmmDetails(vmmGObjectUI):
 
         self.fsDetails.set_dev(dev)
         self.fsDetails.update_fs_rows()
+        self.widget("config-remove").set_tooltip_text(_remove_tooltip)
 
     def refresh_boot_page(self):
         # Refresh autostart
-- 
2.16.2




More information about the virt-tools-list mailing list