diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py index 34b0e8d51..ab74be8da 100644 --- a/virtManager/addhardware.py +++ b/virtManager/addhardware.py @@ -780,17 +780,19 @@ class vmmAddHardware(vmmGObjectUI): break @staticmethod - def populate_controller_model_combo(combo, controller_type, widget_name, + def populate_controller_model_combo(combo, controller_type, remove_widget, add_default=False): model = combo.get_model() model.clear() + if remove_widget: + remove_widget.set_sensitive( + controller_type != virtinst.VirtualController.TYPE_USB) + if controller_type == virtinst.VirtualController.TYPE_USB: model.append(["default", _("Hypervisor default")]) model.append(["ich9-ehci1", "USB 2"]) model.append(["nec-xhci", "USB 3"]) - if widget_name is not None: - widget_name.set_sensitive(False) elif controller_type == virtinst.VirtualController.TYPE_SCSI: model.append(["default", _("Hypervisor default")]) model.append(["virtio-scsi", "VirtIO SCSI"]) @@ -798,8 +800,6 @@ class vmmAddHardware(vmmGObjectUI): if add_default: model.append([None, _("Hypervisor default")]) uiutil.set_grid_row_visible(combo, False) - if widget_name is not None: - widget_name.set_sensitive(True) ######################### diff --git a/virtManager/details.py b/virtManager/details.py index 0dd5e30d9..ddaf886d8 100644 --- a/virtManager/details.py +++ b/virtManager/details.py @@ -160,6 +160,8 @@ remove_pages = [HW_LIST_TYPE_NIC, HW_LIST_TYPE_INPUT, DETAILS_PAGE_CONSOLE, DETAILS_PAGE_SNAPSHOTS) = range(3) +_remove_tooltip = _("Remove this device from the virtual machine") + def _label_for_device(dev, vm): devtype = dev.virtual_device_type @@ -974,6 +976,9 @@ class vmmDetails(vmmGObjectUI): for name in cpu_names: model.append([name, name, name, False]) + # Remove button tooltip + self.widget("config-remove").set_tooltip_text(_remove_tooltip) + # Disk cache combo disk_cache = self.widget("disk-cache") vmmAddHardware.build_disk_cache_combo(self.vm, disk_cache) @@ -2804,12 +2809,15 @@ class vmmDetails(vmmGObjectUI): self.widget("input-dev-mode").set_text(mode or "") uiutil.set_grid_row_visible(self.widget("input-dev-mode"), bool(mode)) - # Can't remove primary Xen or PS/2 mice + tooltip = _remove_tooltip + sensitive = True if ((inp.type == "mouse" and inp.bus in ("xen", "ps2")) or (inp.type == "keyboard" and inp.bus in ("xen", "ps2"))): - self.widget("config-remove").set_sensitive(False) - else: - self.widget("config-remove").set_sensitive(True) + sensitive = False + tooltip = _("Hypervisor does not support removing this device") + + self.widget("config-remove").set_sensitive(sensitive) + self.widget("config-remove").set_tooltip_text(tooltip) def refresh_graphics_page(self): gfx = self.get_hw_selection(HW_LIST_COL_DEVICE)