1
0
Fork 0
mirror of synced 2024-09-29 08:51:43 +13:00

style.qss

save login in inapp-browser
This commit is contained in:
Dummerle 2020-11-23 20:01:40 +01:00
parent d4f0fd1dcb
commit 69d3d1668f
6 changed files with 2226 additions and 17 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
/images/
/.idea/
/Rare/__pycache__/
/CountLines.sh

View file

@ -5,7 +5,7 @@ from PyQt5.QtWidgets import QTabWidget, QMainWindow, QWidget, QApplication
from Rare.Dialogs import LoginDialog
from Rare.TabWidgets import Settings, GameListInstalled, BrowserTab, GameListUninstalled, UpdateList
from Rare.utils import legendaryUtils
from Rare.utils import legendaryUtils, RareConfig
from Rare.utils.RareUtils import download_images
logging.basicConfig(
@ -48,7 +48,9 @@ class TabWidget(QTabWidget):
def main():
app = QApplication(sys.argv)
# app.setStyleSheet(open("../style.qss").read())
# print(RareConfig.get_config())
if RareConfig.get_config()["Rare"].get("theme") == "dark":
app.setStyleSheet(open("../style.qss").read())
try:
if legendaryUtils.core.login():
logger.info("Login credentials found")

View file

@ -1,12 +1,12 @@
import os
import os
import signal
from logging import getLogger
from PyQt5.QtCore import QUrl, Qt
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtNetwork import QNetworkCookie
from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEngineProfile, QWebEnginePage
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QScrollArea, QLineEdit, QPushButton, QFormLayout, QGroupBox, \
QComboBox, QHBoxLayout
QComboBox, QHBoxLayout, QTextEdit
from Rare.GameWidget import GameWidget, UninstalledGameWidget
from Rare.utils import legendaryConfig
@ -18,8 +18,33 @@ logger = getLogger("TabWidgets")
class BrowserTab(QWebEngineView):
def __init__(self, parent):
super(BrowserTab, self).__init__(parent=parent)
self.profile = QWebEngineProfile("storage", self)
self.cookie_store = self.profile.cookieStore()
self.cookie_store.cookieAdded.connect(self.on_cookie_added)
self.cookies = []
self.webpage = QWebEnginePage(self.profile, self)
self.setPage(self.webpage)
self.load(QUrl("https://www.epicgames.com/store/"))
self.show()
print(self.cookies)
def createWindow(self, QWebEnginePage_WebWindowType):
return self
def on_cookie_added(self, keks):
for c in self.cookies:
if c.hasSameIdentifier(keks):
return
self.cookies.append(QNetworkCookie(keks))
self.toJson()
def toJson(self):
cookies_list_info = []
for c in self.cookies:
data = {"name": bytearray(c.name()).decode(), "domain": c.domain(), "value": bytearray(c.value()).decode(),
"path": c.path(), "expirationDate": c.expirationDate().toString(Qt.ISODate), "secure": c.isSecure(),
"httponly": c.isHttpOnly()}
cookies_list_info.append(data)
class Settings(QWidget):
@ -90,12 +115,12 @@ class Settings(QWidget):
self.lgd_conf_wine_prefix = QLineEdit(self.config["Legendary"]["wine_prefix"])
self.lgd_conf_wine_exec = QLineEdit(self.config["Legendary"]["wine_executable"])
# self.lgd_conf_env_vars = QTextEdit(str(self.config["default.env"]))
self.lgd_conf_env_vars = QTextEdit(str(self.config["default.env"]))
self.lgd_conf_locale = QLineEdit(self.config["Legendary"]["locale"])
self.form.addRow(QLabel("Default Wineprefix"), self.lgd_conf_wine_prefix)
self.form.addRow(QLabel("Wine executable"), self.lgd_conf_wine_exec)
# self.form.addRow(QLabel("Environment Variables"), self.lgd_conf_env_vars)
self.form.addRow(QLabel("Environment Variables"), self.lgd_conf_env_vars)
self.form.addRow(QLabel("Locale"), self.lgd_conf_locale)
self.form_group_box.setLayout(self.form)
@ -148,6 +173,7 @@ class GameListUninstalled(QScrollArea):
self.filter = QLineEdit()
self.filter.setPlaceholderText("Search game TODO")
# TODO Search Game
self.layout.addWidget(self.filter)
self.widgets = []
@ -199,6 +225,4 @@ class UpdateList(QWidget):
self.layout.addStretch(1)
self.setLayout(self.layout)
def update_game(self):
pass
# TODO
# TODO Remove when finished

View file

@ -1,15 +1,23 @@
import configparser
import os
config_path = os.path.expanduser("~") + "/.config/Rare/"
lgd_config = configparser.ConfigParser()
lgd_config.read(config_path + "config.ini")
config_path = os.path.join(os.path.expanduser("~"), ".config/Rare/")
rare_config = configparser.ConfigParser()
if not os.path.exists(config_path):
rare_config["Rare"] = {
"image_dir": "../",
"theme": "dark"
}
else:
rare_config.read(config_path + "config.ini")
print(rare_config.__dict__)
def get_config() -> {}:
return lgd_config.__dict__["_sections"]
return rare_config.__dict__["_sections"]
def set_config(new_config: {}):
lgd_config.__dict__["_sections"] = new_config
lgd_config.write(open(config_path + "config.ini", "w"))
rare_config.__dict__["_sections"] = new_config
rare_config.write(open(config_path + "config.ini", "w"))

View file

@ -7,7 +7,6 @@ lgd_config.read(config_path + "config.ini")
def get_config() -> {}:
print(lgd_config.__dict__["_sections"])
return lgd_config.__dict__["_sections"]

2175
style.qss Normal file

File diff suppressed because it is too large Load diff