client: Passthrough base_dir to show_select calls

master
Felix Stupp 4 years ago
parent 0af22d5e8e
commit d670b41ff3
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -31,7 +31,7 @@ def search_pictures(win, path):
files = sorted([str(f) for f in path.iterdir() if f.is_file() and f.suffix.lower() in ['.png', '.jpg', '.jpeg', '.gif']]) files = sorted([str(f) for f in path.iterdir() if f.is_file() and f.suffix.lower() in ['.png', '.jpg', '.jpeg', '.gif']])
return show_pictures(files) return show_pictures(files)
def show_select(win, path): def show_select(win, base_dir, path):
if not path.is_dir(): if not path.is_dir():
raise Exception("'" + str(path) + "' is not a directory!") raise Exception("'" + str(path) + "' is not a directory!")
dirs = sorted([d for d in path.iterdir() if d.is_dir()]) dirs = sorted([d for d in path.iterdir() if d.is_dir()])
@ -48,7 +48,7 @@ def show_select(win, path):
elif c in binding_down: elif c in binding_down:
sel = min(len(dirs) - 1, sel + 1) sel = min(len(dirs) - 1, sel + 1)
elif c in binding_accept: elif c in binding_accept:
if not show_select(win, dirs[sel]): if not show_select(win, base_dir, dirs[sel]):
return False return False
win.clear() win.clear()
elif c in binding_back: elif c in binding_back:
@ -58,7 +58,7 @@ def show_select(win, path):
def select_ui(win, args): def select_ui(win, args):
curses.curs_set(0) curses.curs_set(0)
while show_select(win, args.dir) and args.kiosk: while show_select(win, args.dir, args.dir) and args.kiosk:
pass pass
if args.kiosk: if args.kiosk:
subprocess.call(['systemctl', 'poweroff']) subprocess.call(['systemctl', 'poweroff'])

Loading…
Cancel
Save