1
0
Fork 0
mirror of synced 2024-05-04 20:52:58 +12:00

Merge pull request #387 from loathingKernel/next

More styling updates
This commit is contained in:
Stelios Tsampas 2024-02-24 14:03:52 +02:00 committed by GitHub
commit 5b6df91be9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 293 additions and 280 deletions

View file

@ -258,10 +258,12 @@ class InstallDialog(ActionDialog):
def action_handler(self):
self.error_box()
message = self.tr("Updating...")
font = self.font()
font.setItalic(True)
self.ui.download_size_text.setText(message)
self.ui.download_size_text.setStyleSheet("font-style: italic; font-weight: normal")
self.ui.download_size_text.setFont(font)
self.ui.install_size_text.setText(message)
self.ui.install_size_text.setStyleSheet("font-style: italic; font-weight: normal")
self.ui.install_size_text.setFont(font)
self.setActive(True)
self.options_changed = False
self.get_options()
@ -309,15 +311,19 @@ class InstallDialog(ActionDialog):
download_size = download.analysis.dl_size
install_size = download.analysis.install_size
# install_size = self.dl_item.download.analysis.disk_space_delta
bold_font = self.font()
bold_font.setBold(True)
italic_font = self.font()
italic_font.setItalic(True)
if download_size or (not download_size and (download.game.is_dlc or download.repair)):
self.ui.download_size_text.setText(format_size(download_size))
self.ui.download_size_text.setStyleSheet("font-style: normal; font-weight: bold")
self.ui.download_size_text.setFont(bold_font)
self.accept_button.setEnabled(not self.options_changed)
else:
self.ui.install_size_text.setText(self.tr("Game already installed"))
self.ui.install_size_text.setStyleSheet("font-style: italics; font-weight: normal")
self.ui.download_size_text.setText(self.tr("Game already installed"))
self.ui.download_size_text.setFont(italic_font)
self.ui.install_size_text.setText(format_size(install_size))
self.ui.install_size_text.setStyleSheet("font-style: normal; font-weight: bold")
self.ui.install_size_text.setFont(bold_font)
self.action_button.setEnabled(self.options_changed)
has_prereqs = bool(download.igame.prereq_info) and not download.igame.prereq_info.get("installed", False)
if has_prereqs:

View file

@ -61,6 +61,8 @@ class DownloadsTab(QWidget):
queue_contents = QWidget(self.queue_scrollarea)
queue_contents.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self.queue_scrollarea.setWidget(queue_contents)
self.queue_scrollarea.widget().setAutoFillBackground(False)
self.queue_scrollarea.viewport().setAutoFillBackground(False)
queue_contents_layout = QVBoxLayout(queue_contents)
queue_contents_layout.setContentsMargins(0, 0, 3, 0)

View file

@ -59,11 +59,11 @@ class DownloadWidget(ImageWidget):
def paint_image_empty(self, painter: QPainter, a0: QPaintEvent) -> None:
# when pixmap object is not available yet, show a gray rectangle
painter.setOpacity(0.5 * self._opacity)
painter.fillRect(a0.rect(), self.palette().color(QPalette.Background))
painter.fillRect(a0.rect(), self.palette().color(QPalette.Window))
def paint_image_cover(self, painter: QPainter, a0: QPaintEvent) -> None:
painter.setOpacity(self._opacity)
color = self.palette().color(QPalette.Background).darker(75)
color = self.palette().color(QPalette.Window).darker(75)
painter.fillRect(self.rect(), color)
brush = QBrush(self._pixmap)
brush.setTransform(self._transform)

View file

@ -99,7 +99,7 @@ class ListGameWidget(GameWidget):
def paint_image_cover(self, painter: QPainter, a0: QPaintEvent) -> None:
painter.setOpacity(self._opacity)
color = self.palette().color(QPalette.Background).darker(75)
color = self.palette().color(QPalette.Window).darker(75)
painter.fillRect(self.rect(), color)
brush = QBrush(self._pixmap)
brush.setTransform(self._transform)

View file

@ -22,12 +22,14 @@ class SettingsTab(SideTabWidget):
self.settings_index = self.addTab(game_settings, self.tr("Defaults"))
self.about = About(self)
self.about_index = self.addTab(self.about, "About", "About")
title = self.tr("About")
self.about_index = self.addTab(self.about, title, title)
self.about.update_available_ready.connect(
lambda: self.tabBar().setTabText(self.about_index, "About (!)")
)
if self.args.debug:
self.debug_index = self.addTab(DebugSettings(self), "Debug")
title = self.tr("Debug")
self.debug_index = self.addTab(DebugSettings(self), title, title)
self.setCurrentIndex(self.rare_index)

