narnia/common.py
def refresh_windows():
    """ update window widths and refresh them """

    g.tty['curr_h'], g.tty['curr_w'] = list(map(
        int, os.popen('stty size', 'r').read().split()))

    if g.num_downloads < g.tty['curr_h']:
        g.start_idx = 0

    c.widths.name = g.tty['curr_w'] - \
        (c.widths.size + c.widths.status +
         c.widths.progress + c.widths.percent +
         c.widths.seeds_peers + c.widths.speed +
         c.widths.eta)

    g.header.update()

    g.file_status.clear()
    g.file_status.noutrefresh()
    g.file_status = curses.newwin(1, g.tty['curr_w'], g.tty['curr_h'] - 2, 0)

    g.pos_status.clear()
    g.pos_status.noutrefresh()
    g.pos_status = curses.newwin(1, 8, g.tty['curr_h'] - 1, g.tty['curr_w'] - 7)
    add_cstr(0, 0, g.s_pos, g.pos_status)

    g.status.win.clear()
    g.status.win.noutrefresh()
    g.status.update(g.status.data)

    for i in range(g.start_idx, min(g.num_downloads, g.tty['curr_h'] - 3) + g.start_idx):
        g.downloads[i].draw(i - g.start_idx + 1, True)
    curses.doupdate()

    g.timer_ui = (c.refresh_interval * 100) - 1
 update window widths and refresh them 
update window widths and refresh them
update window widths and refresh them
def refresh_windows():
    g.tty['curr_h'], g.tty['curr_w'] = list(map(
        int, os.popen('stty size', 'r').read().split()))
    if g.num_downloads < g.tty['curr_h']:
        g.start_idx = 0
    c.widths.name = g.tty['curr_w'] - \
        (c.widths.size + c.widths.status +
         c.widths.progress + c.widths.percent +
         c.widths.seeds_peers + c.widths.speed +
         c.widths.eta)
    g.header.update()
    g.file_status.clear()
    g.file_status.noutrefresh()
    g.file_status = curses.newwin(1, g.tty['curr_w'], g.tty['curr_h'] - 2, 0)
    g.pos_status.clear()
    g.pos_status.noutrefresh()
    g.pos_status = curses.newwin(1, 8, g.tty['curr_h'] - 1, g.tty['curr_w'] - 7)
    add_cstr(0, 0, g.s_pos, g.pos_status)
    g.status.win.clear()
    g.status.win.noutrefresh()
    g.status.update(g.status.data)
    for i in range(g.start_idx, min(g.num_downloads, g.tty['curr_h'] - 3) + g.start_idx):
        g.downloads[i].draw(i - g.start_idx + 1, True)
    curses.doupdate()
    g.timer_ui = (c.refresh_interval * 100) - 1
def refresh_windows ( ) : g . tty [ 'curr_h' ] , g . tty [ 'curr_w' ] = list ( map ( int , os . popen ( 'stty size' , 'r' ) . read ( ) . split ( ) ) ) if g . num_downloads < g . tty [ 'curr_h' ] : g . start_idx = 0 c . widths . name = g . tty [ 'curr_w' ] - ( c . widths . size + c . widths . status + c . widths . progress + c . widths . percent + c . widths . seeds_peers + c . widths . speed + c . widths . eta ) g . header . update ( ) g . file_status . clear ( ) g . file_status . noutrefresh ( ) g . file_status = curses . newwin ( 1 , g . tty [ 'curr_w' ] , g . tty [ 'curr_h' ] - 2 , 0 ) g . pos_status . clear ( ) g . pos_status . noutrefresh ( ) g . pos_status = curses . newwin ( 1 , 8 , g . tty [ 'curr_h' ] - 1 , g . tty [ 'curr_w' ] - 7 ) add_cstr ( 0 , 0 , g . s_pos , g . pos_status ) g . status . win . clear ( ) g . status . win . noutrefresh ( ) g . status . update ( g . status . data ) for i in range ( g . start_idx , min ( g . num_downloads , g . tty [ 'curr_h' ] - 3 ) + g . start_idx ) : g . downloads [ i ] . draw ( i - g . start_idx + 1 , True ) curses . doupdate ( ) g . timer_ui = ( c . refresh_interval * 100 ) - 1
update window widths and refresh them
update window widths and refresh them
""" update window widths and refresh them """