fixed GTK hanging by Angoosh
This commit is contained in:
parent
fc653ef402
commit
2bfa656855
12
main.py
12
main.py
@ -7,7 +7,7 @@ import json
|
||||
|
||||
gi.require_version('Gtk', '4.0')
|
||||
from queue import Queue
|
||||
from gi.repository import Gtk, Gio, Gdk
|
||||
from gi.repository import Gtk, Gio, Gdk, GLib
|
||||
from requests.adapters import HTTPAdapter, Retry
|
||||
from usbcardreader import UsbCardReader
|
||||
|
||||
@ -86,7 +86,7 @@ def callbackOnCard(card_id):
|
||||
if card_id in db:
|
||||
if card_id not in activeCards:
|
||||
activeCards.append(card_id)
|
||||
win.arb(db[card_id])
|
||||
GLib.idle_add(win.arb, db[card_id])
|
||||
print('Card is active now')
|
||||
else:
|
||||
print('Card is already active')
|
||||
@ -140,16 +140,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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user