Commit a76df063 authored by Georgiy Yankovskiy's avatar Georgiy Yankovskiy

Desktop files list, UI changes

parent b789050f
......@@ -100,6 +100,8 @@ Rectangle {
text: "Games"
onClicked: function(){
tabs.currentTab = TabConstants.gamesTab;
if(app === undefined) return;
app.get_games();
// tabs.changeTab();
// console.log(tabs.currentTab);
}
......
......@@ -5,13 +5,18 @@ from pathlib import Path
from PySide6.QtGui import QGuiApplication
from PySide6.QtQml import QQmlApplicationEngine
from src.models.App import App
# TODO: add VirtualKeyboard
if __name__ == "__main__":
app = QGuiApplication(sys.argv)
engine = QQmlApplicationEngine()
qml_file = Path(__file__).resolve().parent / "../qml/qml.qml"
engine = QQmlApplicationEngine()
engine.load(qml_file)
if not engine.rootObjects():
sys.exit(-1)
appModel = App()
context = engine.rootContext()
context.setContextProperty("app", appModel)
sys.exit(app.exec())
from PySide6 import QtCore
from os.path import expanduser
import glob
from desktop_parser import DesktopFile
class GameShortcut:
def __init__(self, filename, product_name, icon):
self.filename = filename
self.product_name = product_name
self.icon = icon
class App(QtCore.QObject):
def __init__(self):
super().__init__()
self.home = expanduser('~')
self.config_location = '/.config/PortProton.conf'
self.portproton_location = ''
self.setup()
def setup(self):
try:
with open(self.home + self.config_location, 'r') as file:
self.portproton_location = file.read().strip()
print(f'Current PortProton location: {self.portproton_location}')
files = glob.glob(f"{self.portproton_location}/*.desktop")
# for val in files:
# print(val)
# desktop_file = DesktopFile.from_file("path/to/file.desktop")
except FileNotFoundError:
print('File not found')
except Exception:
print('An error occurred')
pass
### SLOTS ###
@QtCore.Slot()
def get_games(self):
pass
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