Commit 918563db authored by ADav's avatar ADav

fixed images + alpha options

parent 0f6e8282
...@@ -6,6 +6,7 @@ from time import sleep ...@@ -6,6 +6,7 @@ from time import sleep
from pathlib import Path from pathlib import Path
from typing import AnyStr, Union from typing import AnyStr, Union
import requests
from PySide6 import QtCore from PySide6 import QtCore
from os.path import expanduser from os.path import expanduser
from desktop_parser import DesktopFile from desktop_parser import DesktopFile
...@@ -15,6 +16,7 @@ from ingame.models.GamesModel import Game, GamesModel ...@@ -15,6 +16,7 @@ from ingame.models.GamesModel import Game, GamesModel
from ingame.models.GameAgent import GameAgent from ingame.models.GameAgent import GameAgent
from PySide6.QtCore import Property, Signal, Slot, QObject, Qt from PySide6.QtCore import Property, Signal, Slot, QObject, Qt
from steamgrid import SteamGridDB
class GameShortcut: class GameShortcut:
def __init__(self, filename, product_name, icon): def __init__(self, filename, product_name, icon):
...@@ -57,6 +59,7 @@ class App(QtCore.QObject): ...@@ -57,6 +59,7 @@ class App(QtCore.QObject):
self.setup() self.setup()
def setup(self): def setup(self):
try: try:
with open(self.home + self.config_location, 'r') as file: with open(self.home + self.config_location, 'r') as file:
self.portproton_location = file.read().strip() self.portproton_location = file.read().strip()
...@@ -64,7 +67,6 @@ class App(QtCore.QObject): ...@@ -64,7 +67,6 @@ class App(QtCore.QObject):
self.games_model.clear() self.games_model.clear()
files = glob.glob(f"{self.portproton_location}/*.desktop") files = glob.glob(f"{self.portproton_location}/*.desktop")
for val in files: for val in files:
desktop_file = DesktopFile.from_file(val) desktop_file = DesktopFile.from_file(val)
data = desktop_file.data data = desktop_file.data
...@@ -86,10 +88,10 @@ class App(QtCore.QObject): ...@@ -86,10 +88,10 @@ class App(QtCore.QObject):
continue continue
# TODO parse product name # 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")) or os.path.realpath(f"{Path(__file__).resolve().parent}../../../qml/images/PUBG.png"))
# Автозапуск игры: # Автозапуск игры:
# PW_GUI_DISABLED_CS=1 # PW_GUI_DISABLED_CS=1
# START_FROM_STEAM=1 # START_FROM_STEAM=1
...@@ -168,3 +170,24 @@ class App(QtCore.QObject): ...@@ -168,3 +170,24 @@ class App(QtCore.QObject):
@Property(QObject, constant=True) @Property(QObject, constant=True)
def games(self): def games(self):
return self.games_model 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
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Dialogs
import "../delegates" import "../delegates"
import "../constants/tabs.js" as TabConstants import "../constants/tabs.js" as TabConstants
import "../constants/style.js" as Style import "../constants/style.js" as Style
...@@ -134,15 +135,16 @@ Rectangle { ...@@ -134,15 +135,16 @@ Rectangle {
id: buttonSystemManagement; id: buttonSystemManagement;
text: TabConstants.systemManagementTab; text: TabConstants.systemManagementTab;
width: 400; width: 400;
/*
onClicked: function(){ onClicked: function(){
tabButtons.x = tabButtons.tempX tabButtons.x = tabButtons.tempX
tabButtons.changeButtonActiveTab(this) tabButtons.changeButtonActiveTab(this)
tabButtons.toggle = true tabButtons.toggle = true
tabs.currentTab = TabConstants.systemManagementTab; tabs.currentTab = TabConstants.systemManagementTab;
// tabs.changeTab(); // tabs.changeTab();
// console.log(tabs.urrentTab); console.log(tabs.currentTab);
} }
*/
onReleased: tabButtons.toggle = false onReleased: tabButtons.toggle = false
} }
TopMenuBut.TextButton { TopMenuBut.TextButton {
...@@ -166,20 +168,6 @@ Rectangle { ...@@ -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 { Image {
...@@ -198,47 +186,78 @@ Rectangle { ...@@ -198,47 +186,78 @@ Rectangle {
} }
} }
// Заглушка Системных настроек // Заглушка Системных настроек !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Grid { Grid {
id: systemManagementGrid id: systemManagementGrid
visible: tabs.currentTab == TabConstants.systemManagementTab visible: tabs.currentTab == TabConstants.systemManagementTab
columns: 3 columns: 1
spacing: 2 spacing: 2
anchors.centerIn: parent
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
Layout.topMargin: 190 Layout.topMargin: 190
// anchors.rightMargin: 0
// anchors.leftMargin: 0
// anchors.bottomMargin: 90
anchors.rightMargin: 0 anchors.rightMargin: 0
anchors.leftMargin: 0 anchors.leftMargin: 0
anchors.bottomMargin: 90 anchors.bottomMargin : 90
Rectangle { Row {
color: "red"; Text {
width: 50; font.family: globalFont.font
height: 50; font.weight: 400
} font.styleName: globalFont.font.styleName
Rectangle { font.pointSize: 16
color: "green"; text: "Полный экран при запуске:"
width: 20; color: 'white'
height: 50; opacity: 0.8
} }
Rectangle { CheckBox {
color: "blue"; onCheckedChanged: {
width: 50; if (checked) {
height: 20; window.visibility = Window.FullScreen
} else {
window.visibility = Window.Windowed
}
}
}
} }
Rectangle { Row {
color: "cyan"; Text {
width: 50; font.family: globalFont.font
height: 50; 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 { FileDialog {
color: "magenta"; id: fileDialog
width: 10; title: "Выберите каталог"
height: 10; 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 ...@@ -4,6 +4,8 @@ import QtQuick
// Import all components from folder // Import all components from folder
import "scenes" import "scenes"
import "constants/scene.js" as SceneConstants import "constants/scene.js" as SceneConstants
import "constants/options.js" as SceneOptions
Window { Window {
property string scene: SceneConstants.homeScene property string scene: SceneConstants.homeScene
...@@ -74,6 +76,12 @@ Window { ...@@ -74,6 +76,12 @@ Window {
visible: true visible: true
title: qsTr("Launcher") title: qsTr("Launcher")
Component.onCompleted: {
SceneOptions.readOptions();
if(SceneOptions.fullscreen == 1)
visibility = Window.FullScreen;
}
Image { Image {
id: bg id: bg
anchors.fill: parent anchors.fill: parent
......
...@@ -11,7 +11,6 @@ Rectangle { ...@@ -11,7 +11,6 @@ Rectangle {
color: "#00000000" color: "#00000000"
onVisibleChanged: { onVisibleChanged: {
tabs.visible = container.visible; 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