added network_menu

This commit is contained in:
donoban 2020-11-10 00:50:43 +01:00
parent 62489e5c78
commit 5f4526a35c
No known key found for this signature in database
GPG Key ID: 141310D8E3ED08A5
2 changed files with 25 additions and 0 deletions

View File

@ -650,6 +650,10 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QMainWindow):
for info in self.get_selected_vms(): for info in self.get_selected_vms():
info.vm.template = template info.vm.template = template
def change_network(self, netvm):
for info in self.get_selected_vms():
info.vm.netvm = netvm
def __init__(self, qt_app, qubes_app, dispatcher, _parent=None): def __init__(self, qt_app, qubes_app, dispatcher, _parent=None):
super().__init__() super().__init__()
self.setupUi(self) self.setupUi(self)
@ -671,10 +675,12 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QMainWindow):
self.frame_height = 0 self.frame_height = 0
self.init_template_menu() self.init_template_menu()
self.init_network_menu()
self.context_menu = QMenu(self) self.context_menu = QMenu(self)
self.context_menu.addAction(self.action_settings) self.context_menu.addAction(self.action_settings)
self.context_menu.addMenu(self.template_menu) self.context_menu.addMenu(self.template_menu)
self.context_menu.addMenu(self.network_menu)
self.context_menu.addAction(self.action_editfwrules) self.context_menu.addAction(self.action_editfwrules)
self.context_menu.addAction(self.action_appmenus) self.context_menu.addAction(self.action_appmenus)
self.context_menu.addAction(self.action_set_keyboard_layout) self.context_menu.addAction(self.action_set_keyboard_layout)
@ -834,6 +840,15 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QMainWindow):
action.setCheckable(True) action.setCheckable(True)
action.triggered.connect(partial(self.change_template, vm.name)) action.triggered.connect(partial(self.change_template, vm.name))
def init_network_menu(self):
self.network_menu.clear()
for vm in self.qubes_app.domains:
if vm.qid != 0 and vm.provides_network:
action = self.network_menu.addAction(vm.name)
action.setData(vm.name)
action.setCheckable(True)
action.triggered.connect(partial(self.change_network, vm.name))
def setup_application(self): def setup_application(self):
self.qt_app.setApplicationName(self.tr("Qube Manager")) self.qt_app.setApplicationName(self.tr("Qube Manager"))
self.qt_app.setWindowIcon(QIcon.fromTheme("qubes-manager")) self.qt_app.setWindowIcon(QIcon.fromTheme("qubes-manager"))

View File

@ -288,6 +288,15 @@ Template</string>
<normaloff>:/templatevm.png</normaloff>:/templatevm.png</iconset> <normaloff>:/templatevm.png</normaloff>:/templatevm.png</iconset>
</property> </property>
</widget> </widget>
<widget class="QMenu" name="network_menu">
<property name="title">
<string>Network</string>
</property>
<property name="icon">
<iconset>
<normaloff>:/netvm.png</normaloff>:/netvm.png</iconset>
</property>
</widget>
<addaction name="action_createvm"/> <addaction name="action_createvm"/>
<addaction name="action_removevm"/> <addaction name="action_removevm"/>
<addaction name="action_clonevm"/> <addaction name="action_clonevm"/>
@ -300,6 +309,7 @@ Template</string>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="action_settings"/> <addaction name="action_settings"/>
<addaction name="template_menu"/> <addaction name="template_menu"/>
<addaction name="network_menu"/>
<addaction name="action_editfwrules"/> <addaction name="action_editfwrules"/>
<addaction name="action_appmenus"/> <addaction name="action_appmenus"/>
<addaction name="action_updatevm"/> <addaction name="action_updatevm"/>