Did some sensefull changes in main.py
This commit is contained in:
@@ -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])
|
||||
|
||||
|
||||
17
cli/main.py
17
cli/main.py
@@ -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"
|
||||
@@ -38,9 +38,16 @@ 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 )
|
||||
|
||||
Reference in New Issue
Block a user