Commit 918563db authored by ADav's avatar ADav

fixed images + alpha options

parent 0f6e8282
......@@ -6,6 +6,7 @@ from time import sleep
from pathlib import Path
from typing import AnyStr, Union
import requests
from PySide6 import QtCore
from os.path import expanduser
from desktop_parser import DesktopFile
......@@ -15,6 +16,7 @@ from ingame.models.GamesModel import Game, GamesModel
from ingame.models.GameAgent import GameAgent
from PySide6.QtCore import Property, Signal, Slot, QObject, Qt
from steamgrid import SteamGridDB
class GameShortcut:
def __init__(self, filename, product_name, icon):
......@@ -57,6 +59,7 @@ class App(QtCore.QObject):
self.setup()
def setup(self):
try:
with open(self.home + self.config_location, 'r') as file:
self.portproton_location = file.read().strip()
......@@ -64,7 +67,6 @@ class App(QtCore.QObject):
self.games_model.clear()
files = glob.glob(f"{self.portproton_location}/*.desktop")
for val in files:
desktop_file = DesktopFile.from_file(val)
data = desktop_file.data
......@@ -86,10 +88,10 @@ class App(QtCore.QObject):
continue
# TODO parse product name
url_img = find_image(_name)
_icon = (os.path.isfile(_icon) and _icon
_icon = (url_img
or os.path.realpath(f"{Path(__file__).resolve().parent}../../../qml/images/PUBG.png"))
# Автозапуск игры:
# PW_GUI_DISABLED_CS=1
# START_FROM_STEAM=1
......@@ -168,3 +170,24 @@ class App(QtCore.QObject):
@Property(QObject, constant=True)
def games(self):
return self.games_model
def find_image(game_name):
steamgriddb = SteamGridDB('66827eabea66de47d036777ed2be87b2')
save_path = f"{Path(__file__).resolve().parent}/../../qml/images/{game_name}.png"
if os.path.exists(save_path):
print("FOUND!")
return save_path
result = steamgriddb.search_game(game_name)
grids = steamgriddb.get_grids_by_gameid(list([result[0].id]))
for grid in grids:
if grid.height == 900 and grid.width == 600:
url_img = grid.url
response = requests.get(url_img)
print(save_path)
with open(save_path, 'wb') as file:
file.write(response.content)
break
return url_img
\ No newline at end of file
fullscreen:1
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Dialogs
import "../delegates"
import "../constants/tabs.js" as TabConstants
import "../constants/style.js" as Style
......@@ -134,15 +135,16 @@ Rectangle {
id: buttonSystemManagement;
text: TabConstants.systemManagementTab;
width: 400;
/*
onClicked: function(){
tabButtons.x = tabButtons.tempX
tabButtons.changeButtonActiveTab(this)
tabButtons.toggle = true
tabs.currentTab = TabConstants.systemManagementTab;
// tabs.changeTab();
// console.log(tabs.urrentTab);
console.log(tabs.currentTab);
}
*/
onReleased: tabButtons.toggle = false
}
TopMenuBut.TextButton {
......@@ -166,20 +168,6 @@ Rectangle {
}
TopMenuBut.TextButton {
id: testbut2
text: "Test"
//font.pixelSize: 60
//height:Math.ceil(tabs.height/100 * 10)
onClicked: function(){
tabButtons.x = tabButtons.tempX
tabButtons.changeButtonActiveTab(this)
tabButtons.toggle = true
}
onReleased: tabButtons.toggle = false
}
}
Image {
......@@ -198,47 +186,78 @@ Rectangle {
}
}
// Заглушка Системных настроек
// Заглушка Системных настроек !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Grid {
id: systemManagementGrid
visible: tabs.currentTab == TabConstants.systemManagementTab
columns: 3
columns: 1
spacing: 2
anchors.centerIn: parent
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
Layout.topMargin: 190
// anchors.rightMargin: 0
// anchors.leftMargin: 0
// anchors.bottomMargin: 90
anchors.rightMargin: 0
anchors.leftMargin: 0
anchors.bottomMargin: 90
Rectangle {
color: "red";
width: 50;
height: 50;
}
Rectangle {
color: "green";
width: 20;
height: 50;
}
Rectangle {
color: "blue";
width: 50;
height: 20;
anchors.bottomMargin : 90
Row {
Text {
font.family: globalFont.font
font.weight: 400
font.styleName: globalFont.font.styleName
font.pointSize: 16
text: "Полный экран при запуске:"
color: 'white'
opacity: 0.8
}
CheckBox {
onCheckedChanged: {
if (checked) {
window.visibility = Window.FullScreen
} else {
window.visibility = Window.Windowed
}
}
}
}
Rectangle {
color: "cyan";
width: 50;
height: 50;
Row {
Text {
font.family: globalFont.font
font.weight: 400
font.styleName: globalFont.font.styleName
font.pointSize: 16
color: 'white'
opacity: 0.8
text: "Каталог PortProton"
}
TextField {
id: pathTextField
width: 150
readOnly: true
text: "Выберите каталог"
}
Button {
width: 50
text: "Выбрать"
onClicked: fileDialog.open()
}
}
Rectangle {
color: "magenta";
width: 10;
height: 10;
FileDialog {
id: fileDialog
title: "Выберите каталог"
currentFolder: "/"
fileMode: FileDialog.Directory
onAccepted: {
pathTextField.text = fileDialog.currentFolder
}
}
}
......
var fullscreen=0;
function readOptions()
{
// var request = new XMLHttpRequest();
// request.onreadystatechange = function() {
// if (request.readyState === XMLHttpRequest.DONE) {
// if (request.status === 200) {
// var data = request.responseText;
// var match = data.match(/fullscreen=(\d+)/);
// if (match) {
// fullscreen = parseInt(match[1], 10);
// console.log('Value of fullscreen:', fullscreen);
// } else {
// console.log('No fullscreen in the file');
// }
// } else {
// console.error('Error reading options file:', request.statusText);
// }
// }
// };
// request.open('GET', 'options.txt', true);
// request.send();`
}
\ No newline at end of file
......@@ -4,6 +4,8 @@ import QtQuick
// Import all components from folder
import "scenes"
import "constants/scene.js" as SceneConstants
import "constants/options.js" as SceneOptions
Window {
property string scene: SceneConstants.homeScene
......@@ -74,6 +76,12 @@ Window {
visible: true
title: qsTr("Launcher")
Component.onCompleted: {
SceneOptions.readOptions();
if(SceneOptions.fullscreen == 1)
visibility = Window.FullScreen;
}
Image {
id: bg
anchors.fill: parent
......
......@@ -11,7 +11,6 @@ Rectangle {
color: "#00000000"
onVisibleChanged: {
tabs.visible = container.visible;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment