qt: fix test, add debug info
authorNiki Roo <niki@nikiroo.be>
Thu, 27 Mar 2025 19:47:48 +0000 (20:47 +0100)
committerNiki Roo <niki@nikiroo.be>
Thu, 27 Mar 2025 19:47:48 +0000 (20:47 +0100)
gamiki-qt.py
gamiki/qt/tiles.py

index 92f6c2d67ba8ca8b86c77f1fc25b56608589d9b0..55e54673cac014cbcf13fb7ca76718f58a3b7eb5 100755 (executable)
@@ -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
index cc32bed2dc5585ba8d68ef7c7af0633d132e20d2..7b1da99ccffaa08dc3257c03ef00f8c67873ec48 100755 (executable)
@@ -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_())