fix gui app and main loop in same thread
This commit is contained in:
@@ -32,7 +32,7 @@ class Plotter:
|
|||||||
logfiles = list()
|
logfiles = list()
|
||||||
logfiles += glob.glob("app/static/logdata*.csv")
|
logfiles += glob.glob("app/static/logdata*.csv")
|
||||||
logfiles.append("/tmp/baroness_logdata_fast.csv")
|
logfiles.append("/tmp/baroness_logdata_fast.csv")
|
||||||
print logfiles
|
#print logfiles
|
||||||
if logfiles:
|
if logfiles:
|
||||||
plot_log(logfiles, hours = 4)
|
plot_log(logfiles, hours = 4)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ try:
|
|||||||
except:
|
except:
|
||||||
logging.critical("Need MFRC522 Library to read RFID tags, disable RFID if no reader is present!")
|
logging.critical("Need MFRC522 Library to read RFID tags, disable RFID if no reader is present!")
|
||||||
exit()
|
exit()
|
||||||
import signal
|
#import signal
|
||||||
import thread
|
import thread
|
||||||
import time
|
import time
|
||||||
#from multiprocessing import Process
|
#from multiprocessing import Process
|
||||||
@@ -14,7 +14,7 @@ class RFID:
|
|||||||
def __init__(self, callbackf):
|
def __init__(self, callbackf):
|
||||||
logging.info("RFID Reader initialized!")
|
logging.info("RFID Reader initialized!")
|
||||||
self.reader = MFRC522.MFRC522(spd=500000)
|
self.reader = MFRC522.MFRC522(spd=500000)
|
||||||
signal.signal(signal.SIGINT, self.stop)
|
#signal.signal(signal.SIGINT, self.stop)
|
||||||
self.callback = callbackf
|
self.callback = callbackf
|
||||||
self.loop = True
|
self.loop = True
|
||||||
if 1:
|
if 1:
|
||||||
|
|||||||
16
run.py
16
run.py
@@ -9,12 +9,17 @@ from app import settings
|
|||||||
from app import datalog
|
from app import datalog
|
||||||
from app import plot
|
from app import plot
|
||||||
|
|
||||||
|
def rungui():
|
||||||
|
wxx = wx.App()
|
||||||
|
gui.MainWindow(None)
|
||||||
|
wxx.MainLoop()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
#logging!
|
#logging!
|
||||||
logfile = "baroness.log"
|
logfile = "baroness.log"
|
||||||
#logging.basicConfig(filename=logfile, level=logging.WARNING)
|
logging.basicConfig(filename=logfile, level=logging.WARNING)
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
#logging.basicConfig(level=logging.DEBUG)
|
||||||
logging.info("Baroness started!")
|
logging.info("Baroness started!")
|
||||||
print "Baroness started: logging to ", logfile
|
print "Baroness started: logging to ", logfile
|
||||||
|
|
||||||
@@ -26,9 +31,10 @@ if __name__ == '__main__':
|
|||||||
plotter = plot.Plotter()
|
plotter = plot.Plotter()
|
||||||
|
|
||||||
#start gui
|
#start gui
|
||||||
wx = wx.App()
|
#wx = wx.App()
|
||||||
gui.MainWindow(None)
|
#gui.MainWindow(None)
|
||||||
thread.start_new_thread(wx.MainLoop,())
|
#thread.start_new_thread(wx.MainLoop,())
|
||||||
|
thread.start_new_thread(rungui,())
|
||||||
|
|
||||||
# start flask
|
# start flask
|
||||||
app.secret_key = urandom(24)
|
app.secret_key = urandom(24)
|
||||||
|
|||||||
Reference in New Issue
Block a user