Create custom 'About' dialog, with 'release notes' viewer (#1259)

Fixes QubesOS/qubes-issues#1259
This commit is contained in:
Marek Marczykowski-Górecki 2015-10-01 22:34:49 +02:00
parent 51817dda32
commit b001f26ee1
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
7 changed files with 272 additions and 5 deletions

View File

@ -27,6 +27,8 @@ res:
pyuic4 -o qubesmanager/ui_backupdlg.py backupdlg.ui
pyuic4 -o qubesmanager/ui_globalsettingsdlg.py globalsettingsdlg.ui
pyuic4 -o qubesmanager/ui_logdlg.py logdlg.ui
pyuic4 -o qubesmanager/ui_about.py about.ui
pyuic4 -o qubesmanager/ui_releasenotes.py releasenotes.ui
update-repo-current:
ln -f $(RPMS_DIR)/x86_64/qubes-manager-*$(VERSION)*.rpm ../yum/current-release/current/dom0/rpm/

97
about.ui Normal file
View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutDialog</class>
<widget class="QDialog" name="AboutDialog">
<property name="windowModality">
<enum>Qt::NonModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>197</height>
</rect>
</property>
<property name="windowTitle">
<string>About</string>
</property>
<property name="windowIcon">
<iconset theme="qubes-manager"/>
</property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0">
<item>
<widget class="QLabel" name="icon">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="QubesOS">
<property name="text">
<string>Qubes OS</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="release">
<property name="text">
<string>Qubes OS release</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="releaseNotes">
<property name="text">
<string>Release notes</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="ok">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

49
qubesmanager/about.py Normal file
View File

@ -0,0 +1,49 @@
#!/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, SLOT
from PyQt4.QtGui import QDialog, QIcon
from qubesmanager.releasenotes import ReleaseNotesDialog
from ui_about import *
class AboutDialog(Ui_AboutDialog, QDialog):
def __init__(self):
super(AboutDialog, self).__init__()
self.setupUi(self)
self.icon.setPixmap(QIcon().fromTheme("qubes-manager").pixmap(96))
with open('/etc/qubes-release', 'r') as release_file:
self.release.setText(release_file.read())
self.connect(self.ok, SIGNAL("clicked()"), SLOT("accept()"))
self.connect(self.releaseNotes, SIGNAL("clicked()"),
self.on_release_notes_clicked)
def on_release_notes_clicked(self):
release_notes_dialog = ReleaseNotesDialog()
release_notes_dialog.exec_()
self.accept()

View File

@ -40,6 +40,7 @@ from qubes.qubes import QubesException
from qubes.qubes import system_path
from qubes.qubes import QubesDaemonPidfile
from qubes.qubes import QubesHost
from qubesmanager.about import AboutDialog
import table_widgets
from block import QubesBlockDevicesManager
from table_widgets import VmTypeWidget, VmLabelWidget, VmNameItem, \
@ -1570,11 +1571,8 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
@pyqtSlot(name='on_action_about_qubes_triggered')
def action_about_qubes_triggered(self):
release_file = open('/etc/qubes-release', 'r')
release = release_file.read()
release_file.close()
QMessageBox.about(self, "About...",
"<b>Qubes OS</b><br><br>%s" % release)
about = AboutDialog()
about.exec_()
def createPopupMenu(self):
menu = QMenu()

View File

@ -0,0 +1,38 @@
#!/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_releasenotes import *
class ReleaseNotesDialog(Ui_ReleaseNotesDialog, QDialog):
def __init__(self):
super(ReleaseNotesDialog, self).__init__()
self.setupUi(self)
with open('/usr/share/doc/qubes-release-notes/README.Qubes-Release'
'-Notes', 'r') as release_notes:
self.releaseNotes.setText(release_notes.read())

67
releasenotes.ui Normal file
View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ReleaseNotesDialog</class>
<widget class="QDialog" name="ReleaseNotesDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Qubes Release Notes</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTextBrowser" name="releaseNotes"/>
</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>ReleaseNotesDialog</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>ReleaseNotesDialog</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>

View File

@ -49,6 +49,8 @@ cp qubesmanager/multiselectwidget.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qub
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/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/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
@ -62,6 +64,8 @@ cp qubesmanager/ui_newfwruledlg.py{,c,o} $RPM_BUILD_ROOT%{python_sitearch}/qubes
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_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
mkdir -p $RPM_BUILD_ROOT/usr/share/applications
cp qubes-manager.desktop $RPM_BUILD_ROOT/usr/share/applications
@ -126,6 +130,12 @@ rm -rf $RPM_BUILD_ROOT
%{python_sitearch}/qubesmanager/log_dialog.py
%{python_sitearch}/qubesmanager/log_dialog.pyc
%{python_sitearch}/qubesmanager/log_dialog.pyo
%{python_sitearch}/qubesmanager/about.py
%{python_sitearch}/qubesmanager/about.pyc
%{python_sitearch}/qubesmanager/about.pyo
%{python_sitearch}/qubesmanager/releasenotes.py
%{python_sitearch}/qubesmanager/releasenotes.pyc
%{python_sitearch}/qubesmanager/releasenotes.pyo
%{python_sitearch}/qubesmanager/create_new_vm.py
%{python_sitearch}/qubesmanager/create_new_vm.pyc
%{python_sitearch}/qubesmanager/create_new_vm.pyo
@ -162,6 +172,12 @@ rm -rf $RPM_BUILD_ROOT
%{python_sitearch}/qubesmanager/ui_logdlg.py
%{python_sitearch}/qubesmanager/ui_logdlg.pyc
%{python_sitearch}/qubesmanager/ui_logdlg.pyo
%{python_sitearch}/qubesmanager/ui_about.py
%{python_sitearch}/qubesmanager/ui_about.pyc
%{python_sitearch}/qubesmanager/ui_about.pyo
%{python_sitearch}/qubesmanager/ui_releasenotes.py
%{python_sitearch}/qubesmanager/ui_releasenotes.pyc
%{python_sitearch}/qubesmanager/ui_releasenotes.pyo
/usr/share/applications/qubes-manager.desktop