fixes from @marmarek's review

This commit is contained in:
Wojtek Porczyk 2017-07-14 02:19:24 +02:00
parent c58e9850e9
commit 96fc9c192c
3 changed files with 27 additions and 36 deletions

View File

@ -43,7 +43,7 @@ class AppListWidgetItem(QListWidgetItem):
@classmethod
def from_line(cls, line):
ident, name = line.strip().split(maxsplit=2)
ident, icon_name, name = line.strip().split(maxsplit=2)
return cls(name=name, ident=ident)

View File

@ -412,9 +412,9 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
# self.vcpus.setMaximum(QubesHost().no_cpus)
self.vcpus.setValue(int(self.vm.vcpus))
self.include_in_balancing.setEnabled(not self.vm.hvm)
self.include_in_balancing.setChecked(not self.vm.hvm
and self.vm.features.get('services.meminfo-writer', True))
self.include_in_balancing.setEnabled(True)
self.include_in_balancing.setChecked(
self.vm.features.get('services.meminfo-writer', True))
self.max_mem_size.setEnabled(self.include_in_balancing.isChecked())
try:
@ -476,35 +476,17 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
self.other_groupbox.setVisible(False)
# if not hasattr(self.vm, "dispvm_netvm"):
# self.other_groupbox.setVisible(False)
# else:
# self.other_groupbox.setVisible(True)
# netvm_list = [vm for vm in self.app.values() if not vm.internal and vm.is_netvm() and vm.qid != 0]
# self.dispvm_netvm_idx = -1
# text = "default (same as VM own NetVM)"
# if self.vm.uses_default_dispvm_netvm:
# text += self.tr(" (current)")
# self.dispvm_netvm_idx = 0
# self.dispvm_netvm.insertItem(0, text)
# for (i, vm) in enumerate(netvm_list):
# text = vm.name
# if self.vm.dispvm_netvm is not None and vm.qid == \
# self.vm.dispvm_netvm.qid and not \
# self.vm.uses_default_dispvm_netvm:
# self.dispvm_netvm_idx = i+1
# text += self.tr(" (current)")
# self.dispvm_netvm.insertItem(i+1, text)
# none_text = "none"
# if self.vm.dispvm_netvm is None:
# none_text += self.tr(" (current)")
# self.dispvm_netvm_idx = len(netvm_list)+1
# self.dispvm_netvm.insertItem(len(netvm_list)+1, none_text)
# self.dispvm_netvm.setCurrentIndex(self.dispvm_netvm_idx)
if not hasattr(self.vm, 'default_dispvm'):
self.other_groupbox.setVisible(False)
else:
self.other_groupbox.setVisible(True)
self.default_dispvm_list, self.default_dispvm_idx = \
utils.prepare_vm_choice(
self.default_dispvm,
self.vm, 'default_dispvm',
self.vm.app.default_dispvm,
(lambda vm: isinstance(vm, qubesadmin.vm.DispVM)),
allow_default=True, allow_none=True)
def __apply_advanced_tab__(self):
msg = []
@ -552,6 +534,15 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
except Exception as ex:
msg.append(str(ex))
#vm default_dispvm changed
try:
if self.default_dispvm.currentIndex() != self.default_dispvm_idx:
self.vm.default_dispvm = \
self.default_dispvm_list[self.default_dispvm.currentIndex()]
self.anything_changed = True
except Exception as ex:
msg.append(str(ex))
return msg
def drive_path_button_pressed(self):

View File

@ -607,15 +607,15 @@
<item row="1" column="0">
<widget class="QLabel" name="label_26">
<property name="text">
<string>NetVM for DispVM:</string>
<string>Default DispVM:</string>
</property>
<property name="buddy">
<cstring>dispvm_netvm</cstring>
<cstring>default_dispvm</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="dispvm_netvm"/>
<widget class="QComboBox" name="default_dispvm"/>
</item>
</layout>
</widget>