mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-22 13:34:07 +03:00
addhardware: Move video model list to virtinst
And make it smart about the hypervisor
This commit is contained in:
parent
7baa296aed
commit
7994dc90c8
@ -485,8 +485,8 @@ class AddHardware(uiutils.UITestCase):
|
||||
# Add video
|
||||
self._open_addhw_window(details)
|
||||
tab = self._select_hw(addhw, "Video", "video-tab")
|
||||
tab.find("Model:", "combo box").click()
|
||||
tab.find("QXL", "menu item").click()
|
||||
tab.find("Model:", "combo box").click_combo_entry()
|
||||
tab.find("Virtio", "menu item").click()
|
||||
finish.click()
|
||||
uiutils.check_in_loop(lambda: details.active)
|
||||
|
||||
|
@ -1051,16 +1051,6 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<property name="column_spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="video-model">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label23">
|
||||
<property name="visible">True</property>
|
||||
@ -1075,6 +1065,22 @@
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="video-model">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="has_entry">True</property>
|
||||
<child internal-child="entry">
|
||||
<object class="GtkEntry">
|
||||
<property name="can_focus">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="table5-atkobject">
|
||||
<property name="AtkObject::accessible-name">video-tab</property>
|
||||
|
@ -596,8 +596,10 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
@staticmethod
|
||||
def build_video_combo(vm, combo):
|
||||
values = []
|
||||
for m in DeviceVideo.MODELS:
|
||||
for m in DeviceVideo.get_recommended_models(vm.xmlobj):
|
||||
values.append([m, DeviceVideo.pretty_model(m)])
|
||||
if not values:
|
||||
values.append([None, _("Hypervisor default")])
|
||||
default = DeviceVideo.default_model(vm.xmlobj)
|
||||
_build_combo(combo, values, default_value=default)
|
||||
|
||||
|
@ -12,8 +12,13 @@ from ..xmlbuilder import XMLProperty
|
||||
class DeviceVideo(Device):
|
||||
XML_NAME = "video"
|
||||
|
||||
# Default models list
|
||||
MODELS = ["cirrus", "vga", "vmvga", "xen", "qxl", "virtio"]
|
||||
@staticmethod
|
||||
def get_recommended_models(guest):
|
||||
if guest.conn.is_xen():
|
||||
return ["xen", "vga"]
|
||||
if guest.conn.is_qemu() or guest.conn.is_test():
|
||||
return ["vga", "qxl", "virtio"]
|
||||
return []
|
||||
|
||||
@staticmethod
|
||||
def pretty_model(model):
|
||||
|
Loading…
Reference in New Issue
Block a user