sound: Track recommended models in virtinst

Change addhardware to show an editable model entry, like the
details wizard
This commit is contained in:
Cole Robinson 2018-09-06 11:56:23 -04:00
parent be1f5a6e25
commit cd07d6af34
4 changed files with 25 additions and 21 deletions

View File

@ -487,7 +487,7 @@ class AddHardware(uiutils.UITestCase):
# Add sound
self._open_addhw_window(details)
tab = self._select_hw(addhw, "Sound", "sound-tab")
tab.find("Model:", "combo box").click()
tab.find("Model:", "combo box").click_combo_entry()
tab.find("HDA", "menu item").click()
finish.click()
uiutils.check_in_loop(lambda: details.active)

View File

@ -710,16 +710,6 @@
<property name="can_focus">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<child>
<object class="GtkComboBox" id="sound-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="label10">
<property name="visible">True</property>
@ -735,6 +725,22 @@
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="sound-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="table2-atkobject">
<property name="AtkObject::accessible-name">sound-tab</property>

View File

@ -547,13 +547,8 @@ class vmmAddHardware(vmmGObjectUI):
@staticmethod
def build_sound_combo(vm, combo):
stable_defaults = vm.stable_defaults()
stable_soundmodels = ["ich6", "ich9", "ac97"]
values = []
for m in DeviceSound.MODELS:
if (stable_defaults and m not in stable_soundmodels):
continue
for m in DeviceSound.get_recommended_models(vm.xmlobj):
values.append([m, DeviceSound.pretty_model(m)])
default = DeviceSound.default_model(vm.xmlobj)

View File

@ -21,10 +21,9 @@ class _Codec(XMLBuilder):
class DeviceSound(Device):
XML_NAME = "sound"
MODELS = ["es1370", "sb16", "pcspk", "ac97", "ich6", "ich9"]
model = XMLProperty("./@model")
codecs = XMLChildProperty(_Codec)
@staticmethod
def get_recommended_models(_guest):
return ["ich6", "ich9", "ac97"]
@staticmethod
def pretty_model(model):
@ -34,6 +33,10 @@ class DeviceSound(Device):
return ret
model = XMLProperty("./@model")
codecs = XMLChildProperty(_Codec)
##################
# Default config #
##################