Merge branch 'klass-attr'
* klass-attr: Fix setting kernel property use 'klass' property instead of actual VM object class
This commit is contained in:
commit
058b813690
@ -63,7 +63,7 @@ class NewVmDlg(QDialog, Ui_NewVMDlg):
|
||||
self.template_vm,
|
||||
self.app, None,
|
||||
self.app.default_template,
|
||||
(lambda vm: isinstance(vm, qubesadmin.vm.TemplateVM)),
|
||||
(lambda vm: vm.klass == 'TemplateVM'),
|
||||
allow_internal=False, allow_default=True, allow_none=False)
|
||||
|
||||
self.netvm_list, self.netvm_idx = utils.prepare_vm_choice(
|
||||
|
@ -32,7 +32,6 @@ from .ui_globalsettingsdlg import *
|
||||
|
||||
from configparser import ConfigParser
|
||||
from qubesadmin.utils import parse_size, updates_vms_status
|
||||
from qubesadmin.vm import TemplateVM
|
||||
|
||||
qmemman_config_path = '/etc/qubes/qmemman.conf'
|
||||
|
||||
@ -104,7 +103,7 @@ class GlobalSettingsWindow(Ui_GlobalSettings, QDialog):
|
||||
self.default_netvm_combo.setCurrentIndex(self.netvm_idx)
|
||||
|
||||
#default template
|
||||
templates = [vm for vm in all_vms if isinstance(vm, TemplateVM)]
|
||||
templates = [vm for vm in all_vms if vm.klass == 'TemplateVM']
|
||||
self.template_idx = -1
|
||||
|
||||
current_template = self.qvm_collection.default_template
|
||||
|
@ -248,12 +248,12 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
||||
self.vmlabel.setVisible(True)
|
||||
self.vmlabel.setEnabled(not self.vm.is_running())
|
||||
|
||||
if isinstance(self.vm, qubesadmin.vm.AppVM):
|
||||
if self.vm.klass == 'AppVM':
|
||||
self.template_list, self.template_idx = utils.prepare_vm_choice(
|
||||
self.template_name,
|
||||
self.vm, 'template',
|
||||
self.vm.app.default_template,
|
||||
(lambda vm: isinstance(vm, qubesadmin.vm.TemplateVM)),
|
||||
(lambda vm: vm.klass == 'TemplateVM'),
|
||||
allow_default=True, allow_none=False)
|
||||
else:
|
||||
self.template_name.setEnabled(False)
|
||||
@ -476,7 +476,7 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
||||
self.default_dispvm,
|
||||
self.vm, 'default_dispvm',
|
||||
self.vm.app.default_dispvm,
|
||||
(lambda vm: isinstance(vm, qubesadmin.vm.DispVM)),
|
||||
(lambda vm: vm.klass == 'DispVM'),
|
||||
allow_default=True, allow_none=True)
|
||||
|
||||
def __apply_advanced_tab__(self):
|
||||
@ -504,23 +504,7 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
||||
if hasattr(self.vm, "kernel") and self.kernel_groupbox.isVisible():
|
||||
try:
|
||||
if self.kernel.currentIndex() != self.kernel_idx:
|
||||
new_kernel = str(self.kernel.currentText())
|
||||
new_kernel = new_kernel.split(' ')[0]
|
||||
uses_default_kernel = False
|
||||
|
||||
if new_kernel == "default":
|
||||
kernel = self.app.get_default_kernel()
|
||||
uses_default_kernel = True
|
||||
elif new_kernel == "none":
|
||||
kernel = None
|
||||
else:
|
||||
kernel = new_kernel
|
||||
|
||||
self.vm.kernel = kernel
|
||||
# Set self.vm.uses_default_kernel after self.vm.kernel to ensure that
|
||||
# the correct value persists after QubesVm.kernel resets self.vm.uses_default_kernel
|
||||
# to False.
|
||||
self.vm.uses_default_kernel = uses_default_kernel
|
||||
self.vm.kernel = self.kernel_list[self.kernel.currentIndex()]
|
||||
self.anything_changed = True
|
||||
except Exception as ex:
|
||||
msg.append(str(ex))
|
||||
|
@ -28,7 +28,7 @@ import qubesadmin
|
||||
from PyQt4.QtGui import QIcon
|
||||
|
||||
def _filter_internal(vm):
|
||||
return (not isinstance(vm, qubesadmin.vm.AdminVM)
|
||||
return (not vm.klass == 'AdminVM'
|
||||
and not vm.features.get('internal', False))
|
||||
|
||||
def prepare_choice(widget, holder, propname, choice, default,
|
||||
@ -87,7 +87,7 @@ def prepare_choice(widget, holder, propname, choice, default,
|
||||
text = str(item)
|
||||
|
||||
if item is qubesadmin.DEFAULT and is_default \
|
||||
or item is not qubesadmin.DEFAULT and item is oldvalue:
|
||||
or item is not qubesadmin.DEFAULT and item == oldvalue:
|
||||
text += ' (current)'
|
||||
idx = i
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user