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:
|
try:
|
||||||
if self.virt_mode.currentIndex() != self.virt_mode_idx:
|
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
|
self.anything_changed = True
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
msg.append(str(ex))
|
msg.append(str(ex))
|
||||||
@ -544,13 +544,13 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
self.update_pvh_kernel_version_warning()
|
self.update_pvh_kernel_version_warning()
|
||||||
|
|
||||||
def update_pv_warning(self):
|
def update_pv_warning(self):
|
||||||
if self.selected_virt_mode() == 'pv':
|
if self.selected_virt_mode() == 'PV':
|
||||||
self.pv_warning.show()
|
self.pv_warning.show()
|
||||||
else:
|
else:
|
||||||
self.pv_warning.hide()
|
self.pv_warning.hide()
|
||||||
|
|
||||||
def update_virt_mode_list(self):
|
def update_virt_mode_list(self):
|
||||||
choices = ['hvm', 'pv']
|
choices = ['HVM', 'PV']
|
||||||
|
|
||||||
if hasattr(self, 'dev_list'):
|
if hasattr(self, 'dev_list'):
|
||||||
devs_attached = self.dev_list.selected_list.count() != 0
|
devs_attached = self.dev_list.selected_list.count() != 0
|
||||||
@ -560,7 +560,7 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
if devs_attached:
|
if devs_attached:
|
||||||
self.pvh_mode_hidden.show()
|
self.pvh_mode_hidden.show()
|
||||||
else:
|
else:
|
||||||
choices.insert(0, 'pvh')
|
choices.insert(0, 'PVH')
|
||||||
self.pvh_mode_hidden.hide()
|
self.pvh_mode_hidden.hide()
|
||||||
|
|
||||||
if hasattr(self, 'virt_mode_list'):
|
if hasattr(self, 'virt_mode_list'):
|
||||||
@ -573,8 +573,8 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
|
|
||||||
# XXX: Hardcoded default value.
|
# XXX: Hardcoded default value.
|
||||||
self.virt_mode_list, self.virt_mode_idx = utils.prepare_choice(
|
self.virt_mode_list, self.virt_mode_idx = utils.prepare_choice(
|
||||||
self.virt_mode, self.vm, 'virt_mode', choices, 'hvm',
|
self.virt_mode, self.vm, 'virt_mode', choices, 'HVM',
|
||||||
allow_default=True)
|
allow_default=True, transform=(lambda x: str(x).upper()))
|
||||||
|
|
||||||
if old_mode is not None:
|
if old_mode is not None:
|
||||||
self.virt_mode.setCurrentIndex(self.virt_mode_list.index(old_mode))
|
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()
|
self.update_pvh_kernel_version_warning()
|
||||||
|
|
||||||
def update_pvh_kernel_version_warning(self):
|
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()
|
self.pvh_kernel_version_warning.hide()
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -723,7 +723,7 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
self.update_virt_mode_list()
|
self.update_virt_mode_list()
|
||||||
|
|
||||||
def update_pvh_dont_support_devs(self):
|
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.dev_list.setEnabled(False)
|
||||||
self.pvh_dont_support_devs.setVisible(True)
|
self.pvh_dont_support_devs.setVisible(True)
|
||||||
else:
|
else:
|
||||||
|
@ -34,7 +34,7 @@ def _filter_internal(vm):
|
|||||||
def prepare_choice(widget, holder, propname, choice, default,
|
def prepare_choice(widget, holder, propname, choice, default,
|
||||||
filter_function=None, *,
|
filter_function=None, *,
|
||||||
icon_getter=None, allow_internal=None, allow_default=False,
|
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
|
# 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:
|
if propname is not None:
|
||||||
oldvalue = getattr(holder, propname)
|
oldvalue = getattr(holder, propname)
|
||||||
|
if transform is not None:
|
||||||
|
oldvalue = transform(oldvalue)
|
||||||
is_default = holder.property_is_default(propname)
|
is_default = holder.property_is_default(propname)
|
||||||
else:
|
else:
|
||||||
oldvalue = object() # won't match for identity
|
oldvalue = object() # won't match for identity
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>773</width>
|
<width>813</width>
|
||||||
<height>573</height>
|
<height>573</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -409,7 +409,7 @@
|
|||||||
<property name="fieldGrowthPolicy">
|
<property name="fieldGrowthPolicy">
|
||||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0" rowspan="2">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label_19">
|
<widget class="QLabel" name="label_19">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Kernel:</string>
|
<string>Kernel:</string>
|
||||||
@ -432,7 +432,7 @@
|
|||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<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>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -490,7 +490,7 @@
|
|||||||
<property name="fieldGrowthPolicy">
|
<property name="fieldGrowthPolicy">
|
||||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0" rowspan="3">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_27">
|
<widget class="QLabel" name="label_27">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Mode:</string>
|
<string>Mode:</string>
|
||||||
@ -500,10 +500,10 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QComboBox" name="virt_mode"/>
|
<widget class="QComboBox" name="virt_mode"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QLabel" name="pv_warning">
|
<widget class="QLabel" name="pv_warning">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
@ -523,7 +523,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QLabel" name="pvh_mode_hidden">
|
<widget class="QLabel" name="pvh_mode_hidden">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
@ -540,6 +540,21 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user