<s> class QtileState ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , qtile ) : <EOL> self . groups = [ ] <EOL> self . screens = { } <EOL> self . current_screen = <NUM_LIT:0> <EOL> for group in qtile . groups : <EOL> self . groups . append ( ( group . name , group . layout . name ) ) <EOL> for index , screen in enumerate ( qtile . screens ) : <EOL> self . screens [ index ] = screen . group . name <EOL> if screen == qtile . currentScreen : <EOL> self . current_screen = index <EOL> def apply ( self , qtile ) : <EOL> """<STR_LIT>""" <EOL> for ( group , layout ) in self . groups : <EOL> try : <EOL> qtile . groupMap [ group ] . layout = layout <EOL> except KeyError : <EOL> qtile . addGroup ( group , layout ) <EOL> for ( screen , group ) in self . screens . items ( ) : <EOL> try : <EOL> group = qtile . groupMap [ group ] <EOL> qtile . screens [ screen ] . setGroup ( group ) <EOL> except ( KeyError , IndexError ) : <EOL> pass <EOL> qtile . toScreen ( self . current_screen ) </s>
