fixed GTK hanging

This commit is contained in:
Angoosh Leviocki 2025-04-27 21:16:41 +02:00
parent cee41ca595
commit 279814a30e
Signed by: angoosh
GPG Key ID: 2DAE446D291BD8D3
3 changed files with 33 additions and 16 deletions

View File

@ -7,7 +7,7 @@ import requests
import json
gi.require_version('Gtk', '4.0')
from gi.repository import Gtk, Gio, Gdk
from gi.repository import Gtk, Gio, Gdk, GLib
DEBUG = False
@ -17,7 +17,7 @@ else:
index = 1
activeCards = []
TIME = 600
TIME = 60
USB_IF = 0 # Interface
USB_TIMEOUT = 5 # Timeout in ms
@ -66,7 +66,7 @@ class UsbCardReader():
if db[i] == receivedNumber:
if i not in activeCards:
activeCards.append(i)
win.arb(i)
GLib.idle_add(win.arb, i)
else:
print("Card is active now")
except Exception as e: print(e)
@ -119,16 +119,16 @@ class GridRow():
else:
mins, secs = divmod(t, 60)
timer = '{:02d}:{:02d}'.format(mins, secs)
self.runb.set_label(timer)
GLib.idle_add(self.runb.set_label, timer)
time.sleep(1)
t -= 1
if t == 10:
if self.grid.get_name() == "lightgrid":
self.grid.set_name("lredgrid")
GLib.idle_add(self.grid.set_name, "lredgrid")
else:
self.grid.set_name("dredgrid")
GLib.idle_add(self.grid.set_name, "dredgrid")
GridWindow.remRow(self.parent)
GLib.idle_add(GridWindow.remRow, self.parent)
class GridWindow(Gtk.ApplicationWindow):
def __init__(self, **kargs):

View File

@ -1,4 +1,8 @@
{
"1": 3619716179,
"2": 3620062547
}
"1": 1111582085,
"2": 1631957710,
"3": 1112469509,
"4": 1114418469,
"5": 1364550814,
"6": 1632150846
}

View File

@ -1,12 +1,25 @@
{
"1": {
"start": "25/02/2025, 18:06:16",
"end": "25/02/2025, 18:06:31",
"duration": "0:00:14.553644"
"start": "27/04/2025, 16:16:45",
"end": "27/04/2025, 17:23:33",
"duration": "1:06:48.649859"
},
"6": {
"start": "27/04/2025, 16:16:59",
"end": "27/04/2025, 16:39:59",
"duration": "0:23:00.333960"
},
"2": {
"start": "25/02/2025, 18:15:08",
"end": "25/02/2025, 18:15:27",
"duration": "0:00:19.543765"
"start": "27/04/2025, 16:17:02",
"end": "27/04/2025, 17:41:24",
"duration": "1:24:22.075440"
},
"4": {
"start": "27/04/2025, 16:17:06"
},
"3": {
"start": "27/04/2025, 16:17:08",
"end": "27/04/2025, 16:40:36",
"duration": "0:23:28.059768"
}
}