mirror of
https://github.com/dbarzin/pandora-box.git
synced 2025-07-18 21:09:41 +02:00
code quality
This commit is contained in:
parent
ccf1a9b31c
commit
ed789fb9e8
8 changed files with 37 additions and 44 deletions
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
|
@ -17,7 +17,6 @@ jobs:
|
|||
uses: py-actions/flake8@v2
|
||||
with:
|
||||
ignore: "BLK100"
|
||||
exclude: "tests/*"
|
||||
max-line-length: "128"
|
||||
path: "."
|
||||
plugins: "flake8-bugbear==22.1.11 flake8-black"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import pyudev
|
||||
import psutil
|
||||
import time
|
||||
|
@ -51,9 +50,9 @@ for device in iter(monitor.poll, None):
|
|||
for partition in psutil.disk_partitions():
|
||||
if partition.device == device.device_node:
|
||||
print("Mounted at {}".format(partition.mountpoint))
|
||||
statvfs=os.statvfs(partition.mountpoint)
|
||||
print("size %4.1fGB"% (statvfs.f_frsize * statvfs.f_blocks // 1024 // 1024 / 1024))
|
||||
print("used %4.1fGB"% (statvfs.f_frsize * (statvfs.f_blocks - statvfs.f_bfree) // 1024 // 1024 / 1024))
|
||||
statvfs = os.statvfs(partition.mountpoint)
|
||||
print("size %4.1fGB" % (statvfs.f_frsize * statvfs.f_blocks // 1024 // 1024 / 1024))
|
||||
print("used %4.1fGB" % (statvfs.f_frsize * (statvfs.f_blocks - statvfs.f_bfree) // 1024 // 1024 / 1024))
|
||||
found = True
|
||||
loop += 1
|
||||
else:
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import os
|
||||
import time
|
||||
|
||||
|
@ -11,4 +10,3 @@ os.system("convert -resize 1024x600 -background black -gravity center -extent 10
|
|||
time.sleep(1)
|
||||
os.system("convert -resize 1024x600 -background black -gravity center -extent 1024x600 image2.png bgra:/dev/fb0")
|
||||
time.sleep(1)
|
||||
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
#!/usr/bin/python3
|
||||
import os;
|
||||
import os
|
||||
|
||||
|
||||
def waitMouseClick():
|
||||
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()
|
||||
|
||||
|
||||
while True:
|
||||
os.system("killall fim")
|
||||
os.system("fim -qa image1.png 2>/dev/null &")
|
||||
|
@ -19,4 +21,3 @@ while True:
|
|||
os.system("killall fim")
|
||||
os.system("fim -qa image2.png 2>/dev/null &")
|
||||
waitMouseClick()
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
def waitMouseClick():
|
||||
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()
|
||||
|
||||
waitMouseClick()
|
||||
|
||||
waitMouseClick()
|
||||
|
|
|
@ -15,7 +15,7 @@ def initBar():
|
|||
def updateBar(progress):
|
||||
global progress_win
|
||||
pos = (60 * progress) // 100
|
||||
if pos != 0 :
|
||||
if pos != 0:
|
||||
progress_win.addstr(1, 1, "#" * pos)
|
||||
progress_win.refresh()
|
||||
|
||||
|
@ -26,8 +26,5 @@ while loading <= 100:
|
|||
time.sleep(0.03)
|
||||
updateBar(loading)
|
||||
loading += 3
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
#curses.endwin()
|
||||
curses.flushinp()
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
#!/usr/bin/python3
|
||||
import os;
|
||||
import os
|
||||
|
||||
|
||||
def waitMouseClick():
|
||||
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()
|
||||
|
||||
|
||||
os.system("fim *.png -qa -c 'while(1){display;sleep 1;next;}' </dev/null 2>/dev/null &")
|
||||
waitMouseClick()
|
||||
os.system("killall -s 9 fim")
|
||||
|
|
|
@ -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