Changed the web browser download items to use a transparent background and adapt some colors to the lightness of the palette. eric7

Tue, 28 Dec 2021 17:37:03 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 28 Dec 2021 17:37:03 +0100
branch
eric7
changeset 8872
ee64dbfefd5f
parent 8871
772712033639
child 8873
989b31970862

Changed the web browser download items to use a transparent background and adapt some colors to the lightness of the palette.

eric7/WebBrowser/Download/DownloadItem.py file | annotate | diff | comparison | revisions
--- a/eric7/WebBrowser/Download/DownloadItem.py	Tue Dec 28 17:12:27 2021 +0100
+++ b/eric7/WebBrowser/Download/DownloadItem.py	Tue Dec 28 17:37:03 2021 +0100
@@ -11,13 +11,14 @@
 import os
 
 from PyQt6.QtCore import (
-    pyqtSlot, pyqtSignal, Qt, QTime, QUrl, QStandardPaths, QFileInfo, QDateTime
+    pyqtSlot, pyqtSignal, QTime, QUrl, QStandardPaths, QFileInfo, QDateTime
 )
-from PyQt6.QtGui import QPalette, QDesktopServices
+from PyQt6.QtGui import QDesktopServices
 from PyQt6.QtWidgets import QWidget, QStyle, QDialog
 from PyQt6.QtWebEngineCore import QWebEngineDownloadRequest
 
 from EricWidgets import EricFileDialog
+from EricWidgets.EricApplication import ericApp
 
 from .Ui_DownloadItem import Ui_DownloadItem
 
@@ -64,10 +65,17 @@
         super().__init__(parent)
         self.setupUi(self)
         
-        # TODO: change to use style sheet
-        p = self.infoLabel.palette()
-        p.setColor(QPalette.ColorRole.Text, Qt.GlobalColor.darkGray)
-        self.infoLabel.setPalette(p)
+        self.fileIcon.setStyleSheet("background-color: transparent")
+        self.datetimeLabel.setStyleSheet("background-color: transparent")
+        self.filenameLabel.setStyleSheet("background-color: transparent")
+        if ericApp().usesDarkPalette():
+            self.infoLabel.setStyleSheet(
+                "color: #c0c0c0; background-color: transparent"
+            )      # light gray
+        else:
+            self.infoLabel.setStyleSheet(
+                "color: #808080; background-color: transparent"
+            )      # dark gray
         
         self.progressBar.setMaximum(0)
         

eric ide

mercurial