Remove semophores and add even in kivysignaler
This commit is contained in:
parent
530b81a6ef
commit
425b31da84
|
@ -5,6 +5,8 @@ Kivy State variables are assigned here, they are separated from state.py
|
||||||
=================================
|
=================================
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import threading
|
||||||
|
|
||||||
|
|
||||||
class KivyStateVariables(object):
|
class KivyStateVariables(object):
|
||||||
"""This Class hold all the kivy state variables"""
|
"""This Class hold all the kivy state variables"""
|
||||||
|
@ -34,4 +36,5 @@ class KivyStateVariables(object):
|
||||||
self.in_sent_method = False
|
self.in_sent_method = False
|
||||||
self.in_search_mode = False
|
self.in_search_mode = False
|
||||||
self.imageDir = None
|
self.imageDir = None
|
||||||
self.sqlReady = False # set to true by sqlTread when ready for processing
|
# self.sqlReady = False # set to true by sqlTread when ready for processing
|
||||||
|
self.sql_ready = threading.Event()
|
||||||
|
|
|
@ -257,7 +257,7 @@ class NavigateApp(MDApp):
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""Running the widgets"""
|
"""Running the widgets"""
|
||||||
kivyuisignaler.release()
|
self.kivy_state_obj.sql_ready.set()
|
||||||
super(NavigateApp, self).run()
|
super(NavigateApp, self).run()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -6,13 +6,19 @@ from threading import Thread
|
||||||
import queues
|
import queues
|
||||||
import state
|
import state
|
||||||
from semaphores import kivyuisignaler
|
from semaphores import kivyuisignaler
|
||||||
|
from bitmessagekivy.baseclass.common import kivy_state_variables
|
||||||
|
|
||||||
|
|
||||||
class UIkivySignaler(Thread):
|
class UIkivySignaler(Thread):
|
||||||
"""Kivy ui signaler"""
|
"""Kivy ui signaler"""
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super(UIkivySignaler, self).__init__(*args, **kwargs)
|
||||||
|
self.kivy_state = kivy_state_variables()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
kivyuisignaler.acquire()
|
self.kivy_state.sql_ready.wait()
|
||||||
|
# kivyuisignaler.acquire()
|
||||||
while state.shutdown == 0:
|
while state.shutdown == 0:
|
||||||
try:
|
try:
|
||||||
command, data = queues.UISignalQueue.get()
|
command, data = queues.UISignalQueue.get()
|
||||||
|
|
Reference in New Issue
Block a user