Skip to content

Commit

Permalink
Improved design of Global Settings
Browse files Browse the repository at this point in the history
Transitional form: the functionality is the same, changes are
mostly visual, with only a minor addition of Version no,
release info link and version link.

fixes QubesOS/qubes-issues#6858
  • Loading branch information
marmarta committed Oct 11, 2021
1 parent 239111d commit f27247a
Show file tree
Hide file tree
Showing 6 changed files with 815 additions and 439 deletions.
2 changes: 2 additions & 0 deletions debian/install
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@

/usr/lib/*/dist-packages/qubesmanager/resources_rc.py

/usr/lib/*/dist-packages/qubesmanager/global_settings.css

/usr/lib/*/dist-packages/qubesmanager/ui_backupdlg.py
/usr/lib/*/dist-packages/qubesmanager/ui_bootfromdevice.py
/usr/lib/*/dist-packages/qubesmanager/ui_globalsettingsdlg.py
Expand Down
56 changes: 56 additions & 0 deletions qubesmanager/global_settings.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
QGroupBox {
font-size: 24pt;
font-weight: 400;
border: none;
margin-top: 50px;
margin-right: 30px;
margin-left: 30px;
margin-bottom: 20px;
font-family: 'Montserrat';
}

QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: top left;
padding-left: 31px;
padding-top: 0px;
}

QCheckBox {
padding-left: 5px;
}

QPushButton {
padding: 10px;
margin-left: 30px;
}

QFrame#line, QFrame#line_2, QFrame#line_3 {
margin-left: 40px;
margin-right: 40px;
}

QComboBox {
padding-left: 10px;
padding-right: 10px;
}

QLabel {
margin-right: 20px;
}

QLabel#label_release {
padding-left: 20px;
padding-top: 0px;
margin-top: 0px;
margin-bottom: 0px;
}

QLabel#logo_label {
margin-left: 30px;
}

QCheckBox::indicator {
width: 25px;
height: 25px;
}
44 changes: 41 additions & 3 deletions qubesmanager/global_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@

import os
import subprocess
import pkg_resources
from PyQt5 import QtWidgets, QtCore, QtGui # pylint: disable=import-error

from qubesadmin.utils import parse_size
from qubesadmin import exc
from qubesmanager.releasenotes import ReleaseNotesDialog
from qubesmanager.informationnotes import InformationNotesDialog

from . import ui_globalsettingsdlg # pylint: disable=no-name-in-module
from . import utils
Expand Down Expand Up @@ -68,7 +71,7 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
def __init__(self, app, qubes_app, parent=None):
super().__init__(parent)

self.app = app
self.app: QtWidgets.QApplication = app
self.qubes_app = qubes_app
self.vm = self.qubes_app.domains[self.qubes_app.local_name]

Expand All @@ -77,6 +80,8 @@ def __init__(self, app, qubes_app, parent=None):
self.buttonBox.accepted.connect(self.save_and_apply)
self.buttonBox.rejected.connect(self.reject)

self.__init_ux()

self.__init_system_defaults__()
self.__init_kernel_defaults__()
self.__init_mem_defaults__()
Expand All @@ -89,6 +94,39 @@ def setup_application(self):
self.app.setApplicationName(self.tr("Qubes Global Settings"))
self.app.setWindowIcon(QtGui.QIcon.fromTheme("qubes-manager"))

def __init_ux(self):
icon = QtGui.QIcon.fromTheme('qubes-manager')
pixmap = icon.pixmap(QtCore.QSize(128, 128))
self.logo_label.setPixmap(pixmap)
self.logo_label.setAttribute(
QtCore.Qt.WidgetAttribute.WA_TranslucentBackground)

self.setStyleSheet(pkg_resources.resource_string(
__name__, 'global_settings.css').decode())

self.label_release.linkActivated.connect(self._link_activated)

for button in self.buttonBox.buttons():
button.setMinimumWidth(250)

req_width = self.scrollAreaWidgetContents_2.sizeHint().width() + 20
avail_width = self.app.desktop().availableGeometry().width() * 0.9

req_height = self.scrollAreaWidgetContents_2.sizeHint().height() + 100
avail_height = self.app.desktop().availableGeometry().height() * 0.9

self.resize(min(req_width, avail_width), min(req_height, avail_height))

def _link_activated(self, link):
if link == "version":
dialog = InformationNotesDialog(self)
elif link == "release":
dialog = ReleaseNotesDialog(self)
else:
return

dialog.exec_()

def setup_widget_with_vms(self, widget, filter_function,
allow_none, holder, property_name):
try:
Expand Down Expand Up @@ -472,7 +510,7 @@ def __enable_updates_all(self):
reply = QtWidgets.QMessageBox.question(
self, self.tr("Change state of all qubes"),
self.tr("Are you sure you want to set all qubes to check "
"for updates?"),
"for updates? This will override current qube settings."),
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.Cancel)
if reply == QtWidgets.QMessageBox.Cancel:
return
Expand All @@ -483,7 +521,7 @@ def __disable_updates_all(self):
reply = QtWidgets.QMessageBox.question(
self, self.tr("Change state of all qubes"),
self.tr("Are you sure you want to set all qubes to not check "
"for updates?"),
"for updates? This will override current qube settings."),
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.Cancel)
if reply == QtWidgets.QMessageBox.Cancel:
return
Expand Down
1 change: 1 addition & 0 deletions rpm_spec/qmgr.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ rm -rf $RPM_BUILD_ROOT

%{python3_sitelib}/qubesmanager/resources_rc.py

%{python3_sitelib}/qubesmanager/global_settings.css
%{python3_sitelib}/qubesmanager/ui_backupdlg.py
%{python3_sitelib}/qubesmanager/ui_bootfromdevice.py
%{python3_sitelib}/qubesmanager/ui_globalsettingsdlg.py
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
url='https://www.qubes-os.org/',
packages=setuptools.find_packages(),
package_data={
'qubesmanager': ['i18n/*']
'qubesmanager': ['i18n/*', '*.css']
},
entry_points={
'console_scripts': [
Expand Down
Loading

0 comments on commit f27247a

Please sign in to comment.