<s> import wx <EOL> from gooey . gui . pubsub import pub <EOL> from gooey . gui import events <EOL> from gooey . gui . util import wx_util <EOL> class Sidebar ( wx . Panel ) : <EOL> def __init__ ( self , parent , * args , ** kwargs ) : <EOL> super ( Sidebar , self ) . __init__ ( parent , * args , ** kwargs ) <EOL> self . SetDoubleBuffered ( True ) <EOL> self . _parent = parent <EOL> self . _do_layout ( ) <EOL> def _do_layout ( self ) : <EOL> self . SetDoubleBuffered ( True ) <EOL> self . SetBackgroundColour ( '<STR_LIT>' ) <EOL> self . SetSize ( ( <NUM_LIT> , <NUM_LIT:0> ) ) <EOL> self . SetMinSize ( ( <NUM_LIT> , <NUM_LIT:0> ) ) <EOL> STD_LAYOUT = ( <NUM_LIT:0> , wx . LEFT | wx . RIGHT | wx . EXPAND , <NUM_LIT:10> ) <EOL> container = wx . BoxSizer ( wx . VERTICAL ) <EOL> container . AddSpacer ( <NUM_LIT:15> ) <EOL> container . Add ( wx_util . h1 ( self , '<STR_LIT>' ) , * STD_LAYOUT ) <EOL> container . AddSpacer ( <NUM_LIT:5> ) <EOL> self . listbox = wx . ListBox ( self , - <NUM_LIT:1> ) <EOL> container . Add ( self . listbox , <NUM_LIT:1> , wx . LEFT | wx . RIGHT | wx . EXPAND , <NUM_LIT:10> ) <EOL> container . AddSpacer ( <NUM_LIT:20> ) <EOL> self . SetSizer ( container ) <EOL> self . Bind ( wx . EVT_LISTBOX , self . selection_change , self . listbox ) <EOL> def set_list_contents ( self , contents ) : <EOL> self . listbox . AppendItems ( contents ) <EOL> self . listbox . SetSelection ( <NUM_LIT:0> ) <EOL> def selection_change ( self , evt ) : <EOL> pub . send_message ( <EOL> events . LIST_BOX , <EOL> selection = self . listbox . GetItems ( ) [ self . listbox . GetSelection ( ) ] ) <EOL> evt . Skip ( ) </s>
