Merge branch 'master' of git.qubes-os.org:/var/lib/qubes/git/aga/qubes-manager
This commit is contained in:
commit
fe60b60961
1
Makefile
1
Makefile
@ -23,6 +23,7 @@ res:
|
|||||||
pyuic4 -o qubesmanager/ui_restoredlg.py restoredlg.ui
|
pyuic4 -o qubesmanager/ui_restoredlg.py restoredlg.ui
|
||||||
pyuic4 -o qubesmanager/ui_backupdlg.py backupdlg.ui
|
pyuic4 -o qubesmanager/ui_backupdlg.py backupdlg.ui
|
||||||
pyuic4 -o qubesmanager/ui_globalsettingsdlg.py globalsettingsdlg.ui
|
pyuic4 -o qubesmanager/ui_globalsettingsdlg.py globalsettingsdlg.ui
|
||||||
|
pyuic4 -o qubesmanager/ui_logdlg.py logdlg.ui
|
||||||
|
|
||||||
update-repo-current:
|
update-repo-current:
|
||||||
ln -f $(RPMS_DIR)/x86_64/qubes-manager-*$(VERSION)*.rpm ../yum/current-release/current/dom0/rpm/
|
ln -f $(RPMS_DIR)/x86_64/qubes-manager-*$(VERSION)*.rpm ../yum/current-release/current/dom0/rpm/
|
||||||
|
BIN
icons/run-command.png
Normal file
BIN
icons/run-command.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
122
logdlg.ui
Normal file
122
logdlg.ui
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>LogDialog</class>
|
||||||
|
<widget class="QDialog" name="LogDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>750</width>
|
||||||
|
<height>450</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QTextBrowser" name="log_text">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Copy Dom0 clipboard to Qubes clipboard</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="copy_to_qubes_clipboard">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::TabFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Copy to Qubes clipboard</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="resources.qrc">
|
||||||
|
<normaloff>:/copy.png</normaloff>:/copy.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="resources.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>LogDialog</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>LogDialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
@ -239,7 +239,6 @@
|
|||||||
<addaction name="action_global_settings"/>
|
<addaction name="action_global_settings"/>
|
||||||
<addaction name="action_backup"/>
|
<addaction name="action_backup"/>
|
||||||
<addaction name="action_restore"/>
|
<addaction name="action_restore"/>
|
||||||
<addaction name="action_copy_clipboard"/>
|
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menu_view">
|
<widget class="QMenu" name="menu_view">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@ -296,6 +295,7 @@
|
|||||||
<addaction name="action_editfwrules"/>
|
<addaction name="action_editfwrules"/>
|
||||||
<addaction name="action_appmenus"/>
|
<addaction name="action_appmenus"/>
|
||||||
<addaction name="action_updatevm"/>
|
<addaction name="action_updatevm"/>
|
||||||
|
<addaction name="action_run_command_in_vm"/>
|
||||||
<addaction name="action_set_keyboard_layout"/>
|
<addaction name="action_set_keyboard_layout"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="logs_menu"/>
|
<addaction name="logs_menu"/>
|
||||||
@ -346,7 +346,6 @@
|
|||||||
<addaction name="action_restore"/>
|
<addaction name="action_restore"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="action_showallvms"/>
|
<addaction name="action_showallvms"/>
|
||||||
<addaction name="action_copy_clipboard"/>
|
|
||||||
</widget>
|
</widget>
|
||||||
<action name="action_createvm">
|
<action name="action_createvm">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
@ -727,16 +726,16 @@
|
|||||||
<string>Size on Disk</string>
|
<string>Size on Disk</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_copy_clipboard">
|
<action name="action_run_command_in_vm">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="resources.qrc">
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/copy.png</normaloff>:/copy.png</iconset>
|
<normaloff>:/run-command.png</normaloff>:/run-command.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Copy clipboard to Qubes clipboard</string>
|
<string>Run command in VM</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Copy Dom0 clipboard to Qubes clipboard</string>
|
<string>Run command in the specified VM</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
|
257
newappvmdlg.ui
257
newappvmdlg.ui
@ -1,40 +1,25 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>NewAppVMDlg</class>
|
<class>NewVMDlg</class>
|
||||||
<widget class="QDialog" name="NewAppVMDlg">
|
<widget class="QDialog" name="NewVMDlg">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>507</width>
|
<width>500</width>
|
||||||
<height>209</height>
|
<height>200</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Create New AppVM</string>
|
<string>Create New VM</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowIcon">
|
<property name="windowIcon">
|
||||||
<iconset>
|
<iconset>
|
||||||
<normaloff>:/qubes.png</normaloff>:/qubes.png</iconset>
|
<normaloff>:/qubes.png</normaloff>:/qubes.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item row="2" column="0">
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="currentIndex">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="tab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Basic</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
|
||||||
<item row="0" column="1" colspan="2">
|
|
||||||
<widget class="QLineEdit" name="vmname">
|
|
||||||
<property name="text">
|
|
||||||
<string>myappvm</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="3">
|
<item row="0" column="3">
|
||||||
<widget class="QComboBox" name="vmlabel">
|
<widget class="QComboBox" name="vmlabel">
|
||||||
<property name="frame">
|
<property name="frame">
|
||||||
@ -42,13 +27,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Name & label:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1" colspan="2">
|
<item row="1" column="1" colspan="2">
|
||||||
<widget class="QComboBox" name="template_name"/>
|
<widget class="QComboBox" name="template_name"/>
|
||||||
</item>
|
</item>
|
||||||
@ -59,7 +37,67 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="2" column="2">
|
||||||
|
<widget class="QRadioButton" name="proxyvm_radio">
|
||||||
|
<property name="text">
|
||||||
|
<string>ProxyVM</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QRadioButton" name="netvm_radio">
|
||||||
|
<property name="text">
|
||||||
|
<string>NetVM</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1" colspan="2">
|
||||||
|
<widget class="QLineEdit" name="vmname">
|
||||||
|
<property name="text">
|
||||||
|
<string>my-new-vm</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QRadioButton" name="appvm_radio">
|
||||||
|
<property name="text">
|
||||||
|
<string>AppVM</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="3">
|
||||||
|
<widget class="QRadioButton" name="hvm_radio">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>HVM</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Name & label:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="allow_networking">
|
||||||
|
<property name="text">
|
||||||
|
<string>Allow networking</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@ -72,158 +110,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" colspan="2">
|
<item>
|
||||||
<widget class="QCheckBox" name="allow_networking">
|
|
||||||
<property name="text">
|
|
||||||
<string>Allow networking</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="tab_2">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Advanced</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_4">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QGroupBox" name="groupBox">
|
|
||||||
<property name="title">
|
|
||||||
<string>Disk storage</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QSpinBox" name="priv_size">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>10000</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>2</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QCheckBox" name="priv_allow_to_grow">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Allow to grow</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="text">
|
|
||||||
<string>GB</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>Private storage max. size</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QCheckBox" name="checkBox">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Include in backups</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
|
||||||
<property name="title">
|
|
||||||
<string>Memory/CPU</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_5">
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QSpinBox" name="mem_size">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>10000</number>
|
|
||||||
</property>
|
|
||||||
<property name="singleStep">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>400</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QLabel" name="label_6">
|
|
||||||
<property name="text">
|
|
||||||
<string>MB</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QSpinBox" name="spinBox">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="text">
|
|
||||||
<string>VCPUs</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<spacer name="verticalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@ -240,7 +127,7 @@
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>accepted()</signal>
|
<signal>accepted()</signal>
|
||||||
<receiver>NewAppVMDlg</receiver>
|
<receiver>NewVMDlg</receiver>
|
||||||
<slot>accept()</slot>
|
<slot>accept()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
@ -256,7 +143,7 @@
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>rejected()</signal>
|
<signal>rejected()</signal>
|
||||||
<receiver>NewAppVMDlg</receiver>
|
<receiver>NewVMDlg</receiver>
|
||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
|
194
qubesmanager/create_new_vm.py
Normal file
194
qubesmanager/create_new_vm.py
Normal file
@ -0,0 +1,194 @@
|
|||||||
|
#!/usr/bin/python2.6
|
||||||
|
#
|
||||||
|
# The Qubes OS Project, http://www.qubes-os.org
|
||||||
|
#
|
||||||
|
# Copyright (C) 2012 Agnieszka Kostrzewa <agnieszka.kostrzewa@gmail.com>
|
||||||
|
# Copyright (C) 2012 Marek Marczykowski <marmarek@mimuw.edu.pl>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
from PyQt4.QtCore import *
|
||||||
|
from PyQt4.QtGui import *
|
||||||
|
|
||||||
|
from qubes.qubes import QubesVmCollection
|
||||||
|
from qubes.qubes import QubesVmLabels
|
||||||
|
from qubes.qubes import QubesException
|
||||||
|
|
||||||
|
import qubesmanager.resources_rc
|
||||||
|
|
||||||
|
from pyinotify import WatchManager, Notifier, ThreadedNotifier, EventsCodes, ProcessEvent
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
import time
|
||||||
|
import threading
|
||||||
|
|
||||||
|
from ui_newappvmdlg import *
|
||||||
|
from thread_monitor import *
|
||||||
|
|
||||||
|
|
||||||
|
class NewVmDlg (QDialog, Ui_NewVMDlg):
|
||||||
|
def __init__(self, app, qvm_collection, trayIcon, parent = None):
|
||||||
|
super (NewVmDlg, self).__init__(parent)
|
||||||
|
self.setupUi(self)
|
||||||
|
|
||||||
|
self.app = app
|
||||||
|
self.trayIcon = trayIcon
|
||||||
|
self.qvm_collection = qvm_collection
|
||||||
|
|
||||||
|
# Theoretically we should be locking for writing here and unlock
|
||||||
|
# only after the VM creation finished. But the code would be more messy...
|
||||||
|
# Instead we lock for writing in the actual worker thread
|
||||||
|
|
||||||
|
try:
|
||||||
|
from qubes.qubes import QubesHVM
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
self.hvm_radio.setEnabled(True)
|
||||||
|
|
||||||
|
self.qvm_collection.lock_db_for_reading()
|
||||||
|
self.qvm_collection.load()
|
||||||
|
self.qvm_collection.unlock_db()
|
||||||
|
|
||||||
|
self.label_list = QubesVmLabels.values()
|
||||||
|
self.label_list.sort(key=lambda l: l.index)
|
||||||
|
for (i, label) in enumerate(self.label_list):
|
||||||
|
self.vmlabel.insertItem(i, label.name)
|
||||||
|
self.vmlabel.setItemIcon (i, QIcon(label.icon_path))
|
||||||
|
|
||||||
|
self.template_vm_list = [vm for vm in self.qvm_collection.values() if not vm.internal and vm.is_template()]
|
||||||
|
|
||||||
|
default_index = 0
|
||||||
|
for (i, vm) in enumerate(self.template_vm_list):
|
||||||
|
if vm is self.qvm_collection.get_default_template():
|
||||||
|
default_index = i
|
||||||
|
self.template_name.insertItem(i, vm.name + " (default)")
|
||||||
|
else:
|
||||||
|
self.template_name.insertItem(i, vm.name)
|
||||||
|
self.template_name.setCurrentIndex(default_index)
|
||||||
|
|
||||||
|
self.vmname.selectAll()
|
||||||
|
self.vmname.setFocus()
|
||||||
|
|
||||||
|
def on_appvm_radio_toggled(self, checked):
|
||||||
|
if checked:
|
||||||
|
self.template_name.setEnabled(True)
|
||||||
|
self.allow_networking.setEnabled(True)
|
||||||
|
def on_netvm_radio_toggled(self, checked):
|
||||||
|
if checked:
|
||||||
|
self.template_name.setEnabled(True)
|
||||||
|
self.allow_networking.setEnabled(False)
|
||||||
|
def on_proxyvm_radio_toggled(self, checked):
|
||||||
|
if checked:
|
||||||
|
self.template_name.setEnabled(True)
|
||||||
|
self.allow_networking.setEnabled(True)
|
||||||
|
def on_hvm_radio_toggled(self, checked):
|
||||||
|
if checked:
|
||||||
|
self.template_name.setEnabled(False)
|
||||||
|
self.allow_networking.setEnabled(True)
|
||||||
|
|
||||||
|
|
||||||
|
def reject(self):
|
||||||
|
self.done(0)
|
||||||
|
|
||||||
|
def accept(self):
|
||||||
|
vmname = str(self.vmname.text())
|
||||||
|
if self.qvm_collection.get_vm_by_name(vmname) is not None:
|
||||||
|
QMessageBox.warning (None, "Incorrect AppVM Name!", "A VM with the name <b>{0}</b> already exists in the system!".format(vmname))
|
||||||
|
return
|
||||||
|
|
||||||
|
label = self.label_list[self.vmlabel.currentIndex()]
|
||||||
|
|
||||||
|
template_vm = None
|
||||||
|
if self.template_name.isEnabled():
|
||||||
|
template_vm = self.template_vm_list[self.template_name.currentIndex()]
|
||||||
|
|
||||||
|
allow_networking = None
|
||||||
|
if self.allow_networking.isEnabled():
|
||||||
|
allow_networking = self.allow_networking.isChecked()
|
||||||
|
|
||||||
|
if self.appvm_radio.isChecked():
|
||||||
|
createvm_method = self.qvm_collection.add_new_appvm
|
||||||
|
vmtype = "AppVM"
|
||||||
|
elif self.netvm_radio.isChecked():
|
||||||
|
createvm_method = self.qvm_collection.add_new_netvm
|
||||||
|
vmtype = "NetVM"
|
||||||
|
elif self.proxyvm_radio.isChecked():
|
||||||
|
createvm_method = self.qvm_collection.add_new_proxyvm
|
||||||
|
vmtype = "ProxyVM"
|
||||||
|
else: #hvm_radio.isChecked()
|
||||||
|
createvm_method = self.qvm_collection.add_new_hvm
|
||||||
|
vmtype = "HVM"
|
||||||
|
|
||||||
|
|
||||||
|
thread_monitor = ThreadMonitor()
|
||||||
|
thread = threading.Thread (target=self.do_create_vm, args=(createvm_method, vmname, label, template_vm, allow_networking, thread_monitor))
|
||||||
|
thread.daemon = True
|
||||||
|
thread.start()
|
||||||
|
|
||||||
|
progress = QProgressDialog ("Creating new {0} <b>{1}</b>...".format(vmtype, vmname), "", 0, 0)
|
||||||
|
progress.setCancelButton(None)
|
||||||
|
progress.setModal(True)
|
||||||
|
progress.show()
|
||||||
|
|
||||||
|
while not thread_monitor.is_finished():
|
||||||
|
self.app.processEvents()
|
||||||
|
time.sleep (0.1)
|
||||||
|
|
||||||
|
progress.hide()
|
||||||
|
|
||||||
|
if thread_monitor.success:
|
||||||
|
self.trayIcon.showMessage ("Qubes VM Manager", "VM '{0}' has been created.".format(vmname), msecs=3000)
|
||||||
|
else:
|
||||||
|
QMessageBox.warning (None, "Error creating AppVM!", "ERROR: {0}".format(thread_monitor.error_msg))
|
||||||
|
|
||||||
|
self.done(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def do_create_vm (self, createvm_method, vmname, label, template_vm, allow_networking, thread_monitor):
|
||||||
|
vm = None
|
||||||
|
try:
|
||||||
|
self.qvm_collection.lock_db_for_writing()
|
||||||
|
self.qvm_collection.load()
|
||||||
|
|
||||||
|
if template_vm is not None:
|
||||||
|
vm = createvm_method(vmname, template_vm, label = label)
|
||||||
|
vm.create_on_disk(verbose=False, source_template = template_vm)
|
||||||
|
else:
|
||||||
|
vm = createvm_method(vmname, label = label)
|
||||||
|
vm.create_on_disk(verbose=False)
|
||||||
|
|
||||||
|
if allow_networking is not None:
|
||||||
|
firewall = vm.get_firewall_conf()
|
||||||
|
firewall["allow"] = allow_networking
|
||||||
|
firewall["allowDns"] = allow_networking
|
||||||
|
vm.write_firewall_conf(firewall)
|
||||||
|
self.qvm_collection.save()
|
||||||
|
|
||||||
|
except Exception as ex:
|
||||||
|
thread_monitor.set_error_msg (str(ex))
|
||||||
|
if vm:
|
||||||
|
vm.remove_from_disk()
|
||||||
|
finally:
|
||||||
|
self.qvm_collection.unlock_db()
|
||||||
|
|
||||||
|
thread_monitor.set_finished()
|
||||||
|
|
||||||
|
|
88
qubesmanager/log_dialog.py
Normal file
88
qubesmanager/log_dialog.py
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
#!/usr/bin/python2.6
|
||||||
|
#
|
||||||
|
# The Qubes OS Project, http://www.qubes-os.org
|
||||||
|
#
|
||||||
|
# Copyright (C) 2012 Agnieszka Kostrzewa <agnieszka.kostrzewa@gmail.com>
|
||||||
|
# Copyright (C) 2012 Marek Marczykowski <marmarek@mimuw.edu.pl>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import fcntl
|
||||||
|
from PyQt4.QtCore import *
|
||||||
|
from PyQt4.QtGui import *
|
||||||
|
|
||||||
|
from qubes.qubes import QubesException
|
||||||
|
|
||||||
|
import qubesmanager.resources_rc
|
||||||
|
|
||||||
|
from ui_logdlg import *
|
||||||
|
|
||||||
|
|
||||||
|
class LogDialog(Ui_LogDialog, QDialog):
|
||||||
|
|
||||||
|
def __init__(self, app, log_path, parent=None):
|
||||||
|
super(LogDialog, self).__init__(parent)
|
||||||
|
|
||||||
|
self.app = app
|
||||||
|
self.log_path = log_path
|
||||||
|
|
||||||
|
self.setupUi(self)
|
||||||
|
self.setWindowTitle(log_path)
|
||||||
|
|
||||||
|
self.connect(self.copy_to_qubes_clipboard, SIGNAL("clicked()"), self.copy_to_qubes_clipboard_triggered)
|
||||||
|
|
||||||
|
self.__init_log_text__()
|
||||||
|
|
||||||
|
def __init_log_text__(self):
|
||||||
|
log = open(self.log_path)
|
||||||
|
self.displayed_text = log.read()
|
||||||
|
log.close()
|
||||||
|
self.log_text.setText(self.displayed_text)
|
||||||
|
|
||||||
|
|
||||||
|
def copy_to_qubes_clipboard_triggered(self):
|
||||||
|
copy_text_to_qubes_clipboard(self.displayed_text)
|
||||||
|
|
||||||
|
########################COPY TEXT TO QUBES CLIPBOARD
|
||||||
|
|
||||||
|
def copy_text_to_qubes_clipboard(text):
|
||||||
|
#inter-appviewer lock
|
||||||
|
|
||||||
|
try:
|
||||||
|
fd = os.open("/var/run/qubes/appviewer.lock", os.O_RDWR|os.O_CREAT, 0600);
|
||||||
|
fcntl.flock(fd, fcntl.LOCK_EX);
|
||||||
|
except IOError:
|
||||||
|
QMessageBox.warning (None, "Warning!", "Error while accessing Qubes clipboard!")
|
||||||
|
return
|
||||||
|
|
||||||
|
qubes_clipboard = open("/var/run/qubes/qubes_clipboard.bin", 'w')
|
||||||
|
qubes_clipboard.write(text)
|
||||||
|
qubes_clipboard.close()
|
||||||
|
|
||||||
|
qubes_clip_source = open("/var/run/qubes/qubes_clipboard.bin.source", 'w')
|
||||||
|
qubes_clip_source.write("dom0")
|
||||||
|
qubes_clip_source.close()
|
||||||
|
|
||||||
|
try:
|
||||||
|
fcntl.flock(fd, fcntl.LOCK_UN)
|
||||||
|
os.close(fd)
|
||||||
|
except IOError:
|
||||||
|
QMessageBox.warning (None, "Warning!", "Error while writing to Qubes clipboard!")
|
||||||
|
return
|
||||||
|
|
@ -23,6 +23,7 @@
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import fcntl
|
import fcntl
|
||||||
|
import errno
|
||||||
import dbus
|
import dbus
|
||||||
from PyQt4.QtCore import *
|
from PyQt4.QtCore import *
|
||||||
from PyQt4.QtGui import *
|
from PyQt4.QtGui import *
|
||||||
@ -40,10 +41,12 @@ from qubes import qubesutils
|
|||||||
import qubesmanager.resources_rc
|
import qubesmanager.resources_rc
|
||||||
import ui_newappvmdlg
|
import ui_newappvmdlg
|
||||||
from ui_mainwindow import *
|
from ui_mainwindow import *
|
||||||
|
from create_new_vm import NewVmDlg
|
||||||
from settings import VMSettingsWindow
|
from settings import VMSettingsWindow
|
||||||
from restore import RestoreVMsWindow
|
from restore import RestoreVMsWindow
|
||||||
from backup import BackupVMsWindow
|
from backup import BackupVMsWindow
|
||||||
from global_settings import GlobalSettingsWindow
|
from global_settings import GlobalSettingsWindow
|
||||||
|
from log_dialog import LogDialog
|
||||||
from thread_monitor import *
|
from thread_monitor import *
|
||||||
|
|
||||||
from pyinotify import WatchManager, Notifier, ThreadedNotifier, EventsCodes, ProcessEvent
|
from pyinotify import WatchManager, Notifier, ThreadedNotifier, EventsCodes, ProcessEvent
|
||||||
@ -51,8 +54,8 @@ from pyinotify import WatchManager, Notifier, ThreadedNotifier, EventsCodes, Pro
|
|||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
from datetime import datetime,timedelta
|
from datetime import datetime,timedelta
|
||||||
|
from qubes.qubes import updates_stat_file
|
||||||
|
|
||||||
updates_stat_file = 'last_update.stat'
|
|
||||||
qubes_guid_path = '/usr/bin/qubes_guid'
|
qubes_guid_path = '/usr/bin/qubes_guid'
|
||||||
|
|
||||||
update_suggestion_interval = 14 # 14 days
|
update_suggestion_interval = 14 # 14 days
|
||||||
@ -458,20 +461,37 @@ class VmUpdateInfoWidget(QWidget):
|
|||||||
|
|
||||||
self.previous_outdated = outdated
|
self.previous_outdated = outdated
|
||||||
|
|
||||||
if vm.is_updateable():
|
if vm.qid == 0:
|
||||||
update_recommended = self.previous_update_recommended
|
update_recommended = self.previous_update_recommended
|
||||||
stat_file = vm.dir_path + '/' + updates_stat_file
|
#slot for dom0 special treatment
|
||||||
if not os.path.exists(stat_file) or \
|
#
|
||||||
time.time() - os.path.getmtime(stat_file) > \
|
#
|
||||||
update_suggestion_interval * 24 * 3600:
|
elif vm.is_updateable():
|
||||||
update_recommended = True
|
update_recommended = self.previous_update_recommended
|
||||||
else:
|
stat_file_path = vm.dir_path + '/' + updates_stat_file
|
||||||
|
if not os.path.exists(stat_file_path):
|
||||||
update_recommended = False
|
update_recommended = False
|
||||||
if not self.show_text and self.previous_update_recommended != False:
|
else:
|
||||||
self.update_status_widget(None)
|
if (not hasattr(vm, "updates_stat_file_read_time")) or vm.updates_stat_file_read_time <= os.path.getmtime(stat_file_path):
|
||||||
|
|
||||||
|
stat_file = open(stat_file_path, "r")
|
||||||
|
updates = stat_file.read().strip()
|
||||||
|
stat_file.close()
|
||||||
|
if updates.isdigit():
|
||||||
|
updates = int(updates)
|
||||||
|
else:
|
||||||
|
updates = 0
|
||||||
|
|
||||||
|
if updates == 0:
|
||||||
|
update_recommended = False
|
||||||
|
else:
|
||||||
|
update_recommended = True
|
||||||
|
vm.updates_stat_file_read_time = time.time()
|
||||||
|
|
||||||
if update_recommended and not self.previous_update_recommended:
|
if update_recommended and not self.previous_update_recommended:
|
||||||
self.update_status_widget("update")
|
self.update_status_widget("update")
|
||||||
|
elif self.previous_update_recommended and not update_recommended:
|
||||||
|
self.update_status_widget(None)
|
||||||
|
|
||||||
self.previous_update_recommended = update_recommended
|
self.previous_update_recommended = update_recommended
|
||||||
|
|
||||||
@ -482,7 +502,7 @@ class VmUpdateInfoWidget(QWidget):
|
|||||||
if state == "update":
|
if state == "update":
|
||||||
label_text = "<font color=\"#CCCC00\">Check updates</font>"
|
label_text = "<font color=\"#CCCC00\">Check updates</font>"
|
||||||
icon_path = ":/update-recommended.png"
|
icon_path = ":/update-recommended.png"
|
||||||
tooltip_text = "Update recommended."
|
tooltip_text = "Updates pending!"
|
||||||
elif state == "outdated":
|
elif state == "outdated":
|
||||||
label_text = "<font color=\"red\">VM outdated</font>"
|
label_text = "<font color=\"red\">VM outdated</font>"
|
||||||
icon_path = ":/outdated.png"
|
icon_path = ":/outdated.png"
|
||||||
@ -588,10 +608,8 @@ class VmRowInTable(object):
|
|||||||
if update_size_on_disk == True:
|
if update_size_on_disk == True:
|
||||||
self.size_widget.update()
|
self.size_widget.update()
|
||||||
|
|
||||||
class NewAppVmDlg (QDialog, ui_newappvmdlg.Ui_NewAppVMDlg):
|
|
||||||
def __init__(self, parent = None):
|
|
||||||
super (NewAppVmDlg, self).__init__(parent)
|
|
||||||
self.setupUi(self)
|
|
||||||
|
|
||||||
vm_shutdown_timeout = 15000 # in msec
|
vm_shutdown_timeout = 15000 # in msec
|
||||||
|
|
||||||
@ -717,6 +735,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
self.context_menu.addAction(self.action_appmenus)
|
self.context_menu.addAction(self.action_appmenus)
|
||||||
self.context_menu.addAction(self.action_editfwrules)
|
self.context_menu.addAction(self.action_editfwrules)
|
||||||
self.context_menu.addAction(self.action_updatevm)
|
self.context_menu.addAction(self.action_updatevm)
|
||||||
|
self.context_menu.addAction(self.action_run_command_in_vm)
|
||||||
self.context_menu.addAction(self.action_set_keyboard_layout)
|
self.context_menu.addAction(self.action_set_keyboard_layout)
|
||||||
self.context_menu.addMenu(self.logs_menu)
|
self.context_menu.addMenu(self.logs_menu)
|
||||||
self.context_menu.addMenu(self.blk_menu)
|
self.context_menu.addMenu(self.blk_menu)
|
||||||
@ -1022,6 +1041,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
self.action_appmenus.setEnabled(not vm.is_netvm())
|
self.action_appmenus.setEnabled(not vm.is_netvm())
|
||||||
self.action_editfwrules.setEnabled(vm.is_networked() and not (vm.is_netvm() and not vm.is_proxyvm()))
|
self.action_editfwrules.setEnabled(vm.is_networked() and not (vm.is_netvm() and not vm.is_proxyvm()))
|
||||||
self.action_updatevm.setEnabled(vm.is_updateable() or vm.qid == 0)
|
self.action_updatevm.setEnabled(vm.is_updateable() or vm.qid == 0)
|
||||||
|
self.action_run_command_in_vm.setEnabled(vm.qid != 0)
|
||||||
self.action_set_keyboard_layout.setEnabled(vm.qid != 0 and vm.last_running)
|
self.action_set_keyboard_layout.setEnabled(vm.qid != 0 and vm.last_running)
|
||||||
else:
|
else:
|
||||||
self.action_settings.setEnabled(False)
|
self.action_settings.setEnabled(False)
|
||||||
@ -1033,6 +1053,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
self.action_appmenus.setEnabled(False)
|
self.action_appmenus.setEnabled(False)
|
||||||
self.action_editfwrules.setEnabled(False)
|
self.action_editfwrules.setEnabled(False)
|
||||||
self.action_updatevm.setEnabled(False)
|
self.action_updatevm.setEnabled(False)
|
||||||
|
self.action_run_command_in_vm.setEnabled(False)
|
||||||
self.action_set_keyboard_layout.setEnabled(False)
|
self.action_set_keyboard_layout.setEnabled(False)
|
||||||
|
|
||||||
|
|
||||||
@ -1045,90 +1066,8 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
|
|
||||||
@pyqtSlot(name='on_action_createvm_triggered')
|
@pyqtSlot(name='on_action_createvm_triggered')
|
||||||
def action_createvm_triggered(self):
|
def action_createvm_triggered(self):
|
||||||
dialog = NewAppVmDlg()
|
dialog = NewVmDlg(app, self.qvm_collection, trayIcon)
|
||||||
|
dialog.exec_()
|
||||||
# Theoretically we should be locking for writing here and unlock
|
|
||||||
# only after the VM creation finished. But the code would be more messy...
|
|
||||||
# Instead we lock for writing in the actual worker thread
|
|
||||||
|
|
||||||
self.qvm_collection.lock_db_for_reading()
|
|
||||||
self.qvm_collection.load()
|
|
||||||
self.qvm_collection.unlock_db()
|
|
||||||
|
|
||||||
label_list = QubesVmLabels.values()
|
|
||||||
label_list.sort(key=lambda l: l.index)
|
|
||||||
for (i, label) in enumerate(label_list):
|
|
||||||
dialog.vmlabel.insertItem(i, label.name)
|
|
||||||
dialog.vmlabel.setItemIcon (i, QIcon(label.icon_path))
|
|
||||||
|
|
||||||
template_vm_list = [vm for vm in self.qvm_collection.values() if not vm.internal and vm.is_template()]
|
|
||||||
|
|
||||||
default_index = 0
|
|
||||||
for (i, vm) in enumerate(template_vm_list):
|
|
||||||
if vm is self.qvm_collection.get_default_template():
|
|
||||||
default_index = i
|
|
||||||
dialog.template_name.insertItem(i, vm.name + " (default)")
|
|
||||||
else:
|
|
||||||
dialog.template_name.insertItem(i, vm.name)
|
|
||||||
dialog.template_name.setCurrentIndex(default_index)
|
|
||||||
|
|
||||||
dialog.vmname.selectAll()
|
|
||||||
dialog.vmname.setFocus()
|
|
||||||
|
|
||||||
if dialog.exec_():
|
|
||||||
vmname = str(dialog.vmname.text())
|
|
||||||
if self.qvm_collection.get_vm_by_name(vmname) is not None:
|
|
||||||
QMessageBox.warning (None, "Incorrect AppVM Name!", "A VM with the name <b>{0}</b> already exists in the system!".format(vmname))
|
|
||||||
return
|
|
||||||
|
|
||||||
label = label_list[dialog.vmlabel.currentIndex()]
|
|
||||||
template_vm = template_vm_list[dialog.template_name.currentIndex()]
|
|
||||||
|
|
||||||
allow_networking = dialog.allow_networking.isChecked()
|
|
||||||
|
|
||||||
thread_monitor = ThreadMonitor()
|
|
||||||
thread = threading.Thread (target=self.do_create_appvm, args=(vmname, label, template_vm, allow_networking, thread_monitor))
|
|
||||||
thread.daemon = True
|
|
||||||
thread.start()
|
|
||||||
|
|
||||||
progress = QProgressDialog ("Creating new AppVM <b>{0}</b>...".format(vmname), "", 0, 0)
|
|
||||||
progress.setCancelButton(None)
|
|
||||||
progress.setModal(True)
|
|
||||||
progress.show()
|
|
||||||
|
|
||||||
while not thread_monitor.is_finished():
|
|
||||||
app.processEvents()
|
|
||||||
time.sleep (0.1)
|
|
||||||
|
|
||||||
progress.hide()
|
|
||||||
|
|
||||||
if thread_monitor.success:
|
|
||||||
trayIcon.showMessage ("Qubes VM Manager", "VM '{0}' has been created.".format(vmname), msecs=3000)
|
|
||||||
else:
|
|
||||||
QMessageBox.warning (None, "Error creating AppVM!", "ERROR: {0}".format(thread_monitor.error_msg))
|
|
||||||
|
|
||||||
|
|
||||||
def do_create_appvm (self, vmname, label, template_vm, allow_networking, thread_monitor):
|
|
||||||
vm = None
|
|
||||||
try:
|
|
||||||
self.qvm_collection.lock_db_for_writing()
|
|
||||||
self.qvm_collection.load()
|
|
||||||
|
|
||||||
vm = self.qvm_collection.add_new_appvm(vmname, template_vm, label = label)
|
|
||||||
vm.create_on_disk(verbose=False)
|
|
||||||
firewall = vm.get_firewall_conf()
|
|
||||||
firewall["allow"] = allow_networking
|
|
||||||
firewall["allowDns"] = allow_networking
|
|
||||||
vm.write_firewall_conf(firewall)
|
|
||||||
self.qvm_collection.save()
|
|
||||||
except Exception as ex:
|
|
||||||
thread_monitor.set_error_msg (str(ex))
|
|
||||||
if vm:
|
|
||||||
vm.remove_from_disk()
|
|
||||||
finally:
|
|
||||||
self.qvm_collection.unlock_db()
|
|
||||||
|
|
||||||
thread_monitor.set_finished()
|
|
||||||
|
|
||||||
|
|
||||||
def get_selected_vm(self):
|
def get_selected_vm(self):
|
||||||
@ -1383,6 +1322,47 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
thread_monitor.set_finished()
|
thread_monitor.set_finished()
|
||||||
|
|
||||||
|
|
||||||
|
@pyqtSlot(name='on_action_run_command_in_vm_triggered')
|
||||||
|
def action_run_command_in_vm_triggered(self):
|
||||||
|
vm = self.get_selected_vm()
|
||||||
|
|
||||||
|
thread_monitor = ThreadMonitor()
|
||||||
|
thread = threading.Thread (target=self.do_run_command_in_vm, args=(vm, thread_monitor))
|
||||||
|
thread.daemon = True
|
||||||
|
thread.start()
|
||||||
|
|
||||||
|
while not thread_monitor.is_finished():
|
||||||
|
app.processEvents()
|
||||||
|
time.sleep (0.2)
|
||||||
|
|
||||||
|
if not thread_monitor.success:
|
||||||
|
QMessageBox.warning (None, "Error while running command", "Exception while running command:<br>{0}".format(thread_monitor.error_msg))
|
||||||
|
|
||||||
|
|
||||||
|
def do_run_command_in_vm(self, vm, thread_monitor):
|
||||||
|
cmd = ['kdialog', '--title', 'Qubes command entry', '--inputbox', 'Run command in <b>'+vm.name+'</b>:']
|
||||||
|
kdialog = subprocess.Popen(cmd, stdout = subprocess.PIPE)
|
||||||
|
command_to_run = kdialog.stdout.read()
|
||||||
|
command_to_run = "'"+command_to_run.strip()+"'"
|
||||||
|
if command_to_run != "":
|
||||||
|
command_to_run = "qvm-run -a "+ vm.name + " " + command_to_run
|
||||||
|
try:
|
||||||
|
subprocess.check_call(command_to_run, shell=True)
|
||||||
|
except OSError as ex:
|
||||||
|
if ex.errno == errno.EINTR:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
thread_monitor.set_error_msg(str(ex))
|
||||||
|
thread_monitor.set_finished()
|
||||||
|
except Exception as ex:
|
||||||
|
thread_monitor.set_error_msg(str(ex))
|
||||||
|
thread_monitor.set_finished()
|
||||||
|
thread_monitor.set_finished()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@pyqtSlot(name='on_action_set_keyboard_layout_triggered')
|
@pyqtSlot(name='on_action_set_keyboard_layout_triggered')
|
||||||
def action_set_keyboard_layout_triggered(self):
|
def action_set_keyboard_layout_triggered(self):
|
||||||
vm = self.get_selected_vm()
|
vm = self.get_selected_vm()
|
||||||
@ -1494,33 +1474,6 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
def action_about_qubes_triggered(self):
|
def action_about_qubes_triggered(self):
|
||||||
QMessageBox.about(self, "About...", "<b>Qubes OS</b><br><br>Release 1.0")
|
QMessageBox.about(self, "About...", "<b>Qubes OS</b><br><br>Release 1.0")
|
||||||
|
|
||||||
@pyqtSlot(name='on_action_copy_clipboard_triggered')
|
|
||||||
def action_copy_clipboard_triggered(self):
|
|
||||||
clipboard = app.clipboard().text()
|
|
||||||
|
|
||||||
#inter-appviewer lock
|
|
||||||
try:
|
|
||||||
fd = os.open("/var/run/qubes/appviewer.lock", os.O_RDWR|os.O_CREAT, 0600);
|
|
||||||
fcntl.flock(fd, fcntl.LOCK_EX);
|
|
||||||
except IOError:
|
|
||||||
QMessageBox.warning (None, "Warning!", "Error while accessing Qubes clipboard!")
|
|
||||||
return
|
|
||||||
|
|
||||||
qubes_clipboard = open("/var/run/qubes/qubes_clipboard.bin", 'w')
|
|
||||||
qubes_clipboard.write(clipboard)
|
|
||||||
qubes_clipboard.close()
|
|
||||||
|
|
||||||
qubes_clip_source = open("/var/run/qubes/qubes_clipboard.bin.source", 'w')
|
|
||||||
qubes_clip_source.write("dom0")
|
|
||||||
qubes_clip_source.close()
|
|
||||||
|
|
||||||
try:
|
|
||||||
fcntl.flock(fd, fcntl.LOCK_UN)
|
|
||||||
os.close(fd)
|
|
||||||
except IOError:
|
|
||||||
QMessageBox.warning (None, "Warning!", "Error while writing to Qubes clipboard!")
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
def createPopupMenu(self):
|
def createPopupMenu(self):
|
||||||
menu = QMenu()
|
menu = QMenu()
|
||||||
@ -1603,9 +1556,8 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
@pyqtSlot('QAction *')
|
@pyqtSlot('QAction *')
|
||||||
def show_log(self, action):
|
def show_log(self, action):
|
||||||
log = str(action.data().toString())
|
log = str(action.data().toString())
|
||||||
|
log_dialog = LogDialog(app, log)
|
||||||
cmd = ['kdialog', '--textbox', log, '700', '450', '--title', log]
|
log_dialog.exec_()
|
||||||
subprocess.Popen(cmd)
|
|
||||||
|
|
||||||
|
|
||||||
@pyqtSlot('QAction *')
|
@pyqtSlot('QAction *')
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
<file alias="show-all-running.png">icons/show-all-running.png</file>
|
<file alias="show-all-running.png">icons/show-all-running.png</file>
|
||||||
<file alias="mount.png">icons/mount.png</file>
|
<file alias="mount.png">icons/mount.png</file>
|
||||||
<file alias="log.png">icons/log.png</file>
|
<file alias="log.png">icons/log.png</file>
|
||||||
|
<file alias="run-command.png">icons/run-command.png</file>
|
||||||
<file alias="kbd-layout.png">icons/kbd-layout.png</file>
|
<file alias="kbd-layout.png">icons/kbd-layout.png</file>
|
||||||
<file alias="copy.png">icons/copy.png</file>
|
<file alias="copy.png">icons/copy.png</file>
|
||||||
<file alias="pencil.png">icons/pencil.png</file>
|
<file alias="pencil.png">icons/pencil.png</file>
|
||||||
|
@ -44,6 +44,7 @@ cp qubesmanager/global_settings.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubes
|
|||||||
cp qubesmanager/multiselectwidget.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
|
cp qubesmanager/multiselectwidget.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
|
||||||
cp qubesmanager/restore.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
|
cp qubesmanager/restore.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
|
||||||
cp qubesmanager/settings.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
|
cp qubesmanager/settings.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
|
||||||
|
cp qubesmanager/log_dialog.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
|
||||||
cp qubesmanager/thread_monitor.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
|
cp qubesmanager/thread_monitor.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
|
||||||
cp qubesmanager/resources_rc.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
|
cp qubesmanager/resources_rc.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
|
||||||
cp qubesmanager/__init__.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
|
cp qubesmanager/__init__.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
|
||||||
@ -56,6 +57,7 @@ cp qubesmanager/ui_newappvmdlg.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesm
|
|||||||
cp qubesmanager/ui_newfwruledlg.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
|
cp qubesmanager/ui_newfwruledlg.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
|
||||||
cp qubesmanager/ui_restoredlg.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
|
cp qubesmanager/ui_restoredlg.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
|
||||||
cp qubesmanager/ui_settingsdlg.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
|
cp qubesmanager/ui_settingsdlg.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
|
||||||
|
cp qubesmanager/ui_logdlg.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
|
||||||
|
|
||||||
mkdir -p $RPM_BUILD_ROOT/usr/share/applications
|
mkdir -p $RPM_BUILD_ROOT/usr/share/applications
|
||||||
cp qubes-manager.desktop $RPM_BUILD_ROOT/usr/share/applications
|
cp qubes-manager.desktop $RPM_BUILD_ROOT/usr/share/applications
|
||||||
@ -139,6 +141,9 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%{python_sitearch}/qubesmanager/ui_settingsdlg.py
|
%{python_sitearch}/qubesmanager/ui_settingsdlg.py
|
||||||
%{python_sitearch}/qubesmanager/ui_settingsdlg.pyc
|
%{python_sitearch}/qubesmanager/ui_settingsdlg.pyc
|
||||||
%{python_sitearch}/qubesmanager/ui_settingsdlg.pyo
|
%{python_sitearch}/qubesmanager/ui_settingsdlg.pyo
|
||||||
|
%{python_sitearch}/qubesmanager/ui_logdlg.py
|
||||||
|
%{python_sitearch}/qubesmanager/ui_logdlg.pyc
|
||||||
|
%{python_sitearch}/qubesmanager/ui_logdlg.pyo
|
||||||
|
|
||||||
|
|
||||||
/usr/share/applications/qubes-manager.desktop
|
/usr/share/applications/qubes-manager.desktop
|
||||||
|
Loading…
Reference in New Issue
Block a user