<s> """<STR_LIT>""" <EOL> from __future__ import division <EOL> import zipfile <EOL> import os <EOL> from x84 . bbs import getsession , getterminal , echo , getch , syncterm_setfont <EOL> from x84 . bbs import get_ini , DBProxy , Lightbar , LineEditor <EOL> from x84 . bbs import send_modem , recv_modem <EOL> from x84 . default . common import filesize <EOL> DIZ_DB = '<STR_LIT>' <EOL> ROOT = get_ini ( section = '<STR_LIT>' , key = '<STR_LIT:root>' ) or '<STR_LIT>' <EOL> UPLOADS_DIR = os . path . join ( ROOT , '<STR_LIT>' ) <EOL> COLOR_HIGHLIGHT = get_ini ( <EOL> section = '<STR_LIT>' , key = '<STR_LIT>' <EOL> ) or '<STR_LIT>' <EOL> COLOR_BORDER = get_ini ( <EOL> section = '<STR_LIT>' , key = '<STR_LIT>' , <EOL> ) or '<STR_LIT>' <EOL> SYNCTERM_FONT = get_ini ( <EOL> section = '<STR_LIT>' , key = '<STR_LIT>' <EOL> ) or '<STR_LIT>' <EOL> FLAGGED_CHAR = get_ini ( <EOL> section = '<STR_LIT>' , key = '<STR_LIT>' <EOL> ) or u'<STR_LIT:+>' <EOL> COLLY_EXTENSIONS = get_ini ( <EOL> section = '<STR_LIT>' , key = '<STR_LIT>' , split = True <EOL> ) or [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> FLAGGED_DIRNAME = get_ini ( <EOL> section = '<STR_LIT>' , key = '<STR_LIT>' <EOL> ) or u'<STR_LIT>' . format ( os . path . sep ) <EOL> COLLY_DECODING = get_ini ( <EOL> section = '<STR_LIT>' , key = '<STR_LIT>' <EOL> ) or '<STR_LIT>' <EOL> class FileBrowser ( object ) : <EOL> """<STR_LIT>""" <EOL> diz_location = <NUM_LIT:0> <EOL> last_diz_len = <NUM_LIT:0> <EOL> max_diz_width = <NUM_LIT:0> <EOL> max_diz_height = <NUM_LIT:0> <EOL> flagged_files = set ( ) <EOL> diz_extractors = dict ( ) <EOL> browser = FileBrowser ( ) <EOL> def diz_from_dms ( binary , filename ) : <EOL> """<STR_LIT>""" <EOL> import subprocess <EOL> args = ( '<STR_LIT:d>' , filename ) <EOL> proc = subprocess . Popen ( ( binary , ) + args , stdout = subprocess . PIPE , <EOL> stderr = subprocess . PIPE ) <EOL> output , _ = proc . communicate ( ) <EOL> if proc . returncode == <NUM_LIT:0> : <EOL> return output . decode ( '<STR_LIT>' ) <EOL> else : <EOL> return u'<STR_LIT>' <EOL> def diz_from_lha ( binary , filename ) : <EOL> """<STR_LIT>""" <EOL> import subprocess <EOL> import tempfile <EOL> import shutil <EOL> description = u'<STR_LIT>' <EOL> path = tempfile . mkdtemp ( prefix = '<STR_LIT>' ) <EOL> args = ( '<STR_LIT>' . format ( path ) , filename ) <EOL> proc = subprocess . Popen ( ( binary , ) + args , stdout = subprocess . PIPE , <EOL> stderr = subprocess . PIPE ) <EOL> proc . wait ( ) <EOL> dizfilename = os . path . join ( path , '<STR_LIT>' ) <EOL> if proc . returncode == <NUM_LIT:0> and os . path . isfile ( dizfilename ) : <EOL> with open ( dizfilename , '<STR_LIT:rb>' ) as dizfile : <EOL> description = dizfile . read ( ) . decode ( '<STR_LIT>' ) <EOL> try : <EOL> shutil . rmtree ( path ) <EOL> except OSError : <EOL> pass <EOL> return description <EOL> def diz_from_zip ( filename , method = zipfile . ZIP_STORED ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> myzip = zipfile . ZipFile ( filename , compression = method , allowZip64 = True ) <EOL> for cname in ( cname for cname in myzip . namelist ( ) <EOL> if cname . lower ( ) == '<STR_LIT>' ) : <EOL> return myzip . read ( cname ) . decode ( '<STR_LIT>' ) <EOL> return u'<STR_LIT>' <EOL> except zipfile . BadZipfile : <EOL> return u'<STR_LIT>' <EOL> except zipfile . LargeZipFile : <EOL> return u'<STR_LIT>' <EOL> except NotImplementedError : <EOL> return u'<STR_LIT>' <EOL> def get_diz_from_colly ( filepath ) : <EOL> """<STR_LIT>""" <EOL> colly = open ( filepath , '<STR_LIT:r>' ) . read ( ) <EOL> colly_diz_begin = '<STR_LIT>' <EOL> colly_diz_end = '<STR_LIT>' <EOL> pos = colly . find ( colly_diz_begin ) <EOL> if pos > <NUM_LIT:0> : <EOL> colly = colly [ pos + len ( colly_diz_begin ) : ] <EOL> pos = colly . find ( colly_diz_end ) <EOL> if pos > <NUM_LIT:0> : <EOL> return colly [ : pos ] . splitlines ( ) <EOL> return None <EOL> def get_instructions ( term , is_sysop = None ) : <EOL> """<STR_LIT>""" <EOL> return [ <EOL> term . bold_blue_underline ( u'<STR_LIT>' ) , <EOL> u'<STR_LIT:U+0020>' , <EOL> u'<STR_LIT>' <EOL> . format ( term . reverse ( u'<STR_LIT>' ) ) , <EOL> u'<STR_LIT>' <EOL> . format ( term . reverse ( u'<STR_LIT>' ) ) , <EOL> term . reverse ( u'<STR_LIT>' ) , <EOL> u'<STR_LIT>' , <EOL> u'<STR_LIT>' <EOL> . format ( term . reverse ( u'<STR_LIT>' ) ) , <EOL> u'<STR_LIT>' <EOL> . format ( term . reverse ( u'<STR_LIT>' ) ) , <EOL> u'<STR_LIT>' <EOL> . format ( term . reverse ( u'<STR_LIT>' ) ) , <EOL> u'<STR_LIT>' <EOL> . format ( term . reverse ( u'<STR_LIT>' ) ) if is_sysop else u'<STR_LIT>' , <EOL> u'<STR_LIT>' <EOL> . format ( term . reverse ( u'<STR_LIT>' ) ) , <EOL> u'<STR_LIT:U+0020>' , <EOL> u'<STR_LIT>' <EOL> . format ( term . bold ( u'<STR_LIT>' ) ) , <EOL> ] <EOL> def edit_description ( filepath , db_desc ) : <EOL> """<STR_LIT>""" <EOL> from x84 . bbs import gosub <EOL> new_desc = None <EOL> if filepath in db_desc : <EOL> new_desc = u'<STR_LIT:\r\n>' . join ( [ line . decode ( '<STR_LIT>' ) <EOL> for line in db_desc [ filepath ] ] ) <EOL> new_desc = gosub ( '<STR_LIT>' , continue_draft = new_desc ) <EOL> if not new_desc : <EOL> return <EOL> with db_desc : <EOL> db_desc [ filepath ] = new_desc . splitlines ( ) <EOL> def download_files ( term , session , protocol = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> if not len ( browser . flagged_files ) : <EOL> return False <EOL> echo ( term . clear ) <EOL> flagged = browser . flagged_files . copy ( ) <EOL> for fname in flagged : <EOL> _fname = fname [ fname . rfind ( os . path . sep ) + <NUM_LIT:1> : ] . decode ( '<STR_LIT:utf8>' ) <EOL> echo ( term . bold_green ( <EOL> u'<STR_LIT>' <EOL> u'<STR_LIT>' <EOL> . format ( protocol = protocol , _fname = _fname ) ) ) <EOL> echo ( u'<STR_LIT>' ) <EOL> fin = open ( fname , '<STR_LIT:rb>' ) <EOL> if not send_modem ( fin , protocol ) : <EOL> echo ( term . bold_red ( u'<STR_LIT>' ) ) <EOL> else : <EOL> browser . flagged_files . remove ( fname ) <EOL> session . user [ '<STR_LIT>' ] = browser . flagged_files <EOL> echo ( term . bold ( u'<STR_LIT>' ) ) <EOL> term . inkey ( ) <EOL> def upload_files ( term , protocol = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> echo ( term . clear ) <EOL> while True : <EOL> echo ( u'<STR_LIT>' ) <EOL> led = LineEditor ( width = term . width - <NUM_LIT:1> ) <EOL> led . refresh ( ) <EOL> inp = led . read ( ) <EOL> led = None <EOL> if inp : <EOL> for illegal in ( os . path . sep , u'<STR_LIT:..>' , u'<STR_LIT>' , ) : <EOL> if illegal in inp : <EOL> echo ( term . bold_red ( u'<STR_LIT>' ) ) <EOL> term . inkey ( ) <EOL> return <EOL> echo ( term . bold ( <EOL> u'<STR_LIT>' <EOL> . format ( protocol ) ) ) <EOL> upload_filename = os . path . join ( UPLOADS_DIR , inp ) <EOL> try : <EOL> upload = open ( upload_filename , '<STR_LIT:wb>' ) <EOL> except IOError as err : <EOL> echo ( term . bold_red ( '<STR_LIT>' . format ( err = err ) ) ) <EOL> else : <EOL> if not recv_modem ( upload , protocol ) : <EOL> echo ( term . bold_red ( u'<STR_LIT>' ) ) <EOL> os . unlink ( upload_filename ) <EOL> else : <EOL> echo ( term . bold_green ( u'<STR_LIT>' ) ) <EOL> term . inkey ( ) <EOL> else : <EOL> return <EOL> def draw_interface ( term , lightbar ) : <EOL> """<STR_LIT>""" <EOL> lightbar . height = term . height <EOL> lightbar . width = max ( <NUM_LIT:10> , int ( term . width * <NUM_LIT> ) ) <EOL> browser . diz_location = lightbar . width + <NUM_LIT:1> <EOL> browser . max_diz_width = term . width - lightbar . width - <NUM_LIT:2> <EOL> browser . max_diz_height = term . height - <NUM_LIT:4> <EOL> echo ( u'<STR_LIT>' . join ( [ term . clear , <EOL> lightbar . border ( ) , <EOL> lightbar . refresh ( ) ] ) ) <EOL> def clear_diz ( term ) : <EOL> """<STR_LIT>""" <EOL> echo ( term . move ( <NUM_LIT:1> , browser . diz_location ) ) <EOL> for i in range ( browser . last_diz_len + <NUM_LIT:2> ) : <EOL> echo ( u'<STR_LIT>' . join ( ( <EOL> term . move ( i , browser . diz_location ) , term . clear_eol ) ) ) <EOL> def describe_file ( term , diz , directory , filename , isdir = None ) : <EOL> """<STR_LIT>""" <EOL> if isdir or filename == u'<STR_LIT>' . format ( os . path . sep ) : <EOL> description = u'<STR_LIT>' . format ( <EOL> txt_Directory = term . bold ( u'<STR_LIT>' ) , <EOL> filename = filename . decode ( '<STR_LIT:utf8>' ) ) <EOL> else : <EOL> _size = filesize ( os . path . join ( directory , filename ) ) <EOL> _filename = ( filename [ len ( ROOT ) : ] . decode ( '<STR_LIT:utf8>' ) <EOL> if directory == os . path . join ( ROOT , FLAGGED_DIRNAME ) <EOL> else filename . decode ( '<STR_LIT:utf8>' ) ) <EOL> description = ( u'<STR_LIT>' <EOL> . format ( txt_Filename = term . bold ( u'<STR_LIT>' ) , <EOL> filename = _filename , <EOL> txt_Size = term . bold ( u'<STR_LIT>' ) , <EOL> size = _size ) ) <EOL> description = term . wrap ( description , browser . max_diz_width ) <EOL> echo ( u'<STR_LIT>' . join ( ( term . move ( <NUM_LIT:1> , browser . diz_location ) , <EOL> u'<STR_LIT>' . join ( [ '<STR_LIT>' . format ( <EOL> term . move_x ( browser . diz_location ) , line ) <EOL> for line in description ] ) , <EOL> term . move ( <NUM_LIT:2> + len ( description ) , browser . diz_location ) ) ) ) <EOL> wrapped_diz = [ ] <EOL> for line in diz : <EOL> wrapped_diz += term . wrap ( line , browser . max_diz_width ) <EOL> wrapped_diz = wrapped_diz [ : browser . max_diz_height - len ( description ) + <NUM_LIT:1> ] <EOL> output = u'<STR_LIT>' <EOL> for line in wrapped_diz : <EOL> browser . last_diz_len += <NUM_LIT:1> <EOL> output = u'<STR_LIT>' . join ( <EOL> ( output , term . move_x ( browser . diz_location ) , <EOL> line , u'<STR_LIT:\r\n>' ) ) <EOL> echo ( output ) <EOL> def mark_flagged ( directory , files ) : <EOL> """<STR_LIT>""" <EOL> files_list = list ( ) <EOL> for fname in files : <EOL> prefix = u'<STR_LIT:U+0020>' <EOL> if os . path . join ( directory , fname ) in browser . flagged_files : <EOL> prefix = FLAGGED_CHAR <EOL> txt_fname = fname . strip ( ) . decode ( '<STR_LIT:utf8>' ) <EOL> item = ( fname , ( u'<STR_LIT>' <EOL> . format ( prefix = prefix , txt_fname = txt_fname ) ) ) <EOL> files_list . append ( item ) <EOL> return files_list <EOL> def flagged_listdir ( ) : <EOL> """<STR_LIT>""" <EOL> files = [ u'<STR_LIT>' . format ( <EOL> flagged_char = FLAGGED_CHAR , <EOL> txt_fname = fname [ fname . rfind ( os . path . sep ) + <NUM_LIT:1> : ] . decode ( '<STR_LIT:utf8>' ) ) <EOL> for fname in browser . flagged_files ] <EOL> zipped_files = zip ( browser . flagged_files , files ) <EOL> sorted_files = sorted ( zipped_files , key = lambda x : x [ <NUM_LIT:1> ] . lower ( ) ) <EOL> sorted_files . insert ( <NUM_LIT:0> , ( u'<STR_LIT>' . format ( os . path . sep ) , <EOL> u'<STR_LIT>' . format ( os . path . sep ) ) ) <EOL> return sorted_files <EOL> def regular_listdir ( session , directory , sub ) : <EOL> """<STR_LIT>""" <EOL> files = sorted ( os . listdir ( directory ) , key = lambda x : x . lower ( ) ) <EOL> sorted_dirs = [ ] <EOL> sorted_files = [ ] <EOL> for fname in files : <EOL> filepath = os . path . join ( directory , fname ) <EOL> if not session . user . is_sysop and filepath == UPLOADS_DIR : <EOL> continue <EOL> if os . path . isdir ( filepath ) : <EOL> sorted_dirs . append ( '<STR_LIT>' . format ( fname , os . path . sep ) ) <EOL> else : <EOL> sorted_files . append ( fname ) <EOL> if sub : <EOL> sorted_dirs . insert ( <NUM_LIT:0> , '<STR_LIT>' . format ( os . path . sep ) ) <EOL> else : <EOL> sorted_dirs . insert ( <NUM_LIT:0> , FLAGGED_DIRNAME ) <EOL> return mark_flagged ( directory , sorted_dirs + sorted_files ) <EOL> def reload_dir ( session , directory , lightbar , sub ) : <EOL> """<STR_LIT>""" <EOL> if directory == os . path . join ( ROOT , FLAGGED_DIRNAME ) : <EOL> lightbar . update ( flagged_listdir ( ) ) <EOL> else : <EOL> lightbar . update ( regular_listdir ( session , directory , sub ) ) <EOL> def is_flagged_dir ( directory ) : <EOL> """<STR_LIT>""" <EOL> return ( directory == FLAGGED_DIRNAME or <EOL> directory . endswith ( FLAGGED_DIRNAME ) ) <EOL> def browse_dir ( session , db_desc , term , lightbar , directory , sub = False ) : <EOL> """<STR_LIT>""" <EOL> reload_dir ( session , directory , lightbar , sub ) <EOL> echo ( lightbar . refresh ( ) ) <EOL> filename , _ = lightbar . selection <EOL> browser . last_diz_len = <NUM_LIT:0> <EOL> diz = '<STR_LIT>' <EOL> inp = lightbar . keyset [ '<STR_LIT>' ] [ <NUM_LIT:0> ] <EOL> isdir = False <EOL> filepath = '<STR_LIT>' <EOL> while True : <EOL> while not inp : <EOL> inp = getch ( <NUM_LIT> ) <EOL> if session . poll_event ( '<STR_LIT>' ) : <EOL> draw_interface ( term , lightbar ) <EOL> describe_file ( term , diz = diz , directory = directory , <EOL> filename = filename , isdir = isdir ) <EOL> idx = lightbar . vitem_idx <EOL> shift = lightbar . vitem_shift <EOL> lightbar . process_keystroke ( inp ) <EOL> filename , _ = lightbar . selection <EOL> filepath = os . path . join ( directory , filename ) <EOL> relativename = filepath [ len ( ROOT ) : ] <EOL> isdir = bool ( filepath [ - <NUM_LIT:1> : ] == os . path . sep ) <EOL> _ , ext = os . path . splitext ( filename . lower ( ) ) <EOL> if inp in lightbar . keyset [ '<STR_LIT>' ] : <EOL> echo ( lightbar . refresh_row ( idx ) ) <EOL> echo ( lightbar . refresh_row ( lightbar . vitem_idx ) ) <EOL> elif lightbar . quit : <EOL> return False <EOL> elif inp in ( u'<STR_LIT:U+0020>' , ) and filename [ - <NUM_LIT:1> : ] != os . path . sep : <EOL> if filepath in browser . flagged_files : <EOL> browser . flagged_files . remove ( filepath ) <EOL> else : <EOL> browser . flagged_files . add ( filepath ) <EOL> session . user [ '<STR_LIT>' ] = browser . flagged_files <EOL> reload_dir ( session , directory , lightbar , sub ) <EOL> if is_flagged_dir ( directory ) : <EOL> echo ( lightbar . refresh ( ) ) <EOL> else : <EOL> echo ( lightbar . refresh_row ( lightbar . vitem_idx ) ) <EOL> lightbar . move_down ( ) <EOL> elif inp in ( u'<STR_LIT:->' , ) : <EOL> session . user [ '<STR_LIT>' ] = browser . flagged_files = set ( ) <EOL> reload_dir ( session , directory , lightbar , sub ) <EOL> echo ( lightbar . refresh ( ) ) <EOL> elif inp in ( u'<STR_LIT:d>' , ) and len ( browser . flagged_files ) : <EOL> download_files ( term , session ) <EOL> reload_dir ( session , directory , lightbar , sub ) <EOL> draw_interface ( term , lightbar ) <EOL> elif inp in ( u'<STR_LIT:u>' , ) : <EOL> upload_files ( term ) <EOL> reload_dir ( session , directory , lightbar , sub ) <EOL> draw_interface ( term , lightbar ) <EOL> elif inp in ( u'<STR_LIT:e>' , ) and session . user . is_sysop and not isdir : <EOL> edit_description ( relativename , db_desc ) <EOL> reload_dir ( session , directory , lightbar , sub ) <EOL> draw_interface ( term , lightbar ) <EOL> clear_diz ( term ) <EOL> save_diz = True <EOL> if lightbar . selected or inp in ( term . KEY_LEFT , term . KEY_RIGHT , ) : <EOL> if sub and inp is term . KEY_LEFT : <EOL> return True <EOL> if ( isdir or is_flagged_dir ( filename ) and ( <EOL> lightbar . selected or inp is term . KEY_RIGHT ) ) : <EOL> if filename == '<STR_LIT>' . format ( os . path . sep ) : <EOL> return True <EOL> if not browse_dir ( session , db_desc , term , lightbar , <EOL> filepath , True ) : <EOL> return False <EOL> reload_dir ( session , directory , lightbar , sub ) <EOL> lightbar . vitem_shift = shift <EOL> lightbar . vitem_idx = idx <EOL> echo ( lightbar . refresh ( ) ) <EOL> if relativename in db_desc : <EOL> save_diz = False <EOL> diz = db_desc [ relativename ] <EOL> if ext in COLLY_EXTENSIONS : <EOL> decoder = '<STR_LIT>' <EOL> if session . encoding == '<STR_LIT:utf8>' : <EOL> decoder = COLLY_DECODING <EOL> try : <EOL> diz = [ line . decode ( decoder , errors = '<STR_LIT:replace>' ) <EOL> for line in diz ] <EOL> except UnicodeEncodeError : <EOL> diz = [ u'<STR_LIT>' ] <EOL> elif ext in browser . diz_extractors : <EOL> diz = browser . diz_extractors [ ext ] ( filepath ) . splitlines ( ) <EOL> elif ext in COLLY_EXTENSIONS : <EOL> diz = get_diz_from_colly ( filepath = filepath ) or diz <EOL> save_diz = False <EOL> db_desc [ relativename ] = diz <EOL> decoder = '<STR_LIT>' <EOL> if session . encoding == '<STR_LIT:utf8>' : <EOL> decoder = COLLY_DECODING <EOL> try : <EOL> diz = [ line . decode ( decoder , errors = '<STR_LIT:replace>' ) for line in diz ] <EOL> except UnicodeEncodeError : <EOL> diz = [ u'<STR_LIT>' ] <EOL> db_desc [ relativename ] = diz <EOL> elif is_flagged_dir ( filename ) : <EOL> save_diz = False <EOL> diz = get_instructions ( term , session . user . is_sysop ) <EOL> elif isdir : <EOL> save_diz = False <EOL> diz = [ ] <EOL> else : <EOL> save_diz = False <EOL> diz = [ u'<STR_LIT>' ] <EOL> if not UPLOADS_DIR . find ( directory ) and save_diz : <EOL> with db_desc : <EOL> db_desc [ relativename ] = diz <EOL> browser . last_diz_len = len ( diz ) <EOL> describe_file ( term = term , diz = diz , directory = directory , <EOL> filename = filename , isdir = isdir ) <EOL> echo ( lightbar . refresh_quick ( ) + lightbar . fixate ( ) ) <EOL> inp = None <EOL> def main ( ) : <EOL> """<STR_LIT>""" <EOL> import subprocess <EOL> import functools <EOL> session , term = getsession ( ) , getterminal ( ) <EOL> session . activity = u'<STR_LIT>' <EOL> db_desc = DBProxy ( DIZ_DB ) <EOL> if SYNCTERM_FONT and term . kind . startswith ( '<STR_LIT>' ) : <EOL> echo ( syncterm_setfont ( SYNCTERM_FONT ) ) <EOL> browser . diz_extractors [ '<STR_LIT>' ] = diz_from_zip <EOL> output , _ = subprocess . Popen ( ( '<STR_LIT>' , '<STR_LIT>' ) , stdout = subprocess . PIPE , <EOL> stderr = subprocess . PIPE ) . communicate ( ) <EOL> if output : <EOL> browser . diz_extractors [ '<STR_LIT>' ] = functools . partial ( diz_from_lha , <EOL> output . rstrip ( ) ) <EOL> output , _ = subprocess . Popen ( ( '<STR_LIT>' , '<STR_LIT>' ) , stdout = subprocess . PIPE , <EOL> stderr = subprocess . PIPE ) . communicate ( ) <EOL> if output : <EOL> browser . diz_extractors [ '<STR_LIT>' ] = functools . partial ( diz_from_dms , <EOL> output . rstrip ( ) ) <EOL> browser . flagged_files = session . user . get ( '<STR_LIT>' , set ( ) ) <EOL> if len ( browser . flagged_files ) : <EOL> for filepath in list ( browser . flagged_files ) [ : ] : <EOL> if not os . path . exists ( filepath ) : <EOL> browser . flagged_files . remove ( filepath ) <EOL> session . user [ '<STR_LIT>' ] = browser . flagged_files <EOL> lightbar = Lightbar ( height = term . height , <EOL> width = min ( <NUM_LIT:10> , int ( term . width * <NUM_LIT> ) ) , <EOL> xloc = <NUM_LIT:0> , yloc = <NUM_LIT:0> , <EOL> colors = { '<STR_LIT>' : getattr ( term , COLOR_BORDER ) , <EOL> '<STR_LIT>' : getattr ( term , COLOR_HIGHLIGHT ) } ) <EOL> draw_interface ( term , lightbar ) <EOL> with term . hidden_cursor ( ) : <EOL> browse_dir ( session , db_desc , term , lightbar , ROOT ) <EOL> echo ( term . move ( term . height , term . width ) ) <EOL> echo ( u'<STR_LIT>' + term . normal ) </s>
