Minor fixes to virt_mode select pull request
Changes: - added hints about "which virt mode should I use" - changed displayed virt modes to show modes in all caps closes #44
This commit is contained in:
parent
ebc7426cab
commit
1a5a1fa7ee
@ -524,7 +524,7 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
||||
|
||||
try:
|
||||
if self.virt_mode.currentIndex() != self.virt_mode_idx:
|
||||
self.vm.virt_mode = self.selected_virt_mode()
|
||||
self.vm.virt_mode = self.selected_virt_mode().lower()
|
||||
self.anything_changed = True
|
||||
except Exception as ex:
|
||||
msg.append(str(ex))
|
||||
@ -544,13 +544,13 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
||||
self.update_pvh_kernel_version_warning()
|
||||
|
||||
def update_pv_warning(self):
|
||||
if self.selected_virt_mode() == 'pv':
|
||||
if self.selected_virt_mode() == 'PV':
|
||||
self.pv_warning.show()
|
||||
else:
|
||||
self.pv_warning.hide()
|
||||
|
||||
def update_virt_mode_list(self):
|
||||
choices = ['hvm', 'pv']
|
||||
choices = ['HVM', 'PV']
|
||||
|
||||
if hasattr(self, 'dev_list'):
|
||||
devs_attached = self.dev_list.selected_list.count() != 0
|
||||
@ -560,7 +560,7 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
||||
if devs_attached:
|
||||
self.pvh_mode_hidden.show()
|
||||
else:
|
||||
choices.insert(0, 'pvh')
|
||||
choices.insert(0, 'PVH')
|
||||
self.pvh_mode_hidden.hide()
|
||||
|
||||
if hasattr(self, 'virt_mode_list'):
|
||||
@ -573,8 +573,8 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
||||
|
||||
# XXX: Hardcoded default value.
|
||||
self.virt_mode_list, self.virt_mode_idx = utils.prepare_choice(
|
||||
self.virt_mode, self.vm, 'virt_mode', choices, 'hvm',
|
||||
allow_default=True)
|
||||
self.virt_mode, self.vm, 'virt_mode', choices, 'HVM',
|
||||
allow_default=True, transform=(lambda x: str(x).upper()))
|
||||
|
||||
if old_mode is not None:
|
||||
self.virt_mode.setCurrentIndex(self.virt_mode_list.index(old_mode))
|
||||
@ -585,7 +585,7 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
||||
self.update_pvh_kernel_version_warning()
|
||||
|
||||
def update_pvh_kernel_version_warning(self):
|
||||
if self.selected_virt_mode() != 'pvh':
|
||||
if self.selected_virt_mode() != 'PVH':
|
||||
self.pvh_kernel_version_warning.hide()
|
||||
return
|
||||
|
||||
@ -723,7 +723,7 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
||||
self.update_virt_mode_list()
|
||||
|
||||
def update_pvh_dont_support_devs(self):
|
||||
if self.selected_virt_mode() == 'pvh':
|
||||
if self.selected_virt_mode() == 'PVH':
|
||||
self.dev_list.setEnabled(False)
|
||||
self.pvh_dont_support_devs.setVisible(True)
|
||||
else:
|
||||
|
@ -34,7 +34,7 @@ def _filter_internal(vm):
|
||||
def prepare_choice(widget, holder, propname, choice, default,
|
||||
filter_function=None, *,
|
||||
icon_getter=None, allow_internal=None, allow_default=False,
|
||||
allow_none=False):
|
||||
allow_none=False, transform=None):
|
||||
|
||||
# for newly created vms, set propname to None
|
||||
|
||||
@ -55,6 +55,8 @@ def prepare_choice(widget, holder, propname, choice, default,
|
||||
|
||||
if propname is not None:
|
||||
oldvalue = getattr(holder, propname)
|
||||
if transform is not None:
|
||||
oldvalue = transform(oldvalue)
|
||||
is_default = holder.property_is_default(propname)
|
||||
else:
|
||||
oldvalue = object() # won't match for identity
|
||||
|
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>773</width>
|
||||
<width>813</width>
|
||||
<height>573</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -409,7 +409,7 @@
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
<string>Kernel:</string>
|
||||
@ -432,7 +432,7 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PVH mode requires Linux 4.11 or newer.</string>
|
||||
<string>WARNING: PVH mode requires Linux 4.11 or newer.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
@ -490,7 +490,7 @@
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0" rowspan="3">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_27">
|
||||
<property name="text">
|
||||
<string>Mode:</string>
|
||||
@ -500,10 +500,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="virt_mode"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="pv_warning">
|
||||
<property name="font">
|
||||
<font>
|
||||
@ -523,7 +523,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="pvh_mode_hidden">
|
||||
<property name="font">
|
||||
<font>
|
||||
@ -540,6 +540,21 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_21">
|
||||
<property name="font">
|
||||
<font>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PVH mode is recommended if possible (Linux kernel 4.11 or newer, no PCI passthrough). For Windows qubes always use HVM.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
Reference in New Issue
Block a user