Did some sensefull changes in main.py

This commit is contained in:
Johannes Wendel
2019-11-28 23:03:28 +01:00
parent a2e11b0d43
commit 07536fe1c3
2 changed files with 13 additions and 6 deletions

View File

@@ -48,7 +48,7 @@ class Networking:
def getInputEvent(self):
header = ''
while chr(2) not in header:
header += self.input_socket.recv(1)
header += str(self.input_socket.recv(1))
length = int(header[:-1])

View File

@@ -3,7 +3,7 @@ from cursesmenu.items import *
import curses
import argparse as ap
from FlippR_Networking import Networking
import keyboard
import signal
import os
networking = "notset"
@@ -37,10 +37,17 @@ def create_menu():
#win = curses.newwin(20,20,20,20)
menu.show()
#quit = False
#def sigint_handler(quit):
# quit = True
def print_input():
while(not keyboard.is_pressed('q')):
# end_loop_handler = signal.signal(signal.SIGINT, sigint_handler)
while(True):
print(networking.getInputEvent())
# signal.signal(signal.SIGINT, end_loop_handler)
quit = False
def create_lamps_submenu(lamps):
menu = CursesMenu("Output", "Lamps")
@@ -91,10 +98,10 @@ def create_submenu(title, items, fun):
def main():
argparser = ap.ArgumentParser()
global networking
if os.getenv("XDG_RUNTIME_DIR"):
path = os.getenv("XDG_RUNTIME_DIR")
if os.environ["XDG_RUNTIME_DIR"]:
path = os.environ["XDG_RUNTIME_DIR"]
else:
path = "/tmp/"
path = "/tmp"
in_path = path + "/S.flippR_driver.in"
out_path = path + "/S.flippR_driver.out"
print("Input path: " + in_path + " output path " + out_path )