Added outer panes

This commit is contained in:
2Shirt 2018-07-16 19:40:29 -06:00
parent b5d8a55031
commit ae4f2ac680
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 51 additions and 1 deletions

12
.bin/Scripts/echo-and-hold Executable file
View file

@ -0,0 +1,12 @@
#!/bin/bash
#
## Wizard Kit: "echo" text to screen and "hold" by waiting for user input
function usage {
echo "Usage: $(basename "$0") \"text\""
echo " e.g. $(basename "$0") \"Some text to show\""
}
echo -en "$@" && read -r __dont_care
exit 0

View file

@ -3,6 +3,7 @@
import json
import pathlib
import re
import time
from functions.common import *
from operator import itemgetter
@ -64,7 +65,35 @@ def menu_clone(source_path, dest_path):
# Build outer panes
clear_screen()
#TODO
## Top panes
source_pane = tmux_splitw(
'-bdvl', '2',
'-PF', '#D',
'echo-and-hold "{BLUE}Source{CLEAR}\n{text}"'.format(
text = source['Display Name'],
**COLORS))
tmux_splitw(
'-t', source_pane,
'-dhl', '21',
'echo-and-hold "{BLUE}Started{CLEAR}\n{text}"'.format(
text = time.strftime("%Y-%m-%d %H:%M %Z"),
**COLORS))
tmux_splitw(
'-t', source_pane,
'-dhp', '50',
'echo-and-hold "{BLUE}Destination{CLEAR}\n{text}"'.format(
text = dest['Display Name'],
**COLORS))
## Side pane
tmux_splitw('-dhl', '21', 'echo-and-hold "Status #TODO"')
pause()
run_program(['tmux', 'kill-window'])
def tmux_splitw(*args):
"""Run tmux split-window command and return output as str."""
cmd = ['tmux', 'split-window', *args]
result = run_program(cmd)
return result.stdout.decode().strip()
def menu_ddrescue(*args):
"""Main ddrescue loop/menu."""
@ -190,6 +219,15 @@ def select_device(description='device', provided_path=None,
# Leave alone
break
# Set display name
if dev['Is Image']:
dev['Display Name'] = '{name} {size} ({image_name})'.format(
image_name = dev['Path'][dev['Path'].rfind('/')+1:],
**dev['Details'])
else:
dev['Display Name'] = '{name} {size} {model}'.format(
**dev['Details'])
return dev
def setup_loopback_device(source_path):