From: Niki Roo Date: Thu, 27 Mar 2025 19:47:48 +0000 (+0100) Subject: qt: fix test, add debug info X-Git-Url: http://git.nikiroo.be/?a=commitdiff_plain;h=fc8f86f2ba99dc2ea828695f0e4bd7435461b730;p=gamiki.git qt: fix test, add debug info --- diff --git a/gamiki-qt.py b/gamiki-qt.py index 92f6c2d..55e5467 100755 --- a/gamiki-qt.py +++ b/gamiki-qt.py @@ -1,21 +1,24 @@ #!/usr/bin/env python3 -from sys import argv, exit +from sys import argv, stderr, exit try: from PyQt6.QtGui import QIcon from PyQt6.QtCore import * from PyQt6.QtWidgets import * + print("Running on PyQt6", file=stderr) except: try: # apt-get install python3-pyqt5 from PyQt5.QtGui import QIcon from PyQt5.QtCore import * from PyQt5.QtWidgets import * + print("Running on PyQt5", file=stderr) except: from PyQt4.QtGui import QIcon from PyQt4.QtCore import * from PyQt4.QtWidgets import * + print("Running on PyQt4", file=stderr) from gamiki import Builder, Library from gamiki.qt.utils import start diff --git a/gamiki/qt/tiles.py b/gamiki/qt/tiles.py index cc32bed..7b1da99 100755 --- a/gamiki/qt/tiles.py +++ b/gamiki/qt/tiles.py @@ -224,26 +224,20 @@ class Grid(List): if __name__ == '__main__': app = QApplication(argv) - game1 = Game(None, PurePath("")) - game1["Name"] = "Super Sheep" - game1["Icon"] = "./super-sheep.jpg" - game1._init() - game2 = Game(None, PurePath("")) - game2["Name"] = "Super Buba II: le retour de la nouvelle bête" - game2["Icon"] = "./buba.jpg" - game2._init() - game3 = Game(None, PurePath("")) - game3["Name"] = "Fluffy" - game3["Icon"] = "./fluffy.jpg" - game3._init() + game1 = Game(None, PurePath("Super Sheep")) + game1.icon = PurePath("./super-sheep.jpg") + game2 = Game(None, PurePath("Super Buba II: le retour de la nouvelle bête")) + game2.icon = PurePath("./buba.jpg") + game3 = Game(None, PurePath("Fluffy")) + game3.icon = PurePath("./fluffy.jpg") #game_widget1 = ListItem(game1) ; game_widget1.show() #game_widget2 = GridItem(game3) ; game_widget2.show() list1 = List([ game1, game2, game3 ]) ; list1.show() grid = Grid([ game1, game2, game3 ]) ; grid.show() - list1.onClick.connect(lambda game: print("LIST:", game)) - grid.onClick.connect(lambda game: print("GRID:", game)) + list1.onClick.connect(lambda game: print("LIST:", game.name)) + grid.onClick.connect(lambda game: print("GRID:", game.name)) exit(app.exec_())