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): def getInputEvent(self):
header = '' header = ''
while chr(2) not in header: while chr(2) not in header:
header += self.input_socket.recv(1) header += str(self.input_socket.recv(1))
length = int(header[:-1]) length = int(header[:-1])

View File

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