Fixing event threads
This commit is contained in:
parent
67eed1f87d
commit
0c5d179c1c
|
@ -6,8 +6,9 @@ class Builtins:
|
|||
def __init__(self):
|
||||
# NOTE: The format used is list of [type, target, data]
|
||||
# Where data may be any kind of data
|
||||
self._gui_events = []
|
||||
self._fm_events = []
|
||||
self._gui_events = []
|
||||
self._fm_events = []
|
||||
self.monitor_events = True
|
||||
|
||||
# Makeshift fake "events" type system FIFO
|
||||
def _pop_gui_event(self):
|
||||
|
@ -52,5 +53,4 @@ class Builtins:
|
|||
# NOTE: Just reminding myself we can add to builtins two different ways...
|
||||
# __builtins__.update({"event_system": Builtins()})
|
||||
builtins.event_system = Builtins()
|
||||
builtins.monitor_events = True
|
||||
builtins.event_sleep_time = 1
|
||||
|
|
|
@ -28,10 +28,9 @@ class WindowController:
|
|||
|
||||
@threaded
|
||||
def fm_event_observer(self):
|
||||
while monitor_events:
|
||||
while event_system.monitor_events:
|
||||
time.sleep(event_sleep_time)
|
||||
event = event_system.consume_fm_event()
|
||||
print("fm")
|
||||
if event:
|
||||
print(event)
|
||||
|
||||
|
|
|
@ -56,17 +56,16 @@ class Signals(WindowMixin, PaneMixin):
|
|||
|
||||
@threaded
|
||||
def gui_event_observer(self):
|
||||
while monitor_events:
|
||||
while event_system.monitor_events:
|
||||
time.sleep(event_sleep_time)
|
||||
event = event_system.consume_gui_event()
|
||||
print("gui")
|
||||
if event:
|
||||
print(event)
|
||||
|
||||
|
||||
def tear_down(self, widget, eve):
|
||||
monitor_events = False
|
||||
time.sleep(2)
|
||||
event_system.monitor_events = False
|
||||
time.sleep(event_sleep_time)
|
||||
gtk.main_quit()
|
||||
|
||||
def generate_windows(self, data = None):
|
||||
|
|
Loading…
Reference in New Issue