Added default option for network change
This commit is contained in:
parent
3bd7c218e5
commit
9f44f7413d
@ -843,7 +843,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QMainWindow):
|
|||||||
if reply != QMessageBox.Yes:
|
if reply != QMessageBox.Yes:
|
||||||
return
|
return
|
||||||
|
|
||||||
if netvm_name is not None:
|
if netvm_name not in [None, 'default']:
|
||||||
check_power = any(info.state['power'] == 'Running' for info
|
check_power = any(info.state['power'] == 'Running' for info
|
||||||
in self.get_selected_vms())
|
in self.get_selected_vms())
|
||||||
netvm = self.qubes_cache.get_vm(name=netvm_name)
|
netvm = self.qubes_cache.get_vm(name=netvm_name)
|
||||||
@ -863,6 +863,9 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QMainWindow):
|
|||||||
errors = []
|
errors = []
|
||||||
for info in self.get_selected_vms():
|
for info in self.get_selected_vms():
|
||||||
try:
|
try:
|
||||||
|
if netvm_name == 'default':
|
||||||
|
delattr(info.vm, 'netvm')
|
||||||
|
else:
|
||||||
info.vm.netvm = netvm_name
|
info.vm.netvm = netvm_name
|
||||||
except exc.QubesValueError as ex:
|
except exc.QubesValueError as ex:
|
||||||
errors.append((info.name, str(ex)))
|
errors.append((info.name, str(ex)))
|
||||||
@ -945,10 +948,19 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QMainWindow):
|
|||||||
action.setData(vm.name)
|
action.setData(vm.name)
|
||||||
action.triggered.connect(partial(self.change_template, vm.name))
|
action.triggered.connect(partial(self.change_template, vm.name))
|
||||||
|
|
||||||
|
def _get_default_netvm(self):
|
||||||
|
for vm in self.qubes_app.domains:
|
||||||
|
if vm.klass == 'AppVM':
|
||||||
|
return vm.property_get_default('netvm')
|
||||||
|
|
||||||
def init_network_menu(self):
|
def init_network_menu(self):
|
||||||
|
default = self._get_default_netvm().name
|
||||||
self.network_menu.clear()
|
self.network_menu.clear()
|
||||||
action = self.network_menu.addAction("None")
|
action = self.network_menu.addAction("None")
|
||||||
action.triggered.connect(partial(self.change_network, None))
|
action.triggered.connect(partial(self.change_network, None))
|
||||||
|
action = self.network_menu.addAction("default ({0})".format(default))
|
||||||
|
action.triggered.connect(partial(self.change_network, 'default'))
|
||||||
|
|
||||||
for vm in self.qubes_app.domains:
|
for vm in self.qubes_app.domains:
|
||||||
if vm.qid != 0 and vm.provides_network:
|
if vm.qid != 0 and vm.provides_network:
|
||||||
action = self.network_menu.addAction(vm.name)
|
action = self.network_menu.addAction(vm.name)
|
||||||
|
Loading…
Reference in New Issue
Block a user