View file

@ -4,8 +4,17 @@ import shutil
from logging import getLogger
from typing import Optional, Tuple, Iterable
from PyQt5.QtCore import pyqtSignal, QSize, Qt, QMimeData, pyqtSlot
from PyQt5.QtGui import QDrag, QDropEvent, QDragEnterEvent, QDragMoveEvent, QFont, QMouseEvent, QShowEvent
from PyQt5.QtCore import pyqtSignal, QSize, Qt, QMimeData, pyqtSlot, QObject, QEvent
from PyQt5.QtGui import (
QDrag,
QDropEvent,
QDragEnterEvent,
QDragMoveEvent,
QFont,
QMouseEvent,
QShowEvent,
QResizeEvent,
)
from PyQt5.QtWidgets import (
QHBoxLayout,
QLabel,
@ -15,7 +24,11 @@ from PyQt5.QtWidgets import (
QWidget,
QScrollArea,
QAction,
QMenu, QStackedWidget, QPushButton, QLineEdit, QVBoxLayout, QComboBox,
QMenu,
QPushButton,
QLineEdit,
QVBoxLayout,
QComboBox,
)
from rare.models.wrapper import Wrapper
@ -172,46 +185,75 @@ class WrapperWidget(QFrame):
drag.exec_(Qt.MoveAction)
class WrapperSettingsScroll(QScrollArea):
def __init__(self, parent=None):
super(WrapperSettingsScroll, self).__init__(parent=parent)
self.setFrameShape(QFrame.StyledPanel)
self.setSizeAdjustPolicy(QScrollArea.AdjustToContents)
self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
self.setWidgetResizable(True)
self.setProperty("no_kinetic_scroll", True)
self.setObjectName(type(self).__name__)
self.horizontalScrollBar().setObjectName(f"{self.objectName()}Bar")
self.verticalScrollBar().setObjectName(f"{self.objectName()}Bar")
def setWidget(self, w):
super().setWidget(w)
w.installEventFilter(self)
def eventFilter(self, a0: QObject, a1: QEvent) -> bool:
if a0 is self.widget() and a1.type() == QEvent.Resize:
self.__resize(a0)
return a0.event(a1)
return False
def __resize(self, e: QResizeEvent):
minh = self.horizontalScrollBar().minimum()
maxh = self.horizontalScrollBar().maximum()
# lk: when the scrollbar is not visible, min and max are 0
if maxh > minh:
height = (
e.size().height()
+ self.rect().height() // 2
- self.contentsRect().height() // 2
+ self.widget().layout().spacing()
+ self.horizontalScrollBar().sizeHint().height()
)
else:
height = e.size().height() + self.rect().height() - self.contentsRect().height()
self.setMaximumHeight(max(height, self.minimumHeight()))
class WrapperSettings(QWidget):
def __init__(self, parent=None):
super(WrapperSettings, self).__init__(parent=parent)
self.widget_stack = QStackedWidget(self)
self.wrapper_scroll = QScrollArea(self.widget_stack)
self.wrapper_scroll.setSizeAdjustPolicy(QScrollArea.AdjustToContents)
self.wrapper_scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.wrapper_scroll.setWidgetResizable(True)
self.wrapper_scroll.setProperty("no_kinetic_scroll", True)
self.wrapper_container = WrapperContainer(parent=self.wrapper_scroll)
self.wrapper_container.orderChanged.connect(self.__on_order_changed)
self.wrapper_scroll.setWidget(self.wrapper_container)
self.no_wrapper_label = QLabel(self.tr("No wrappers defined"), self.widget_stack)
self.widget_stack.addWidget(self.wrapper_scroll)
self.widget_stack.addWidget(self.no_wrapper_label)
self.wrapper_label = QLabel(self.tr("No wrappers defined"), self)
self.wrapper_label.setFrameStyle(QLabel.StyledPanel | QLabel.Plain)
self.wrapper_label.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
self.add_button = QPushButton(self.tr("Add wrapper"), self)
self.add_button.clicked.connect(self.__on_add)
self.wrapper_scroll.horizontalScrollBar().rangeChanged.connect(self.adjust_scrollarea)
self.wrapper_scroll = WrapperSettingsScroll(self)
self.wrapper_scroll.setMinimumHeight(self.add_button.minimumSizeHint().height())
self.wrapper_container = WrapperContainer(self.wrapper_label, self.wrapper_scroll)
self.wrapper_container.orderChanged.connect(self.__on_order_changed)
self.wrapper_scroll.setWidget(self.wrapper_container)
# lk: set object names for the stylesheet
self.setObjectName("WrapperSettings")
self.no_wrapper_label.setObjectName(f"{self.objectName()}Label")
self.wrapper_scroll.setObjectName(f"{self.objectName()}Scroll")
self.wrapper_scroll.horizontalScrollBar().setObjectName(
f"{self.wrapper_scroll.objectName()}Bar")
self.wrapper_scroll.verticalScrollBar().setObjectName(
f"{self.wrapper_scroll.objectName()}Bar")
self.wrapper_label.setObjectName(f"{self.objectName()}Label")
main_layout = QHBoxLayout(self)
main_layout.addWidget(self.widget_stack)
main_layout.addWidget(self.add_button, alignment=Qt.AlignTop)
main_layout.setContentsMargins(0, 0, 0, 0)
main_layout.setAlignment(Qt.AlignTop)
main_layout.addWidget(self.wrapper_scroll, alignment=Qt.AlignTop)
main_layout.addWidget(self.add_button, alignment=Qt.AlignTop)
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self.app_name: str = "default"
self.core = RareCore.instance().core()
@ -223,27 +265,6 @@ class WrapperSettings(QWidget):
self.update_state()
return super().showEvent(a0)
@pyqtSlot(int, int)
def adjust_scrollarea(self, minh: int, maxh: int):
wrapper_widget = self.wrapper_container.findChild(WrapperWidget)
if not wrapper_widget:
return
# lk: when the scrollbar is not visible, min and max are 0
if maxh > minh:
self.wrapper_scroll.setMaximumHeight(
wrapper_widget.sizeHint().height()
+ self.wrapper_scroll.rect().height() // 2
- self.wrapper_scroll.contentsRect().height() // 2
+ self.wrapper_container.layout().spacing()
+ self.wrapper_scroll.horizontalScrollBar().sizeHint().height()
)
else:
self.wrapper_scroll.setMaximumHeight(
wrapper_widget.sizeHint().height()
+ self.wrapper_scroll.rect().height()
- self.wrapper_scroll.contentsRect().height()
)
@pyqtSlot(QWidget, int)
def __on_order_changed(self, widget: WrapperWidget, new_index: int):
wrapper = widget.data()
@ -266,16 +287,12 @@ class WrapperSettings(QWidget):
self.add_user_wrapper(wrapper)
def __add_wrapper(self, wrapper: Wrapper, position: int = -1):
self.widget_stack.setCurrentWidget(self.wrapper_scroll)
self.wrapper_label.setVisible(False)
widget = WrapperWidget(wrapper, self.wrapper_container)
if position < 0:
self.wrapper_container.addWidget(widget)
else:
self.wrapper_container.insertWidget(position, widget)
self.adjust_scrollarea(
self.wrapper_scroll.horizontalScrollBar().minimum(),
self.wrapper_scroll.horizontalScrollBar().maximum(),
)
widget.update_wrapper.connect(self.__update_wrapper)
widget.delete_wrapper.connect(self.__delete_wrapper)
@ -304,7 +321,9 @@ class WrapperSettings(QWidget):
if wrapper.checksum in self.wrappers.get_game_md5sum_list(self.app_name):
QMessageBox.warning(
self, self.tr("Warning"), self.tr("Wrapper <b>{0}</b> is already in the list").format(wrapper.as_str)
self,
self.tr("Warning"),
self.tr("Wrapper <b>{0}</b> is already in the list").format(wrapper.as_str),
)
return
@ -314,7 +333,7 @@ class WrapperSettings(QWidget):
self.tr("Warning"),
self.tr("Wrapper <b>{0}</b> is not in $PATH. Add it anyway?").format(wrapper.executable),
QMessageBox.Yes | QMessageBox.No,
QMessageBox.No
QMessageBox.No,
)
if ans == QMessageBox.No:
return
@ -327,8 +346,7 @@ class WrapperSettings(QWidget):
wrappers.remove(wrapper)
self.wrappers.set_game_wrapper_list(self.app_name, wrappers)
if not wrappers:
self.wrapper_scroll.setMaximumHeight(self.no_wrapper_label.sizeHint().height())
self.widget_stack.setCurrentWidget(self.no_wrapper_label)
self.wrapper_label.setVisible(True)
@pyqtSlot(object, object)
def __update_wrapper(self, old: Wrapper, new: Wrapper):
@ -345,10 +363,7 @@ class WrapperSettings(QWidget):
w.deleteLater()
wrappers = self.wrappers.get_game_wrapper_list(self.app_name)
if not wrappers:
self.wrapper_scroll.setMaximumHeight(self.no_wrapper_label.sizeHint().height())
self.widget_stack.setCurrentWidget(self.no_wrapper_label)
else:
self.widget_stack.setCurrentWidget(self.wrapper_scroll)
self.wrapper_label.setVisible(True)
for wrapper in wrappers:
self.__add_wrapper(wrapper)
@ -357,15 +372,19 @@ class WrapperContainer(QWidget):
# QWidget: moving widget, int: new index
orderChanged: pyqtSignal = pyqtSignal(QWidget, int)
def __init__(self, parent=None):
def __init__(self, label: QLabel, parent=None):
super(WrapperContainer, self).__init__(parent=parent)
self.setAcceptDrops(True)
self.__layout = QHBoxLayout(self)
self.__layout.setContentsMargins(0, 0, 0, 0)
self.__layout.setAlignment(Qt.AlignLeft | Qt.AlignTop)
self.__layout = QHBoxLayout()
self.__drag_widget: Optional[QWidget] = None
main_layout = QHBoxLayout(self)
main_layout.addWidget(label)
main_layout.addLayout(self.__layout)
main_layout.setContentsMargins(0, 0, 0, 0)
main_layout.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
main_layout.setSizeConstraint(QHBoxLayout.SetFixedSize)
# lk: set object names for the stylesheet
self.setObjectName(type(self).__name__)

View file

@ -2,22 +2,22 @@
Active\AlternateBase=#fff7f7f7
Active\Base=#ff333344
Active\BrightText=#ffffffff
Active\Button=#ff3c3f41
Active\Button=#ff272a2e
Active\ButtonText=#ffeeeeee
Active\Dark=#ff9f0910
Active\Highlight=#ff2f4f4f
Active\Dark=#ff232529
Active\Highlight=#ff385e5e
Active\HighlightedText=#ffeeeeee
Active\Light=#ffffffff
Active\Link=#ff0000ff
Active\Light=#ff2c2f33
Active\Link=#ff0000dd
Active\LinkVisited=#ffff00ff
Active\Mid=#ffb80e35
Active\Midlight=#ffca0651
Active\Mid=#ff25272b
Active\Midlight=#ff292c30
Active\PlaceholderText=#80eeeeee
Active\Shadow=#ff767676
Active\Shadow=#ff0b0c0d
Active\Text=#ffeeeeee
Active\ToolTipBase=#ffffffdc
Active\ToolTipText=#ffeeeeee
Active\Window=#ff202225
Active\Window=#ff212226
Active\WindowText=#ffeeeeee
Disabled\ButtonText=#ff808080
Disabled\HighlightedText=#ff808080

Binary file not shown.

View file

@ -77,6 +77,7 @@ QScrollBar {
border-radius: 2px;
padding: 2px;
}
QHeaderView::section,
QTableView QTableCornerButton::section,
QLineEdit,
@ -104,21 +105,16 @@ QComboBox,
QSpinBox,
QDoubleSpinBox,
QProgressBar,
QScrollArea,
QPushButton {
min-height: 1.30em;
}
QLineEdit,
QTextEdit
QTimeEdit,
QDateEdit,
QDateTimeEdit,
QSpinBox,
QDoubleSpinBox,
QProgressBar {
max-height: 1.30em;
min-height: 3.00ex;
/* min-height: 1.30em; */
/* min-height: 18px; */
}
QToolButton {
min-height: 1.10em;
min-height: 3.00ex;
/* min-height: 1.10em; */
/* min-height: 15px; */
}
QFrame[frameShape="0"] {
@ -188,14 +184,19 @@ QComboBox QAbstractItemView {
border-top-width: 1;
image: url(":/stylesheets/ChildOfMetropolis/sort-down.svg");
}
QProgressBar {
padding: 0px;
text-align: center;
}
QProgressBar::chunk {
padding: 0px;
border-width: 0px;
width: 2%;
margin: 0%;
margin: 0px;
background-color: #71DA7E;
}
QScrollBar {
border-radius: 4px;
padding: 1px;
@ -673,7 +674,7 @@ QTabBar#MainTabBar::tab {
margin-right: 3px;
border-top-color: transparent;
border-bottom-color: #5CD3FF;
padding: 5px;
padding: 3px 5px;
}/*
QTabBar#MainTabBar::tab:top:first,
QTabBar#MainTabBar::tab:bottom:first {
@ -749,6 +750,7 @@ QLineEdit#SearchBar {
/* Wrapper settings styling */
QPushButton#WrapperWidgetButton,
QToolButton#WrapperWidgetButton {
padding: 0px;
border-color: #DADDDE;
}
QPushButton#WrapperWidgetButton:disabled,
@ -762,6 +764,7 @@ QScrollArea#WrapperSettingsScroll {
QScrollBar#WrapperSettingsScrollBar {
background-color: #BCBEBF;
}
/*
QLabel#WrapperSettingsLabel {
border-width: 1px;
border-style: solid;
@ -775,3 +778,4 @@ QLabel#WrapperSettingsLabel:disabled {
border-color: rgb( 67, 71, 77);
background-color: rgb( 32, 34, 37);
}
*/

