Added "Open console" action to Qube Manager

The action uses qvm-console-dispvm.

fixes QubesOS/qubes-issues#4544
This commit is contained in:
Marta Marczykowska-Górecka 2020-03-24 16:51:54 +01:00
parent cf3f102ed7
commit 5c82ad5a29
No known key found for this signature in database
GPG Key ID: 9A752C30B26FD04B
2 changed files with 43 additions and 8 deletions

View File

@ -418,6 +418,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtWidgets.QMainWindow):
self.context_menu.addAction(self.action_updatevm)
self.context_menu.addAction(self.action_run_command_in_vm)
self.context_menu.addAction(self.action_open_console)
self.context_menu.addAction(self.action_resumevm)
self.context_menu.addAction(self.action_startvm_tools_install)
self.context_menu.addAction(self.action_pausevm)
@ -773,6 +774,8 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtWidgets.QMainWindow):
or vm.qid == 0)
self.action_run_command_in_vm.setEnabled(
not vm.get_power_state() == "Paused" and vm.qid != 0)
self.action_open_console.setEnabled(
not vm.get_power_state() == "Paused" and vm.qid != 0)
self.action_set_keyboard_layout.setEnabled(
vm.qid != 0 and
vm.get_power_state() != "Paused" and vm.is_running())
@ -789,6 +792,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtWidgets.QMainWindow):
self.action_editfwrules.setEnabled(False)
self.action_updatevm.setEnabled(False)
self.action_run_command_in_vm.setEnabled(False)
self.action_open_console.setEnabled(False)
self.action_set_keyboard_layout.setEnabled(False)
self.update_logs_menu()
@ -1113,6 +1117,15 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtWidgets.QMainWindow):
thread.finished.connect(self.clear_threads)
thread.start()
# noinspection PyArgumentList
@QtCore.pyqtSlot(name='on_action_open_console_triggered')
def action_open_console_triggered(self):
# pylint: disable=invalid-name
vm = self.get_selected_vm()
subprocess.Popen(['qvm-console-dispvm', vm.name],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
# noinspection PyArgumentList
@QtCore.pyqtSlot(name='on_action_set_keyboard_layout_triggered')
def action_set_keyboard_layout_triggered(self):

View File

@ -24,8 +24,7 @@
</property>
<property name="windowIcon">
<iconset theme="qubes-manager">
<normaloff/>
</iconset>
<normaloff>.</normaloff>.</iconset>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
@ -53,7 +52,16 @@
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
@ -141,10 +149,10 @@
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderDefaultSectionSize">
<attribute name="horizontalHeaderMinimumSectionSize">
<number>150</number>
</attribute>
<attribute name="horizontalHeaderMinimumSectionSize">
<attribute name="horizontalHeaderDefaultSectionSize">
<number>150</number>
</attribute>
<attribute name="verticalHeaderVisible">
@ -263,7 +271,7 @@ Template</string>
<x>0</x>
<y>0</y>
<width>1100</width>
<height>23</height>
<height>24</height>
</rect>
</property>
<property name="contextMenuPolicy">
@ -332,6 +340,7 @@ Template</string>
<addaction name="action_appmenus"/>
<addaction name="action_updatevm"/>
<addaction name="action_run_command_in_vm"/>
<addaction name="action_open_console"/>
<addaction name="action_set_keyboard_layout"/>
<addaction name="separator"/>
<addaction name="logs_menu"/>
@ -385,6 +394,7 @@ Template</string>
<addaction name="action_appmenus"/>
<addaction name="action_updatevm"/>
<addaction name="action_set_keyboard_layout"/>
<addaction name="action_open_console"/>
<addaction name="separator"/>
<addaction name="action_global_settings"/>
<addaction name="action_backup"/>
@ -720,8 +730,7 @@ Template</string>
<action name="action_about_qubes">
<property name="icon">
<iconset theme="qubes-manager">
<normaloff/>
</iconset>
<normaloff>.</normaloff>.</iconset>
</property>
<property name="text">
<string>&amp;Qubes OS</string>
@ -890,6 +899,19 @@ Template</string>
<string>Virtualization Mode</string>
</property>
</action>
<action name="action_open_console">
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/log.png</normaloff>
<normalon>:/log.png</normalon>:/log.png</iconset>
</property>
<property name="text">
<string>Open console in qube</string>
</property>
<property name="toolTip">
<string>Open a secure Xen console in the qube. Useful chiefly for debugging purposes: for normal operation, use &quot;Run Terminal&quot; from the Domains widget. </string>
</property>
</action>
</widget>
<resources>
<include location="../resources.qrc"/>