|
|
|
@ -14,19 +14,23 @@ binding_accept = [ord('l'), ord(' '), ord('\n')]
|
|
|
|
|
binding_back = [ord('h'), ord('q'), curses.KEY_BACKSPACE]
|
|
|
|
|
binding_exit = [ord('Q')]
|
|
|
|
|
|
|
|
|
|
def show_pictures(path):
|
|
|
|
|
files = sorted([str(f) for f in path.iterdir() if f.is_file() and f.suffix.lower() in ['.png', '.jpg', '.jpeg', '.gif']])
|
|
|
|
|
def show_pictures(files):
|
|
|
|
|
files = list(files) # copy list
|
|
|
|
|
files.insert(0, '/usr/bin/imvr')
|
|
|
|
|
subprocess.call(files)
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
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']])
|
|
|
|
|
return show_pictures(files)
|
|
|
|
|
|
|
|
|
|
def show_select(win, path):
|
|
|
|
|
if not path.is_dir():
|
|
|
|
|
raise Exception("'" + str(path) + "' is not a directory!")
|
|
|
|
|
dirs = sorted([d for d in path.iterdir() if d.is_dir()])
|
|
|
|
|
win.clear()
|
|
|
|
|
if len(dirs) <= 0:
|
|
|
|
|
return show_pictures(path)
|
|
|
|
|
return search_pictures(win, path)
|
|
|
|
|
sel = 0
|
|
|
|
|
while True:
|
|
|
|
|
for y, d in enumerate(dirs):
|
|
|
|
|