<s> """<STR_LIT>""" <EOL> from colorama import Fore , Back , Style <EOL> from logcatcolor . column import * <EOL> from logcatcolor . format import Format <EOL> import re <EOL> from cStringIO import StringIO <EOL> def layout ( cls ) : <EOL> Layout . TYPES [ cls . NAME ] = cls <EOL> return cls <EOL> class Layout ( object ) : <EOL> TYPES = { } <EOL> MARKER_LAYOUT = Fore . WHITE + Back . BLACK + Style . DIM + "<STR_LIT:%s>" + Style . RESET_ALL <EOL> def __init__ ( self , config = None , profile = None , width = <NUM_LIT> ) : <EOL> self . columns = [ ] <EOL> self . config = config <EOL> self . profile = profile <EOL> self . width = width <EOL> self . total_column_width = <NUM_LIT:0> <EOL> if self . COLUMNS : <EOL> for ColumnType in self . COLUMNS : <EOL> if config : <EOL> self . total_column_width += config . get_column_width ( ColumnType ) <EOL> else : <EOL> self . total_column_width += ColumnType . DEFAULT_WIDTH <EOL> for ColumnType in self . COLUMNS : <EOL> column = ColumnType ( self ) <EOL> self . columns . append ( column ) <EOL> self . column_count = len ( self . columns ) <EOL> def layout_marker ( self , line ) : <EOL> return self . MARKER_LAYOUT % line <EOL> def layout_data ( self , data ) : <EOL> formatted = StringIO ( ) <EOL> for index in range ( <NUM_LIT:0> , self . column_count ) : <EOL> column = self . columns [ index ] <EOL> formatted . write ( column . format ( data [ column . NAME ] ) ) <EOL> if index < self . column_count - <NUM_LIT:1> : <EOL> formatted . write ( "<STR_LIT:U+0020>" ) <EOL> return formatted . getvalue ( ) <EOL> @ layout <EOL> class RawLayout ( Layout ) : <EOL> NAME = "<STR_LIT>" <EOL> COLUMNS = None <EOL> def layout_marker ( self , line ) : <EOL> return line <EOL> def layout_data ( self , data ) : <EOL> return data [ "<STR_LIT>" ] <EOL> @ layout <EOL> class BriefLayout ( Layout ) : <EOL> NAME = "<STR_LIT>" <EOL> COLUMNS = ( PIDColumn , TagColumn , PriorityColumn , MessageColumn ) <EOL> @ layout <EOL> class ProcessLayout ( Layout ) : <EOL> NAME = "<STR_LIT>" <EOL> COLUMNS = BriefLayout . COLUMNS <EOL> @ layout <EOL> class TagLayout ( Layout ) : <EOL> NAME = "<STR_LIT>" <EOL> COLUMNS = ( TagColumn , PriorityColumn , MessageColumn ) <EOL> @ layout <EOL> class ThreadLayout ( Layout ) : <EOL> NAME = "<STR_LIT>" <EOL> COLUMNS = ( PIDColumn , TIDColumn , PriorityColumn , MessageColumn ) <EOL> @ layout <EOL> class TimeLayout ( Layout ) : <EOL> NAME = "<STR_LIT:time>" <EOL> COLUMNS = ( DateColumn , TimeColumn , ) + BriefLayout . COLUMNS <EOL> @ layout <EOL> class ThreadTimeLayout ( Layout ) : <EOL> NAME = "<STR_LIT>" <EOL> COLUMNS = ( DateColumn , TimeColumn , PIDColumn , TIDColumn , TagColumn , PriorityColumn , MessageColumn ) <EOL> @ layout <EOL> class LongLayout ( Layout ) : <EOL> NAME = "<STR_LIT>" <EOL> COLUMNS = ThreadTimeLayout . COLUMNS </s>
