mirror of
https://github.com/dbarzin/pandora-box.git
synced 2025-07-25 00:09:40 +02:00
code quality
This commit is contained in:
parent
ccf1a9b31c
commit
ed789fb9e8
8 changed files with 37 additions and 44 deletions
|
@ -1,20 +1,20 @@
|
|||
#!/usr/bin/python3
|
||||
#
|
||||
|
||||
def waitMouseClick():
|
||||
print("wait mouse click")
|
||||
mouse = open( "/dev/input/mice", "rb" )
|
||||
down = False;
|
||||
mouse = open("/dev/input/mice", "rb")
|
||||
down = False
|
||||
while True:
|
||||
buf = mouse.read(3)
|
||||
if ((buf[0] & 0x1)==1):
|
||||
if ((buf[0] & 0x1) == 1):
|
||||
down = True
|
||||
if (((buf[0] & 0x1)==0) and down):
|
||||
break;
|
||||
if (((buf[0] & 0x1) == 0) and down):
|
||||
break
|
||||
mouse.close()
|
||||
|
||||
|
||||
def loop(state):
|
||||
print('loop ' +state)
|
||||
print('loop ' + state)
|
||||
match state:
|
||||
case "START":
|
||||
waitMouseClick()
|
||||
|
@ -26,16 +26,13 @@ def loop(state):
|
|||
waitMouseClick()
|
||||
return "STOP"
|
||||
case _:
|
||||
print("Unknwn state "+state)
|
||||
print("Unknwn state " + state)
|
||||
return "STOP"
|
||||
print("end loop")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# The client code.
|
||||
|
||||
state="START"
|
||||
while (state!="STOP"):
|
||||
state = "START"
|
||||
while (state != "STOP"):
|
||||
state = loop(state)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue