mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-29 10:12:38 +02:00
feat: show a deprecation warning for Ubuntu Focal (20.04)
This commit is contained in:
parent
8172195f95
commit
06cbf5afcc
2 changed files with 36 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
import logging
|
||||
import os
|
||||
from pathlib import Path
|
||||
import platform
|
||||
import tempfile
|
||||
import typing
|
||||
|
@ -60,6 +61,11 @@ about updates.</p>
|
|||
HAMBURGER_MENU_SIZE = 30
|
||||
|
||||
|
||||
WARNING_MESSAGE = """<p><b>Warning:</b> You are not receiving security updates because systems with Python 3.8 are no longer supported.
|
||||
Please upgrade to a more recent version of your operating system to use an updated version of Dangerzone. While Dangerzone aims to protect
|
||||
you from malicious documents, using an unsupported version may expose you to known security vulnerabilities.</p>"""
|
||||
|
||||
|
||||
def load_svg_image(filename: str, width: int, height: int) -> QtGui.QPixmap:
|
||||
"""Load an SVG image from a filename.
|
||||
|
||||
|
@ -579,6 +585,17 @@ class ContentWidget(QtWidgets.QWidget):
|
|||
self.dangerzone = dangerzone
|
||||
self.conversion_started = False
|
||||
|
||||
self.warning_label = None
|
||||
if platform.system() == "Linux":
|
||||
# Add the warning message only for ubuntu focal
|
||||
os_release_path = Path("/etc/os-release")
|
||||
if os_release_path.exists():
|
||||
os_release = os_release_path.read_text()
|
||||
if 'Ubuntu 20.04' in os_release or 'focal' in os_release:
|
||||
self.warning_label = QtWidgets.QLabel(WARNING_MESSAGE)
|
||||
self.warning_label.setWordWrap(True)
|
||||
self.warning_label.setProperty("style", "warning")
|
||||
|
||||
# Doc selection widget
|
||||
self.doc_selection_widget = DocSelectionWidget(self.dangerzone)
|
||||
self.doc_selection_widget.documents_selected.connect(self.documents_selected)
|
||||
|
@ -604,6 +621,8 @@ class ContentWidget(QtWidgets.QWidget):
|
|||
|
||||
# Layout
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
if self.warning_label:
|
||||
layout.addWidget(self.warning_label) # Add warning at the top
|
||||
layout.addWidget(self.settings_widget, stretch=1)
|
||||
layout.addWidget(self.documents_list, stretch=1)
|
||||
layout.addWidget(self.doc_selection_wrapper, stretch=1)
|
||||
|
|
|
@ -55,4 +55,20 @@ QTextEdit[style="traceback"] {
|
|||
background-color: #ffffff;
|
||||
color: #000000;
|
||||
padding: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
QLabel[style="warning"] {
|
||||
background-color: #FFF3CD;
|
||||
color: #856404;
|
||||
border: 1px solid #FFEEBA;
|
||||
border-radius: 4px;
|
||||
padding: 10px;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
|
||||
MainWindow[OSColorMode="dark"] QLabel[style="warning"] {
|
||||
background-color: #332D00;
|
||||
color: #FFD970;
|
||||
border-color: #665A00;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue