1
0
Fork 0
mirror of synced 2024-06-21 12:00:25 +12:00

DXVK Bugs and refractoring

This commit is contained in:
Dummerle 2021-02-27 15:54:26 +01:00
parent 43e9e76920
commit e04b36498b
9 changed files with 131 additions and 68 deletions

View file

@ -5,3 +5,10 @@ GUI for legendary. An Epic Games Launcher open source alternative
## This is a new version with better Styles. It has not many features, but i work on it.
It will take some time, because I want to reimplement some features on a smoother way.
### TODOS
- Sync Saves
- Game Settings
- Style Sheets
- Updates
- etc

View file

@ -1,29 +0,0 @@
from PyQt5.QtWidgets import QWidget, QPushButton, QVBoxLayout, QLabel
from legendary.core import LegendaryCore
from legendary.models.game import InstalledGame, Game
class GameInfo(QWidget):
igame: InstalledGame
game: Game
def __init__(self, core: LegendaryCore):
super(GameInfo, self).__init__()
self.core = core
self.app_name = ""
self.layout = QVBoxLayout()
self.back_button = QPushButton("Back")
self.layout.addWidget(self.back_button)
# TODO More Information: Image text settings needs_verification platform
self.game_title = QLabel("Error")
self.layout.addWidget(self.game_title)
self.setLayout(self.layout)
def update_game(self, app_name):
self.game = self.core.get_game(app_name)
self.igame = self.core.get_installed_game(app_name)
self.game_title.setText(self.game.app_title)

View file

@ -0,0 +1,71 @@
import os
from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QWidget, QPushButton, QVBoxLayout, QLabel, QHBoxLayout, QTabWidget
from legendary.core import LegendaryCore
from legendary.models.game import InstalledGame, Game
from Rare.utils.QtExtensions import SideTabBar
from Rare.utils.utils import IMAGE_DIR
class InfoTabs(QTabWidget):
def __init__(self, core):
super(InfoTabs, self).__init__()
self.setTabBar(SideTabBar())
self.setTabPosition(QTabWidget.West)
self.info = GameInfo(core)
self.addTab(self.info, "Game Info")
self.addTab(QLabel("Coming soon"), "Cloud Saves")
self.addTab(QLabel("Coming soon"), "Settings")
class GameInfo(QWidget):
igame: InstalledGame
game: Game
def __init__(self, core: LegendaryCore):
super(GameInfo, self).__init__()
self.core = core
self.app_name = ""
self.layout = QVBoxLayout()
self.back_button = QPushButton("Back")
self.layout.addWidget(self.back_button)
# TODO More Information: Image text settings needs_verification platform
top_layout = QHBoxLayout()
self.image = QLabel()
top_layout.addWidget(self.image)
right_layout = QVBoxLayout()
self.game_title = QLabel("Error")
right_layout.addWidget(self.game_title)
top_layout.addLayout(right_layout)
self.layout.addLayout(top_layout)
self.layout.addStretch()
self.setLayout(self.layout)
def update_game(self, app_name):
self.game = self.core.get_game(app_name)
self.igame = self.core.get_installed_game(app_name)
self.game_title.setText(f"<h2>{self.game.app_title}</h2>")
if os.path.exists(f"{IMAGE_DIR}/{self.game.app_name}/FinalArt.png"):
pixmap = QPixmap(f"{IMAGE_DIR}/{self.game.app_name}/FinalArt.png")
elif os.path.exists(f"{IMAGE_DIR}/{self.game.app_name}/DieselGameBoxTall.png"):
pixmap = QPixmap(f"{IMAGE_DIR}/{self.game.app_name}/DieselGameBoxTall.png")
elif os.path.exists(f"{IMAGE_DIR}/{self.game.app_name}/DieselGameBoxLogo.png"):
pixmap = QPixmap(f"{IMAGE_DIR}/{self.game.app_name}/DieselGameBoxLogo.png")
else:
# logger.warning(f"No Image found: {self.game.title}")
pixmap = None
if pixmap:
w = 200
pixmap = pixmap.scaled(w, int(w * 4 / 3))
self.image.setPixmap(pixmap)

View file

@ -1,7 +1,7 @@
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QCheckBox, QLineEdit, QLabel, QPushButton, QStyle, \
QStackedLayout
from Rare.Components.Tabs.Games.GameInfo import GameInfo
from Rare.Components.Tabs.Games.GameInfo.GameInfo import InfoTabs
from Rare.Components.Tabs.Games.GameList import GameList
@ -12,13 +12,13 @@ class GameTab(QWidget):
self.default_widget = Games(core)
self.default_widget.game_list.show_game_info.connect(self.show_info)
self.layout.addWidget(self.default_widget)
self.game_info = GameInfo(core)
self.game_info.back_button.clicked.connect(lambda: self.layout.setCurrentIndex(0))
self.game_info = InfoTabs(core)
self.game_info.info.back_button.clicked.connect(lambda: self.layout.setCurrentIndex(0))
self.layout.addWidget(self.game_info)
self.setLayout(self.layout)
def show_info(self, app_name):
self.game_info.update_game(app_name)
self.game_info.info.update_game(app_name)
self.layout.setCurrentIndex(1)

View file

@ -1,7 +1,11 @@
from logging import getLogger
from PyQt5.QtCore import pyqtSignal
from PyQt5.QtWidgets import QWidget, QCheckBox, QVBoxLayout, QWidgetAction, QMenu, QToolButton, QHBoxLayout, QLabel
from legendary.core import LegendaryCore
logger = getLogger("DXVK Settings")
class DxvkWidget(QWidget):
dxvk_settings = {"fps": (False, "Fps"),
@ -89,14 +93,13 @@ class DxvkMoreSettingsWidget(QWidget):
self.setLayout(self.layout)
def change(self, signal: tuple):
print(self.settings)
tag, checked = signal
y = list(self.settings[tag])
y[0] = checked
self.settings[tag] = tuple(y)
# print(self.settings)
sett = []
print(self.settings)
logger.debug(self.settings)
for i in self.settings:
check, _ = self.settings[i]
if check:

View file

@ -7,13 +7,14 @@ from Rare.Components.Tabs.Settings.About import About
from Rare.Components.Tabs.Settings.Legendary import LegendarySettings
from Rare.Components.Tabs.Settings.Linux import LinuxSettings
from Rare.Components.Tabs.Settings.Rare import RareSettings
from Rare.utils.QtExtensions import SideTabBar
class SettingsTab(QTabWidget):
def __init__(self, core):
super(SettingsTab, self).__init__()
self.core = core
self.setTabBar(TabBar())
self.setTabBar(SideTabBar())
self.setTabPosition(QTabWidget.West)
self.addTab(RareSettings(), "Rare")
self.addTab(LegendarySettings(core), "Legendary")
@ -21,34 +22,3 @@ class SettingsTab(QTabWidget):
self.addTab(LinuxSettings(core), "Linux")
self.addTab(About(), "About")
class TabBar(QTabBar):
def __init__(self):
super(TabBar, self).__init__()
self.setObjectName("settings_bar")
def tabSizeHint(self, index):
# width = QTabBar.tabSizeHint(self, index).width()
return QSize(200, 30)
def paintEvent(self, event):
painter = QStylePainter(self)
opt = QStyleOptionTab()
for i in range(self.count()):
self.initStyleOption(opt, i)
painter.drawControl(QStyle.CE_TabBarTabShape, opt)
painter.save()
s = opt.rect.size()
s.transpose()
r = QRect(QPoint(), s)
r.moveCenter(opt.rect.center())
opt.rect = r
c = self.tabRect(i).center()
painter.translate(c)
painter.rotate(90)
painter.translate(-c)
painter.drawControl(QStyle.CE_TabBarTabLabel, opt);
painter.restore()

View file

@ -83,3 +83,12 @@ QTabBar::tab:hover#settings_bar {
QTabBar::tab::selected#settings_bar {
background-color: darkslategrey;
}
/*
QScrollBar:vertical{
border: 1px solid white;
}
QScrollBar::handle:vertical{
background-color: gray;
border-radius: 4px;
}
*/

View file

@ -2,7 +2,7 @@ import os
from PyQt5.QtCore import Qt, QRect, QSize, QPoint, pyqtSignal
from PyQt5.QtWidgets import QLayout, QStyle, QSizePolicy, QLabel, QFileDialog, QHBoxLayout, QWidget, QLineEdit, \
QPushButton
QPushButton, QStyleOptionTab, QStylePainter, QTabBar
class FlowLayout(QLayout):
@ -145,3 +145,35 @@ class PathEdit(QWidget):
if dlg.exec_():
names = dlg.selectedFiles()
self.text_edit.setText(names[0])
class SideTabBar(QTabBar):
def __init__(self):
super(SideTabBar, self).__init__()
self.setObjectName("settings_bar")
def tabSizeHint(self, index):
# width = QTabBar.tabSizeHint(self, index).width()
return QSize(200, 30)
def paintEvent(self, event):
painter = QStylePainter(self)
opt = QStyleOptionTab()
for i in range(self.count()):
self.initStyleOption(opt, i)
painter.drawControl(QStyle.CE_TabBarTabShape, opt)
painter.save()
s = opt.rect.size()
s.transpose()
r = QRect(QPoint(), s)
r.moveCenter(opt.rect.center())
opt.rect = r
c = self.tabRect(i).center()
painter.translate(c)
painter.rotate(90)
painter.translate(-c)
painter.drawControl(QStyle.CE_TabBarTabLabel, opt);
painter.restore()