View file

@ -8,7 +8,7 @@ disabled: #43474d rgb( 67, 71, 77) -- disabled font color
normal: #202225 rgb( 32, 34, 37) -- main background color
editable: #272733 rgb( 38, 38, 51) -- background color for reactive/editable widgets (TextEdits, ProgressBars etc)
hover: #222233 rgb( 34, 34, 51) -- background color when hovering over reactive widgets (Buttons, Headers)
selection: #2f4f4f rgb( 47, 79, 79) -- background color for selectable widgets
selection: #274242 rgb( 39, 66, 66) -- background color for selectable widgets
alternate: #282a2e rgb( 40, 42, 46) -- background color for alternating rows in List/Tree/TableViews and for ScrollBars
[Border]
@ -45,7 +45,7 @@ QLabel:disabled {
border-width: 0px;
background-color: transparent;
padding: 0px;
selection-background-color: rgb( 47, 79, 79);
selection-background-color: rgb( 39, 66, 66);
}
QMenu,
@ -77,6 +77,7 @@ QScrollBar {
border-radius: 2px;
padding: 2px;
}
QHeaderView::section,
QTableView QTableCornerButton::section,
QLineEdit,
@ -92,7 +93,7 @@ QProgressBar,
QScrollBar {
border-color: rgb( 47, 79, 79);
background-color: rgb( 38, 38, 51);
selection-background-color: rgb( 47, 79, 79);
selection-background-color: rgb( 39, 66, 66);
}
QLineEdit,
@ -104,24 +105,16 @@ QComboBox,
QSpinBox,
QDoubleSpinBox,
QProgressBar,
QScrollArea,
QPushButton {
min-height: 3.00ex;
/* min-height: 1.30em; */
min-height: 18px;
}
QLineEdit,
QTextEdit
QTimeEdit,
QDateEdit,
QDateTimeEdit,
QSpinBox,
QDoubleSpinBox,
QProgressBar {
/* max-height: 1.30em; */
max-height: 18px;
/* min-height: 18px; */
}
QToolButton {
min-height: 3.00ex;
/* min-height: 1.10em; */
min-height: 15px;
/* min-height: 15px; */
}
QFrame[frameShape="0"] {
@ -141,7 +134,7 @@ QComboBox:!editable:hover {
}
*::item:selected,
QComboBox QAbstractItemView {
selection-background-color: rgb( 47, 79, 79);
selection-background-color: rgb( 39, 66, 66);
}
*::drop-down,
*::drop-down:editable,
@ -191,14 +184,19 @@ QComboBox QAbstractItemView {
border-top-width: 1;
image: url(":/stylesheets/RareStyle/sort-down.svg");
}
QProgressBar {
padding: 0px;
text-align: center;
}
QProgressBar::chunk {
padding: 0px;
border-width: 0px;
width: 2%;
margin: 0%;
background-color: rgb( 47, 79, 79);
margin: 0px;
background-color: rgb( 39, 66, 66);
}
QScrollBar {
border-radius: 4px;
padding: 1px;
@ -303,7 +301,7 @@ QListView::item:selected,
QTreeView::item:selected,
QTableView::item:selected {
border-color: rgb( 72, 61, 139);
background-color: rgb( 47, 79, 79);
background-color: rgb( 39, 66, 66);
}
QPushButton,
@ -766,6 +764,7 @@ QScrollArea#WrapperSettingsScroll {
QScrollBar#WrapperSettingsScrollBar {
background-color: rgb( 40, 42, 46);
}
/*
QLabel#WrapperSettingsLabel {
border-width: 1px;
border-style: solid;
@ -779,3 +778,4 @@ QLabel#WrapperSettingsLabel:disabled {
border-color: rgb( 67, 71, 77);
background-color: rgb( 32, 34, 37);
}
*/

View file

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'rare/ui/components/tabs/downloads/download_widget.ui'
#
# Created by: PyQt5 UI code generator 5.15.8
# Created by: PyQt5 UI code generator 5.15.10
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
@ -14,28 +14,24 @@ from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_DownloadWidget(object):
def setupUi(self, DownloadWidget):
DownloadWidget.setObjectName("DownloadWidget")
DownloadWidget.resize(490, 90)
DownloadWidget.resize(479, 86)
DownloadWidget.setWindowTitle("DownloadWidget")
self.active_download_layout = QtWidgets.QGridLayout(DownloadWidget)
self.active_download_layout.setContentsMargins(0, 0, 0, 0)
self.active_download_layout.setObjectName("active_download_layout")
self.downloaded = QtWidgets.QLabel(DownloadWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
self.dl_name = QtWidgets.QLabel(DownloadWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.downloaded.sizePolicy().hasHeightForWidth())
self.downloaded.setSizePolicy(sizePolicy)
self.downloaded.setText("downloaded")
self.downloaded.setObjectName("downloaded")
self.active_download_layout.addWidget(self.downloaded, 2, 3, 1, 1)
self.dl_speed_label = QtWidgets.QLabel(DownloadWidget)
sizePolicy.setHeightForWidth(self.dl_name.sizePolicy().hasHeightForWidth())
self.dl_name.setSizePolicy(sizePolicy)
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.dl_speed_label.setFont(font)
self.dl_speed_label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.dl_speed_label.setObjectName("dl_speed_label")
self.active_download_layout.addWidget(self.dl_speed_label, 1, 2, 1, 1)
font.setBold(False)
font.setWeight(50)
self.dl_name.setFont(font)
self.dl_name.setText("dl_name")
self.dl_name.setObjectName("dl_name")
self.active_download_layout.addWidget(self.dl_name, 0, 1, 1, 3)
self.dl_name_label = QtWidgets.QLabel(DownloadWidget)
font = QtGui.QFont()
font.setBold(True)
@ -53,15 +49,14 @@ class Ui_DownloadWidget(object):
self.cache_used.setText("cache_used")
self.cache_used.setObjectName("cache_used")
self.active_download_layout.addWidget(self.cache_used, 2, 1, 1, 1)
self.time_left = QtWidgets.QLabel(DownloadWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.time_left.sizePolicy().hasHeightForWidth())
self.time_left.setSizePolicy(sizePolicy)
self.time_left.setText("time_left")
self.time_left.setObjectName("time_left")
self.active_download_layout.addWidget(self.time_left, 1, 1, 1, 1)
self.dl_speed_label = QtWidgets.QLabel(DownloadWidget)
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.dl_speed_label.setFont(font)
self.dl_speed_label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.dl_speed_label.setObjectName("dl_speed_label")
self.active_download_layout.addWidget(self.dl_speed_label, 1, 2, 1, 1)
self.downloaded_label = QtWidgets.QLabel(DownloadWidget)
font = QtGui.QFont()
font.setBold(True)
@ -79,27 +74,6 @@ class Ui_DownloadWidget(object):
self.dl_speed.setText("dl_speed")
self.dl_speed.setObjectName("dl_speed")
self.active_download_layout.addWidget(self.dl_speed, 1, 3, 1, 1)
self.cache_used_label = QtWidgets.QLabel(DownloadWidget)
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.cache_used_label.setFont(font)
self.cache_used_label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.cache_used_label.setObjectName("cache_used_label")
self.active_download_layout.addWidget(self.cache_used_label, 2, 0, 1, 1)
self.dl_name = QtWidgets.QLabel(DownloadWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.dl_name.sizePolicy().hasHeightForWidth())
self.dl_name.setSizePolicy(sizePolicy)
font = QtGui.QFont()
font.setBold(False)
font.setWeight(50)
self.dl_name.setFont(font)
self.dl_name.setText("dl_name")
self.dl_name.setObjectName("dl_name")
self.active_download_layout.addWidget(self.dl_name, 0, 1, 1, 3)
self.time_left_label = QtWidgets.QLabel(DownloadWidget)
font = QtGui.QFont()
font.setBold(True)
@ -108,23 +82,39 @@ class Ui_DownloadWidget(object):
self.time_left_label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.time_left_label.setObjectName("time_left_label")
self.active_download_layout.addWidget(self.time_left_label, 1, 0, 1, 1)
self.kill_button = QtWidgets.QPushButton(DownloadWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
self.downloaded = QtWidgets.QLabel(DownloadWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.kill_button.sizePolicy().hasHeightForWidth())
self.kill_button.setSizePolicy(sizePolicy)
self.kill_button.setObjectName("kill_button")
self.active_download_layout.addWidget(self.kill_button, 3, 4, 1, 1)
sizePolicy.setHeightForWidth(self.downloaded.sizePolicy().hasHeightForWidth())
self.downloaded.setSizePolicy(sizePolicy)
self.downloaded.setText("downloaded")
self.downloaded.setObjectName("downloaded")
self.active_download_layout.addWidget(self.downloaded, 2, 3, 1, 1)
self.time_left = QtWidgets.QLabel(DownloadWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.time_left.sizePolicy().hasHeightForWidth())
self.time_left.setSizePolicy(sizePolicy)
self.time_left.setText("time_left")
self.time_left.setObjectName("time_left")
self.active_download_layout.addWidget(self.time_left, 1, 1, 1, 1)
self.cache_used_label = QtWidgets.QLabel(DownloadWidget)
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.cache_used_label.setFont(font)
self.cache_used_label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.cache_used_label.setObjectName("cache_used_label")
self.active_download_layout.addWidget(self.cache_used_label, 2, 0, 1, 1)
self.progress_bar = QtWidgets.QProgressBar(DownloadWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Maximum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.progress_bar.sizePolicy().hasHeightForWidth())
self.progress_bar.setSizePolicy(sizePolicy)
self.progress_bar.setProperty("value", 0)
self.progress_bar.setObjectName("progress_bar")
self.active_download_layout.addWidget(self.progress_bar, 3, 0, 1, 4)
self.kill_button = QtWidgets.QPushButton(DownloadWidget)
self.kill_button.setObjectName("kill_button")
self.active_download_layout.addWidget(self.kill_button, 3, 4, 1, 1)
self.active_download_layout.setColumnStretch(1, 1)
self.active_download_layout.setColumnStretch(3, 1)
@ -132,11 +122,11 @@ class Ui_DownloadWidget(object):
def retranslateUi(self, DownloadWidget):
_translate = QtCore.QCoreApplication.translate
self.dl_speed_label.setText(_translate("DownloadWidget", "Download speed:"))
self.dl_name_label.setText(_translate("DownloadWidget", "Current download:"))
self.dl_speed_label.setText(_translate("DownloadWidget", "Download speed:"))
self.downloaded_label.setText(_translate("DownloadWidget", "Downloaded:"))
self.cache_used_label.setText(_translate("DownloadWidget", "Cache size:"))
self.time_left_label.setText(_translate("DownloadWidget", "Time left:"))
self.cache_used_label.setText(_translate("DownloadWidget", "Cache size:"))
self.kill_button.setText(_translate("DownloadWidget", "Stop Download"))

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>490</width>
<height>90</height>
<width>479</width>
<height>86</height>
</rect>
</property>
<property name="windowTitle">
@ -26,32 +26,22 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item row="2" column="3">
<widget class="QLabel" name="downloaded">
<item row="0" column="1" colspan="3">
<widget class="QLabel" name="dl_name">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">downloaded</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="dl_speed_label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Download speed:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<string notr="true">dl_name</string>
</property>
</widget>
</item>
@ -84,16 +74,19 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="time_left">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item row="1" column="2">
<widget class="QLabel" name="dl_speed_label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">time_left</string>
<string>Download speed:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
@ -126,41 +119,6 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="cache_used_label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Cache size:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1" colspan="3">
<widget class="QLabel" name="dl_name">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string notr="true">dl_name</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="time_left_label">
<property name="font">
@ -177,32 +135,62 @@
</property>
</widget>
</item>
<item row="3" column="4">
<widget class="QPushButton" name="kill_button">
<item row="2" column="3">
<widget class="QLabel" name="downloaded">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Stop Download</string>
<string notr="true">downloaded</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="time_left">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">time_left</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="cache_used_label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Cache size:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="0" colspan="4">
<widget class="QProgressBar" name="progress_bar">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="3" column="4">
<widget class="QPushButton" name="kill_button">
<property name="text">
<string>Stop Download</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>

View file

@ -25,7 +25,7 @@ class Ui_LegendarySettings(object):
self.install_dir_group.setObjectName("install_dir_group")
self.install_dir_layout = QtWidgets.QVBoxLayout(self.install_dir_group)
self.install_dir_layout.setObjectName("install_dir_layout")
self.left_layout.addWidget(self.install_dir_group, 0, QtCore.Qt.AlignTop)
self.left_layout.addWidget(self.install_dir_group)
self.download_group = QtWidgets.QGroupBox(LegendarySettings)
self.download_group.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.download_group.setObjectName("download_group")
@ -97,7 +97,7 @@ class Ui_LegendarySettings(object):
self.disable_https_check.setText("")
self.disable_https_check.setObjectName("disable_https_check")
self.download_layout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.disable_https_check)
self.left_layout.addWidget(self.download_group, 0, QtCore.Qt.AlignTop)
self.left_layout.addWidget(self.download_group)
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.left_layout.addItem(spacerItem)
self.legendary_layout.addLayout(self.left_layout)
@ -113,7 +113,7 @@ class Ui_LegendarySettings(object):
self.locale_group.setObjectName("locale_group")
self.locale_layout = QtWidgets.QVBoxLayout(self.locale_group)
self.locale_layout.setObjectName("locale_layout")
self.right_layout.addWidget(self.locale_group, 0, QtCore.Qt.AlignTop)
self.right_layout.addWidget(self.locale_group)
self.cleanup_group = QtWidgets.QGroupBox(LegendarySettings)
self.cleanup_group.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.cleanup_group.setObjectName("cleanup_group")

View file

@ -16,7 +16,7 @@
<layout class="QHBoxLayout" name="legendary_layout">
<item>
<layout class="QVBoxLayout" name="left_layout">
<item alignment="Qt::AlignTop">
<item>
<widget class="QGroupBox" name="install_dir_group">
<property name="title">
<string>Default installation folder</string>
@ -27,7 +27,7 @@
<layout class="QVBoxLayout" name="install_dir_layout"/>
</widget>
</item>
<item alignment="Qt::AlignTop">
<item>
<widget class="QGroupBox" name="download_group">
<property name="title">
<string>Download settings</string>
@ -183,7 +183,7 @@
</item>
<item>
<layout class="QVBoxLayout" name="right_layout">
<item alignment="Qt::AlignTop">
<item>
<widget class="QGroupBox" name="locale_group">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">

View file

@ -123,19 +123,19 @@ class ButtonLineEdit(QLineEdit):
self.button.clicked.connect(self.buttonClicked.emit)
self.setPlaceholderText(placeholder_text)
frame_width = self.style().pixelMetric(QStyle.PM_DefaultFrameWidth)
button_size = self.button.sizeHint()
self.setStyleSheet(
f"QLineEdit#{self.objectName()} {{padding-right: {(button_size.width() + frame_width + 1)}px; }}"
)
self.setMinimumSize(
max(self.minimumSizeHint().width(), button_size.width() + frame_width * 2 + 2),
max(
self.minimumSizeHint().height(),
button_size.height() + frame_width * 2 + 2,
),
)
# frame_width = self.style().pixelMetric(QStyle.PM_DefaultFrameWidth)
# button_size = self.button.sizeHint()
#
# self.setStyleSheet(
# f"QLineEdit#{self.objectName()} {{padding-right: {(button_size.width() + frame_width + 1)}px; }}"
# )
# self.setMinimumSize(
# max(self.minimumSizeHint().width(), button_size.width() + frame_width * 2 + 2),
# max(
# self.minimumSizeHint().height(),
# button_size.height() + frame_width * 2 + 2,
# ),
# )
def resizeEvent(self, event):
frame_width = self.style().pixelMetric(QStyle.PM_DefaultFrameWidth)

View file

@ -136,7 +136,7 @@ class ImageWidget(QWidget):
painter.setOpacity(1.0)
painter.setCompositionMode(QPainter.CompositionMode_Source)
overlay, _ = self._generate_rounded_overlay()
painter.fillPath(overlay, self.palette().color(QPalette.Background))
painter.fillPath(overlay, self.palette().color(QPalette.Window))
def paint_overlay_squared(self, painter: QPainter, a0: QPaintEvent) -> None:
painter.setRenderHint(QPainter.Antialiasing, False)

View file

@ -99,17 +99,19 @@ class SideTabContainer(QWidget):
layout.addWidget(self.title)
if not hasattr(widget, "implements_scrollarea") or not widget.implements_scrollarea:
self.scrollarea = QScrollArea(self)
self.scrollarea.setSizeAdjustPolicy(QScrollArea.AdjustToContents)
self.scrollarea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.scrollarea.setFrameStyle(QScrollArea.NoFrame)
self.scrollarea.setMinimumWidth(
widget.sizeHint().width() + self.scrollarea.verticalScrollBar().sizeHint().width()
scrollarea = QScrollArea(self)
scrollarea.setSizeAdjustPolicy(QScrollArea.AdjustToContents)
scrollarea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
scrollarea.setFrameStyle(QScrollArea.NoFrame)
scrollarea.setMinimumWidth(
widget.sizeHint().width() + scrollarea.verticalScrollBar().sizeHint().width()
)
self.scrollarea.setWidgetResizable(True)
scrollarea.setWidgetResizable(True)
widget.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self.scrollarea.setWidget(widget)
layout.addWidget(self.scrollarea)
scrollarea.setWidget(widget)
scrollarea.widget().setAutoFillBackground(False)
scrollarea.viewport().setAutoFillBackground(False)
layout.addWidget(scrollarea)
else:
layout.addWidget(widget)