From 01fa56af0330c38d9015124d9032a66b3a230eb3 Mon Sep 17 00:00:00 2001 From: cuissedemouche Date: Thu, 15 Dec 2022 12:04:09 +0000 Subject: [PATCH] Dark theme Apply a dark theme directly in QT Designer --- QT/main_window_dark.ui | 106 +++++++++++++++++++++++ QT/ui_main_window.py | 189 ++++++++++++++++++++++++++++++++++++++++- main_window.py | 5 +- ui_main_window.py | 26 ++++-- 4 files changed, 316 insertions(+), 10 deletions(-) create mode 100644 QT/main_window_dark.ui diff --git a/QT/main_window_dark.ui b/QT/main_window_dark.ui new file mode 100644 index 0000000..0628604 --- /dev/null +++ b/QT/main_window_dark.ui @@ -0,0 +1,106 @@ + + + MainWindow + + + + 0 + 0 + 1214 + 896 + + + + Form + + + background-color: rgb(42, 42, 42); +font: 12pt "UbuntuMono NF"; +selection-background-color: rgb(105, 105, 105); +color: rgb(230, 230, 230); + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + background-color: rgb(48, 98, 148); +background-color: rgb(105, 105, 105); + + + QFrame::Plain + + + Qt::Horizontal + + + 4 + + + + + 4 + + + + + background-color: rgb(42, 42, 42); + + + Search + + + false + + + + + + + background-color: rgb(42, 42, 42); + + + QFrame::NoFrame + + + + + + + + background-color: rgb(42, 42, 42); + + + QFrame::NoFrame + + + false + + + QPlainTextEdit::NoWrap + + + true + + + + + + + + + diff --git a/QT/ui_main_window.py b/QT/ui_main_window.py index d1687e7..15ae0a8 100644 --- a/QT/ui_main_window.py +++ b/QT/ui_main_window.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- ################################################################################ -## Form generated from reading UI file 'main_window.ui' +## Form generated from reading UI file 'main_window_dark.ui' ## ## Created by: Qt User Interface Compiler version 6.4.1 ## @@ -24,10 +24,14 @@ class Ui_MainWindow(object): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(1214, 896) + MainWindow.setStyleSheet(u"background-color: rgb(255, 255, 255);\n" +"color: rgb(230, 230, 230);\n" +"selection-background-color: rgb(48, 98, 148);") self.verticalLayout_2 = QVBoxLayout(MainWindow) self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.splitter = QSplitter(MainWindow) self.splitter.setObjectName(u"splitter") + self.splitter.setStyleSheet(u"background-color: rgb(42, 42, 42);") self.splitter.setOrientation(Qt.Horizontal) self.layoutWidget = QWidget(self.splitter) self.layoutWidget.setObjectName(u"layoutWidget") @@ -40,7 +44,11 @@ class Ui_MainWindow(object): self.verticalLayout.addWidget(self.lineEdit) self.tracks_list_widget = QListWidget(self.layoutWidget) + QListWidgetItem(self.tracks_list_widget) + QListWidgetItem(self.tracks_list_widget) + QListWidgetItem(self.tracks_list_widget) self.tracks_list_widget.setObjectName(u"tracks_list_widget") + self.tracks_list_widget.setStyleSheet(u"") self.verticalLayout.addWidget(self.tracks_list_widget) @@ -63,6 +71,183 @@ class Ui_MainWindow(object): def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"Form", None)) self.lineEdit.setText(QCoreApplication.translate("MainWindow", u"Search", None)) - self.detail_plain_text_edit.setPlainText("") + + __sortingEnabled = self.tracks_list_widget.isSortingEnabled() + self.tracks_list_widget.setSortingEnabled(False) + ___qlistwidgetitem = self.tracks_list_widget.item(0) + ___qlistwidgetitem.setText(QCoreApplication.translate("MainWindow", u"New Item", None)); + ___qlistwidgetitem1 = self.tracks_list_widget.item(1) + ___qlistwidgetitem1.setText(QCoreApplication.translate("MainWindow", u"New Item", None)); + ___qlistwidgetitem2 = self.tracks_list_widget.item(2) + ___qlistwidgetitem2.setText(QCoreApplication.translate("MainWindow", u"New Item", None)); + self.tracks_list_widget.setSortingEnabled(__sortingEnabled) + + self.detail_plain_text_edit.setPlainText(QCoreApplication.translate("MainWindow", u"G: Matroska, 290 MiB, 23 min 23 s, 1 731 kb/s\n" +"\n" +"V: HEVC, Main 10@L5@Main, 177 MiB (61%), 1920x1080, 23.976 FPS, 1 063 kb/s\n" +"\n" +"A: Japanese, AAC, 44.7 MiB (15%), 265 kb/s, 6 channels, 48.0 kHz\n" +"A: English, AAC, 44.5 MiB (15%), 265 kb/s, 6 channels, 48.0 kHz\n" +"A: French, E-AC-3, 21.4 MiB (7%), 128 kb/s, 2 channels, 48.0 kHz\n" +"\n" +"T: English, VobSub\n" +"T: French, UTF-8\n" +"T: French, UTF-8\n" +"T: Japanese, UTF-8\n" +"\n" +"M: Menu\n" +"\n" +"\n" +"General\n" +"Unique ID : 256812827210083628067876738400357443254 (0xC13459F58667D428AA76F1CF44EBE6B6)\n" +"Complete name : /home/cuissedemouche/TEMP/samurai.mkv\n" +"Format : Matroska\n" +"Format version : Version 4\n" +"File size : 290 MiB\n" +"Duration : 23 min 23 s\n" +"Overall bit rate : 1 731 kb/s\n" +"Encoded date : UTC 2022-11" + "-24 12:43:22\n" +"Writing application : mkvmerge v72.0.0 ('Minuano (Six-eight)') 64-bit\n" +"Writing library : libebml v1.4.4 + libmatroska v1.7.1\n" +"\n" +"Video\n" +"ID : 1\n" +"Format : HEVC\n" +"Format/Info : High Efficiency Video Coding\n" +"Format profile : Main 10@L5@Main\n" +"Codec ID : V_MPEGH/ISO/HEVC\n" +"Duration : 23 min 20 s\n" +"Bit rate : 1 063 kb/s\n" +"Width : 1 920 pixels\n" +"Height : 1 080 pixels\n" +"Display aspect ratio : 16:9\n" +"Frame rate mode : Constant\n" +"Frame rate : 23.976 (24000/1001) FPS\n" +"Color space : YUV\n" +"Chroma subsampling : 4" + ":2:0\n" +"Bit depth : 10 bits\n" +"Bits/(Pixel*Frame) : 0.021\n" +"Stream size : 177 MiB (61%)\n" +"Title : [bonkai77]\n" +"Writing library : x265 2.5+6-d11482e5fedb:[Windows][GCC 6.2.1][64 bit] 10bit\n" +"Encoding settings : cpuid=1173503 / frame-threads=2 / numa-pools=4 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=1920x1080 / interlace=0 / total-frames=33576 / level-idc=0 / high-tier=1 / uhd-bd=0 / ref=6 / no-allow-non-conformance / no-repeat-headers / annexb / no-aud / no-hrd / info / hash=0 / no-temporal-layers / open-gop / min-keyint=23 / keyint=250 / bframes=8 / b-adapt=2 / b-pyramid / bframe-bias=0 / rc-lookahead=60 / lookahead-slices=0 / scenecut=40 / no-intra-refresh / ctu=32 / min-cu-size=8 / rect / no-amp / max-tu-size=16 / tu-inter-depth=3 / tu-intra-depth=3 / limit-tu=4 / rdoq-level=2 / dynamic-rd=0.0" + "0 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / no-strong-intra-smoothing / max-merge=4 / limit-refs=3 / limit-modes / me=3 / subme=5 / merange=57 / temporal-mvp / weightp / weightb / no-analyze-src-pics / no-deblock / no-sao / no-sao-non-deblock / rd=5 / no-early-skip / rskip / no-fast-intra / no-tskip-fast / no-cu-lossless / b-intra / rdpenalty=0 / psy-rd=0.80 / psy-rdoq=2.00 / no-rd-refine / analysis-reuse-mode=0 / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=22.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / ipratio=1.40 / pbratio=1.30 / aq-mode=2 / aq-strength=1.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=0 / overscan=0 / videoformat=5 / range=0 / colorprim=2 / transfer=2 / colormatrix=2 / chromaloc=0 / display-window=0 / max-cll=0,0 / min-luma=0 / max-luma=1023 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / opt-qp-pps / opt-ref-list-length-pps / no-multi-pass-" + "opt-rps / scenecut-bias=0.05 / no-opt-cu-delta-qp / no-aq-motion / no-hdr / no-hdr-opt / no-dhdr10-opt / analysis-reuse-level=5 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=0 / no-limit-sao / ctu-info=0\n" +"Default : Yes\n" +"Forced : No\n" +"\n" +"Audio #1\n" +"ID : 2\n" +"Format : AAC LC\n" +"Format/Info : Advanced Audio Codec Low Complexity\n" +"Codec ID : A_AAC-2\n" +"Duration : 23 min 21 s\n" +"Bit rate : 265 kb/s\n" +"Channel(s) : 6 channels\n" +"Channel layout : C L R Ls Rs LFE\n" +"Sampling rate : 48.0 kHz\n" +"Frame rate : 46.875 FPS (1024 SPF)\n" +"Compression mode : Lossy\n" +"Delay relative to video " + " : 9 ms\n" +"Stream size : 44.7 MiB (15%)\n" +"Title : Japanese\n" +"Language : Japanese\n" +"Default : Yes\n" +"Forced : No\n" +"\n" +"Audio #2\n" +"ID : 3\n" +"Format : AAC LC\n" +"Format/Info : Advanced Audio Codec Low Complexity\n" +"Codec ID : A_AAC-2\n" +"Duration : 23 min 21 s\n" +"Bit rate : 265 kb/s\n" +"Channel(s) : 6 channels\n" +"Channel layout : C L R Ls Rs LFE\n" +"Sampling rate : 48.0 kHz\n" +"Frame rate : 46.875 FPS (1024 SPF)\n" +"Compression mode : Lossy\n" +"Delay relative to video : 9 ms\n" +"" + "Stream size : 44.5 MiB (15%)\n" +"Title : English\n" +"Language : English\n" +"Default : No\n" +"Forced : No\n" +"\n" +"Audio #3\n" +"ID : 5\n" +"Format : E-AC-3\n" +"Format/Info : Enhanced AC-3\n" +"Commercial name : Dolby Digital Plus\n" +"Codec ID : A_EAC3\n" +"Duration : 23 min 23 s\n" +"Bit rate mode : Constant\n" +"Bit rate : 128 kb/s\n" +"Channel(s) : 2 channels\n" +"Channel layout : L R\n" +"Sampling rate : 48.0 kHz\n" +"Frame rate : 31.250 FPS (1536 SPF)\n" +"Compression mode : Los" + "sy\n" +"Stream size : 21.4 MiB (7%)\n" +"Title : French\n" +"Language : French\n" +"Service kind : Complete Main\n" +"Default : Yes\n" +"Forced : No\n" +"\n" +"Text #1\n" +"ID : 4\n" +"Format : VobSub\n" +"Muxing mode : zlib\n" +"Codec ID : S_VOBSUB\n" +"Codec ID/Info : Picture based subtitle format used on DVDs\n" +"Duration : 21 min 31 s\n" +"Bit rate : 10.1 kb/s\n" +"Frame rate : 0.233 FPS\n" +"Count of elements : 301\n" +"Stream size : 1.55 MiB (1%)\n" +"Title : English Full\n" +"Language " + " : English\n" +"Default : No\n" +"Forced : No\n" +"\n" +"Text #2\n" +"ID : 6\n" +"Format : UTF-8\n" +"Codec ID : S_TEXT/UTF8\n" +"Codec ID/Info : UTF-8 Plain Text\n" +"Duration : 20 min 3 s\n" +"Bit rate : 1 b/s\n" +"Frame rate : 0.006 FPS\n" +"Count of elements : 7\n" +"Stream size : 187 Bytes (0%)\n" +"Title : French Forced\n" +"Language : French\n" +"Default : Yes\n" +"Forced : Yes\n" +"\n" +"Text #3\n" +"ID : 7\n" +"Format : UTF-8\n" +"Codec ID " + " : S_TEXT/UTF8\n" +"Codec ID/Info : UTF-8 Plain Text\n" +"Duration : 19 min 52 s\n" +"Bit rate : 53 b/s\n" +"Frame rate : 0.249 FPS\n" +"Count of elements : 297\n" +"Stream size : 7.72 KiB (0%)\n" +"Title : French Full\n" +"Language : French\n" +"Default : Yes\n" +"Forced : No\n" +"\n" +"Text #4", None)) # retranslateUi diff --git a/main_window.py b/main_window.py index a6b95c2..12beb7c 100644 --- a/main_window.py +++ b/main_window.py @@ -14,9 +14,8 @@ class MainWindow(QWidget, Ui_MainWindow): self.setAcceptDrops(True) self.setupConnections() - font = "UbuntuMono NF" - self.tracks_list_widget.setFont(QFont(font, 12)) - self.detail_plain_text_edit.setFont(QFont(font, 12)) + self.splitter.setStretchFactor(0, False) + self.splitter.setStretchFactor(1, True) def setupConnections(self): diff --git a/ui_main_window.py b/ui_main_window.py index d1687e7..773dac4 100644 --- a/ui_main_window.py +++ b/ui_main_window.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- ################################################################################ -## Form generated from reading UI file 'main_window.ui' +## Form generated from reading UI file 'main_window_dark.ui' ## ## Created by: Qt User Interface Compiler version 6.4.1 ## @@ -15,38 +15,55 @@ from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont, QFontDatabase, QGradient, QIcon, QImage, QKeySequence, QLinearGradient, QPainter, QPalette, QPixmap, QRadialGradient, QTransform) -from PySide6.QtWidgets import (QApplication, QLineEdit, QListWidget, QListWidgetItem, - QPlainTextEdit, QSizePolicy, QSplitter, QVBoxLayout, - QWidget) +from PySide6.QtWidgets import (QApplication, QFrame, QLineEdit, QListWidget, + QListWidgetItem, QPlainTextEdit, QSizePolicy, QSplitter, + QVBoxLayout, QWidget) class Ui_MainWindow(object): def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(1214, 896) + MainWindow.setStyleSheet(u"background-color: rgb(42, 42, 42);\n" +"font: 12pt \"UbuntuMono NF\";\n" +"selection-background-color: rgb(105, 105, 105);\n" +"color: rgb(230, 230, 230);") self.verticalLayout_2 = QVBoxLayout(MainWindow) + self.verticalLayout_2.setSpacing(0) self.verticalLayout_2.setObjectName(u"verticalLayout_2") + self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) self.splitter = QSplitter(MainWindow) self.splitter.setObjectName(u"splitter") + self.splitter.setStyleSheet(u"background-color: rgb(48, 98, 148);\n" +"background-color: rgb(105, 105, 105);") + self.splitter.setFrameShadow(QFrame.Plain) self.splitter.setOrientation(Qt.Horizontal) + self.splitter.setHandleWidth(4) self.layoutWidget = QWidget(self.splitter) self.layoutWidget.setObjectName(u"layoutWidget") self.verticalLayout = QVBoxLayout(self.layoutWidget) + self.verticalLayout.setSpacing(4) self.verticalLayout.setObjectName(u"verticalLayout") self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.lineEdit = QLineEdit(self.layoutWidget) self.lineEdit.setObjectName(u"lineEdit") + self.lineEdit.setStyleSheet(u"background-color: rgb(42, 42, 42);") + self.lineEdit.setFrame(False) self.verticalLayout.addWidget(self.lineEdit) self.tracks_list_widget = QListWidget(self.layoutWidget) self.tracks_list_widget.setObjectName(u"tracks_list_widget") + self.tracks_list_widget.setStyleSheet(u"background-color: rgb(42, 42, 42);") + self.tracks_list_widget.setFrameShape(QFrame.NoFrame) self.verticalLayout.addWidget(self.tracks_list_widget) self.splitter.addWidget(self.layoutWidget) self.detail_plain_text_edit = QPlainTextEdit(self.splitter) self.detail_plain_text_edit.setObjectName(u"detail_plain_text_edit") + self.detail_plain_text_edit.setStyleSheet(u"background-color: rgb(42, 42, 42);") + self.detail_plain_text_edit.setFrameShape(QFrame.NoFrame) self.detail_plain_text_edit.setUndoRedoEnabled(False) self.detail_plain_text_edit.setLineWrapMode(QPlainTextEdit.NoWrap) self.detail_plain_text_edit.setReadOnly(True) @@ -63,6 +80,5 @@ class Ui_MainWindow(object): def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"Form", None)) self.lineEdit.setText(QCoreApplication.translate("MainWindow", u"Search", None)) - self.detail_plain_text_edit.setPlainText("") # retranslateUi