Skip to content

Commit

Permalink
fixed usage_win width, shorten displayed disc id in status window
Browse files Browse the repository at this point in the history
  • Loading branch information
zzarne committed Jun 28, 2020
1 parent 5a42c87 commit 2933828
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
3 changes: 2 additions & 1 deletion jack/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import jack.functions
import jack.globals
import jack.tag
import jack.misc

from jack.globals import *

Expand Down Expand Up @@ -58,7 +59,7 @@ def init():
+ " reorder" * cf['_reorder'] \
+ " read-ahead=" + repr(cf['_read_ahead']) \
+ " keep-wavs" * cf['_keep_wavs'] \
+ " id=" + cd_id[api] \
+ jack.misc.shorten(" id=" + cd_id[api], 12) \
+ (" len=%02i:%02i" % (global_total // jack.globals.CDDA_BLOCKS_PER_SECOND // 60, global_total // jack.globals.CDDA_BLOCKS_PER_SECOND % 60)) \
+ " | press Q to quit"
jack.term.tmod.extra_lines = 2
Expand Down
5 changes: 5 additions & 0 deletions jack/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,8 @@ def loadavg():
return load
except:
return -1

def shorten(s, limit=74, elipsis='…'):
if elipsis:
limit -= len(elipsis)
return s[:limit] + elipsis * (len(s) > limit)
17 changes: 10 additions & 7 deletions jack/t_curses.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@
pad_height = pad_width = None
pad_disp_start_y = pad_disp_start_x = 0

# usage win geometry
# usage win
usage_win_title = "* * * " + jack.version.name + " " + jack.version.version + " " + jack.version.copyright + " * * *"
usage_win_width = len(usage_win_title) + 4
usage_win_xoffset = max(2, (usage_win_width - 49) // 2)
usage_win_height = 7
usage_win_y = usage_win_x = 0
usage_win_height, usage_win_width = 7, 49

# reserve lines for the copyright/help box
splash_reserve = 0
Expand Down Expand Up @@ -186,11 +189,11 @@ def sig_winch_handler(sig, frame):
del usage_win
usage_win = newwin(usage_win_height, usage_win_width, usage_win_y, usage_win_x)
usage_win.box()
usage_win.addstr(1, 2, "* * * " + jack.version.name + " " + jack.version.version + " " + jack.version.copyright + " * * *")
usage_win.addstr(2, 2, "use cursor keys or hjkl to scroll status info")
usage_win.addstr(3, 2, "press P to disable/continue ripping,")
usage_win.addstr(4, 2, " E to pause/continue all encoders or")
usage_win.addstr(5, 2, " R to pause/continue all rippers.")
usage_win.addstr(1, 2, usage_win_title)
usage_win.addstr(2, usage_win_xoffset, "use cursor keys or hjkl to scroll status info")
usage_win.addstr(3, usage_win_xoffset, "press P to disable/continue ripping,")
usage_win.addstr(4, usage_win_xoffset, " E to pause/continue all encoders or")
usage_win.addstr(5, usage_win_xoffset, " R to pause/continue all rippers.")
usage_win.refresh()

for i in jack.ripstuff.all_tracks_todo_sorted:
Expand Down

0 comments on commit 2933828

Please sign in to comment.