Browse Source

Add extended information and Network diagram to Manager

unman 7 years ago
parent
commit
a72003f44b

+ 2 - 0
Makefile

@@ -29,6 +29,8 @@ res:
 	pyuic4 -o qubesmanager/ui_logdlg.py logdlg.ui
 	pyuic4 -o qubesmanager/ui_about.py about.ui
 	pyuic4 -o qubesmanager/ui_releasenotes.py releasenotes.ui
+	pyuic4 -o qubesmanager/ui_informationnotes.py informationnotes.ui
+	pyuic4 -o qubesmanager/ui_networknotes.py networknotes.ui
 
 update-repo-current:
 	ln -f $(RPMS_DIR)/x86_64/qubes-manager-*$(VERSION)*.rpm ../yum/current-release/current/dom0/rpm/

+ 14 - 0
about.ui

@@ -81,6 +81,20 @@
        </property>
       </widget>
      </item>
+     <item>
+      <widget class="QPushButton" name="informationNotes">
+       <property name="text">
+        <string>Version Information</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="networkNotes">
+       <property name="text">
+        <string>Qubes Networking</string>
+       </property>
+      </widget>
+     </item>
      <item>
       <widget class="QPushButton" name="ok">
        <property name="text">

+ 67 - 0
informationnotes.ui

@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>InformationNotesDialog</class>
+ <widget class="QDialog" name="InformationNotesDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>600</width>
+    <height>600</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>More Information</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QTextBrowser" name="informationNotes"/>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>InformationNotesDialog</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>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>InformationNotesDialog</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>
+ </connections>
+</ui>

+ 67 - 0
networknotes.ui

@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>NetworkNotesDialog</class>
+ <widget class="QDialog" name="NetworkNotesDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>600</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Qubes Networking</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QTextBrowser" name="networkNotes"/>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>NetworkNotesDialog</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>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>NetworkNotesDialog</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>
+ </connections>
+</ui>

+ 16 - 0
qubesmanager/about.py

@@ -24,6 +24,8 @@
 from PyQt4.QtCore import SIGNAL, SLOT
 from PyQt4.QtGui import QDialog, QIcon
 from qubesmanager.releasenotes import ReleaseNotesDialog
+from qubesmanager.informationnotes import InformationNotesDialog
+from qubesmanager.networknotes import NetworkNotesDialog
 
 from ui_about import *
 
@@ -42,8 +44,22 @@ class AboutDialog(Ui_AboutDialog, QDialog):
         self.connect(self.ok, SIGNAL("clicked()"), SLOT("accept()"))
         self.connect(self.releaseNotes, SIGNAL("clicked()"),
                      self.on_release_notes_clicked)
+        self.connect(self.informationNotes, SIGNAL("clicked()"),
+                     self.on_information_notes_clicked)
+        self.connect(self.networkNotes, SIGNAL("clicked()"),
+                     self.on_network_notes_clicked)
 
     def on_release_notes_clicked(self):
         release_notes_dialog = ReleaseNotesDialog()
         release_notes_dialog.exec_()
         self.accept()
+
+    def on_information_notes_clicked(self):
+        information_notes_dialog = InformationNotesDialog()
+        information_notes_dialog.exec_()
+        self.accept()
+
+    def on_network_notes_clicked(self):
+        network_notes_dialog = NetworkNotesDialog()
+        network_notes_dialog.exec_()
+        self.accept()

+ 37 - 0
qubesmanager/informationnotes.py

@@ -0,0 +1,37 @@
+#!/usr/bin/python2
+# coding=utf-8
+#
+# The Qubes OS Project, http://www.qubes-os.org
+#
+# Copyright (C) 2015  Marek Marczykowski-Górecki
+#                              <marmarek@invisiblethingslab.com>
+#
+# 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.
+#
+#
+from PyQt4.QtCore import SIGNAL
+from PyQt4.QtGui import QDialog, QIcon
+
+from ui_informationnotes import *
+import subprocess
+
+
+class InformationNotesDialog(Ui_InformationNotesDialog, QDialog):
+    def __init__(self):
+        super(InformationNotesDialog, self).__init__()
+
+        self.setupUi(self)
+        details = subprocess.check_output(['/usr/libexec/qubes-manager/qvm_about.sh'])
+        self.informationNotes.setText(details)

+ 37 - 0
qubesmanager/networknotes.py

@@ -0,0 +1,37 @@
+#!/usr/bin/python2
+# coding=utf-8
+#
+# The Qubes OS Project, http://www.qubes-os.org
+#
+# Copyright (C) 2015  Marek Marczykowski-Górecki
+#                              <marmarek@invisiblethingslab.com>
+#
+# 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.
+#
+#
+from PyQt4.QtCore import SIGNAL
+from PyQt4.QtGui import QDialog, QIcon
+
+from ui_networknotes import *
+import subprocess
+
+
+class NetworkNotesDialog(Ui_NetworkNotesDialog, QDialog):
+    def __init__(self):
+        super(NetworkNotesDialog, self).__init__()
+
+        self.setupUi(self)
+        details = subprocess.check_output(['/usr/libexec/qubes-manager/qvm_net.py'])
+        self.networkNotes.setText(details)

+ 11 - 0
qubesmanager/qvm_about.sh

@@ -0,0 +1,11 @@
+#!/usr/bin/sh
+xl info|grep xen_version
+uname -sr
+echo "  "
+echo "Installed Packages:  "
+echo "  "
+dnf list installed |awk '$1~/qubes/ && $1!~/@qubes*/ { printf "%-50s\t%s \n",$1 ,$2}'
+
+
+
+

