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