use 'klass' property instead of actual VM object class
The later is going to be generic QubesVM class, to save admin.vm.List calls.
This commit is contained in:
parent
8e01b1488c
commit
07162ba089
@ -63,7 +63,7 @@ class NewVmDlg(QDialog, Ui_NewVMDlg):
|
|||||||
self.template_vm,
|
self.template_vm,
|
||||||
self.app, None,
|
self.app, None,
|
||||||
self.app.default_template,
|
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)
|
allow_internal=False, allow_default=True, allow_none=False)
|
||||||
|
|
||||||
self.netvm_list, self.netvm_idx = utils.prepare_vm_choice(
|
self.netvm_list, self.netvm_idx = utils.prepare_vm_choice(
|
||||||
|
@ -32,7 +32,6 @@ from .ui_globalsettingsdlg import *
|
|||||||
|
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
from qubesadmin.utils import parse_size, updates_vms_status
|
from qubesadmin.utils import parse_size, updates_vms_status
|
||||||
from qubesadmin.vm import TemplateVM
|
|
||||||
|
|
||||||
qmemman_config_path = '/etc/qubes/qmemman.conf'
|
qmemman_config_path = '/etc/qubes/qmemman.conf'
|
||||||
|
|
||||||
@ -104,7 +103,7 @@ class GlobalSettingsWindow(Ui_GlobalSettings, QDialog):
|
|||||||
self.default_netvm_combo.setCurrentIndex(self.netvm_idx)
|
self.default_netvm_combo.setCurrentIndex(self.netvm_idx)
|
||||||
|
|
||||||
#default template
|
#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
|
self.template_idx = -1
|
||||||
|
|
||||||
current_template = self.qvm_collection.default_template
|
current_template = self.qvm_collection.default_template
|
||||||
|
@ -248,12 +248,12 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
self.vmlabel.setVisible(True)
|
self.vmlabel.setVisible(True)
|
||||||
self.vmlabel.setEnabled(not self.vm.is_running())
|
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_list, self.template_idx = utils.prepare_vm_choice(
|
||||||
self.template_name,
|
self.template_name,
|
||||||
self.vm, 'template',
|
self.vm, 'template',
|
||||||
self.vm.app.default_template,
|
self.vm.app.default_template,
|
||||||
(lambda vm: isinstance(vm, qubesadmin.vm.TemplateVM)),
|
(lambda vm: vm.klass == 'TemplateVM'),
|
||||||
allow_default=True, allow_none=False)
|
allow_default=True, allow_none=False)
|
||||||
else:
|
else:
|
||||||
self.template_name.setEnabled(False)
|
self.template_name.setEnabled(False)
|
||||||
@ -476,7 +476,7 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
self.default_dispvm,
|
self.default_dispvm,
|
||||||
self.vm, 'default_dispvm',
|
self.vm, 'default_dispvm',
|
||||||
self.vm.app.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)
|
allow_default=True, allow_none=True)
|
||||||
|
|
||||||
def __apply_advanced_tab__(self):
|
def __apply_advanced_tab__(self):
|
||||||
|
@ -28,7 +28,7 @@ import qubesadmin
|
|||||||
from PyQt4.QtGui import QIcon
|
from PyQt4.QtGui import QIcon
|
||||||
|
|
||||||
def _filter_internal(vm):
|
def _filter_internal(vm):
|
||||||
return (not isinstance(vm, qubesadmin.vm.AdminVM)
|
return (not vm.klass == 'AdminVM'
|
||||||
and not vm.features.get('internal', False))
|
and not vm.features.get('internal', False))
|
||||||
|
|
||||||
def prepare_choice(widget, holder, propname, choice, default,
|
def prepare_choice(widget, holder, propname, choice, default,
|
||||||
|
Loading…
Reference in New Issue
Block a user