+ 39 - 0
qubesmanager/qvm_net.py

@@ -0,0 +1,39 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+"""
+Show network tree
+
+@author: unman
+"""
+
+from qubes.qubes import QubesVmCollection
+qvm_collection = QubesVmCollection()
+qvm_collection.lock_db_for_reading()
+qvm_collection.load()
+qvm_collection.unlock_db()
+qvm_collection.pop(0)
+
+def tree(netvm, padding):
+    names={}
+    padding = padding + '      '
+    connected = netvm.connected_vms
+    for i in connected:
+        names[i] = connected[i].name
+    for name in sorted(names.values()):
+        vm = qvm_collection.get_qid_by_name(name)
+        if qvm_collection[vm].is_running():
+            vm_name  = qvm_collection[vm].name + '* '
+        else:
+            vm_name  = qvm_collection[vm].name
+        if qvm_collection[vm].is_template():
+            print padding,'|->',vm_name,'(Tpl)'
+        else:
+            print padding,'|->',vm_name
+        if qvm_collection[vm].is_netvm() :
+            tree(qvm_collection[vm], padding)         
+          
+padding=''
+for vm in qvm_collection:
+    if qvm_collection[vm].is_netvm() and not qvm_collection[vm].netvm :
+        print qvm_collection[vm].name
+        tree(qvm_collection[vm], padding)

+ 24 - 2
rpm_spec/qmgr.spec

@@ -35,6 +35,10 @@ cp qubes-vm-settings $RPM_BUILD_ROOT/usr/bin
 
 mkdir -p $RPM_BUILD_ROOT/usr/libexec/qubes-manager/
 cp qubesmanager/mount_for_backup.sh $RPM_BUILD_ROOT/usr/libexec/qubes-manager/
+cp qubesmanager/qvm_about.sh $RPM_BUILD_ROOT/usr/libexec/qubes-manager/
+cp qubesmanager/qvm_net.py $RPM_BUILD_ROOT/usr/libexec/qubes-manager/
+cp qubesmanager/qvm_net.pyo $RPM_BUILD_ROOT/usr/libexec/qubes-manager/
+cp qubesmanager/qvm_net.pyc $RPM_BUILD_ROOT/usr/libexec/qubes-manager/
 
 mkdir -p $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager/
 cp qubesmanager/main.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
@@ -52,6 +56,8 @@ 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/about.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
 cp qubesmanager/releasenotes.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
+cp qubesmanager/informationnotes.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
+cp qubesmanager/networknotes.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
 cp qubesmanager/create_new_vm.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
@@ -67,6 +73,8 @@ cp qubesmanager/ui_settingsdlg.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesm
 cp qubesmanager/ui_logdlg.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
 cp qubesmanager/ui_about.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
 cp qubesmanager/ui_releasenotes.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
+cp qubesmanager/ui_informationnotes.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
+cp qubesmanager/ui_networknotes.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubesmanager
 
 mkdir -p $RPM_BUILD_ROOT/usr/share/applications
 cp qubes-manager.desktop $RPM_BUILD_ROOT/usr/share/applications
@@ -91,6 +99,10 @@ rm -rf $RPM_BUILD_ROOT
 /usr/bin/qubes-manager
 /usr/bin/qubes-vm-settings
 /usr/libexec/qubes-manager/mount_for_backup.sh
+/usr/libexec/qubes-manager/qvm_about.sh
+/usr/libexec/qubes-manager/qvm_net.py
+/usr/libexec/qubes-manager/qvm_net.pyo
+/usr/libexec/qubes-manager/qvm_net.pyc
 %dir %{python_sitearch}/qubesmanager
 %{python_sitearch}/qubesmanager/__init__.py
 %{python_sitearch}/qubesmanager/__init__.pyo
@@ -140,6 +152,12 @@ rm -rf $RPM_BUILD_ROOT
 %{python_sitearch}/qubesmanager/releasenotes.py
 %{python_sitearch}/qubesmanager/releasenotes.pyc
 %{python_sitearch}/qubesmanager/releasenotes.pyo
+%{python_sitearch}/qubesmanager/informationnotes.py
+%{python_sitearch}/qubesmanager/informationnotes.pyc
+%{python_sitearch}/qubesmanager/informationnotes.pyo
+%{python_sitearch}/qubesmanager/networknotes.py
+%{python_sitearch}/qubesmanager/networknotes.pyc
+%{python_sitearch}/qubesmanager/networknotes.pyo
 %{python_sitearch}/qubesmanager/create_new_vm.py
 %{python_sitearch}/qubesmanager/create_new_vm.pyc
 %{python_sitearch}/qubesmanager/create_new_vm.pyo
@@ -182,8 +200,12 @@ rm -rf $RPM_BUILD_ROOT
 %{python_sitearch}/qubesmanager/ui_releasenotes.py
 %{python_sitearch}/qubesmanager/ui_releasenotes.pyc
 %{python_sitearch}/qubesmanager/ui_releasenotes.pyo
-
-
+%{python_sitearch}/qubesmanager/ui_informationnotes.py
+%{python_sitearch}/qubesmanager/ui_informationnotes.pyc
+%{python_sitearch}/qubesmanager/ui_informationnotes.pyo
+%{python_sitearch}/qubesmanager/ui_networknotes.py
+%{python_sitearch}/qubesmanager/ui_networknotes.pyc
+%{python_sitearch}/qubesmanager/ui_networknotes.pyo
 /usr/share/applications/qubes-manager.desktop
 /etc/xdg/autostart/qubes-manager.desktop
 /etc/dbus-1/system.d/org.qubesos.QubesManager.conf