mirror of
https://github.com/dbarzin/pandora-box.git
synced 2025-08-02 20:35:26 +02:00
work in progress
This commit is contained in:
parent
e5c781ad47
commit
7134251bb3
3 changed files with 100 additions and 18 deletions
|
@ -11,7 +11,7 @@ monitor.filter_by('block')
|
|||
|
||||
autoMount=False
|
||||
|
||||
def printInfo(dev):
|
||||
def printDeviceInfo(dev):
|
||||
print('')
|
||||
print('<BLOCK INFORMATION>')
|
||||
print('Device name: %s' % dev.get('DEVNAME'))
|
||||
|
@ -33,7 +33,7 @@ for device in iter(monitor.poll, None):
|
|||
if 'ID_FS_TYPE' in device:
|
||||
if device.action == 'add':
|
||||
if device.device_node[5:7] == 'sd' and device.get('DEVTYPE')=='partition':
|
||||
#printInfo(device)
|
||||
printDeviceInfo(device)
|
||||
print("New device {}".format(device.device_node))
|
||||
# loop until device is mounted
|
||||
if autoMount:
|
||||
|
|
33
tests/progress-bar.py
Executable file
33
tests/progress-bar.py
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import curses
|
||||
import time
|
||||
|
||||
curses.initscr()
|
||||
|
||||
def initBar():
|
||||
global progress_win
|
||||
progress_win = curses.newwin(3, 62, 3, 10)
|
||||
progress_win.border(0)
|
||||
|
||||
def updateBar(progress):
|
||||
global progress_win
|
||||
rangex = (60 / float(100)) * progress
|
||||
pos = int(rangex)
|
||||
display = '#'
|
||||
if pos != 0:
|
||||
progress_win.addstr(1, pos, "{}".format(display))
|
||||
progress_win.refresh()
|
||||
|
||||
initBar()
|
||||
loading = 0
|
||||
while loading < 100:
|
||||
loading += 1
|
||||
time.sleep(0.03)
|
||||
updateBar(loading)
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
curses.endwin()
|
||||
curses.flushinp()
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue