<s> import wx <EOL> import wx . grid <EOL> import wx . richtext <EOL> from odmtools . odmdata import Method <EOL> [ wxID_PNLMETHOD , wxID_PNLMETHODSLISTCTRL1 , wxID_PNLMETHODSRBCREATENEW , <EOL> wxID_PNLMETHODSRBGENERATE , wxID_PNLMETHODSRBSELECT , <EOL> wxID_PNLMETHODSRICHTEXTCTRL1 , <EOL> ] = [ wx . NewId ( ) for _init_ctrls in range ( <NUM_LIT:6> ) ] <EOL> from odmtools . common . logger import LoggerTool <EOL> import logging <EOL> tool = LoggerTool ( ) <EOL> logger = tool . setupLogger ( __name__ , __name__ + '<STR_LIT>' , '<STR_LIT:w>' , logging . DEBUG ) <EOL> class pnlMethod ( wx . Panel ) : <EOL> def _init_ctrls ( self , prnt ) : <EOL> wx . Panel . __init__ ( self , id = wxID_PNLMETHOD , name = u'<STR_LIT>' , <EOL> parent = prnt , pos = wx . Point ( <NUM_LIT> , <NUM_LIT> ) , size = wx . Size ( <NUM_LIT> , <NUM_LIT> ) , <EOL> style = wx . TAB_TRAVERSAL ) <EOL> self . SetClientSize ( wx . Size ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> self . rbGenerate = wx . RadioButton ( id = wxID_PNLMETHODSRBGENERATE , <EOL> label = u'<STR_LIT>' , name = u'<STR_LIT>' , <EOL> parent = self , pos = wx . Point ( <NUM_LIT:16> , <NUM_LIT:8> ) , size = wx . Size ( <NUM_LIT> , <NUM_LIT:16> ) , style = <NUM_LIT:0> ) <EOL> self . rbGenerate . SetValue ( True ) <EOL> self . rbGenerate . Bind ( wx . EVT_RADIOBUTTON , self . OnRbGenerateRadiobutton , <EOL> id = wxID_PNLMETHODSRBGENERATE ) <EOL> self . rbSelect = wx . RadioButton ( id = wxID_PNLMETHODSRBSELECT , <EOL> label = u'<STR_LIT>' , name = u'<STR_LIT>' , parent = self , <EOL> pos = wx . Point ( <NUM_LIT:16> , <NUM_LIT:32> ) , size = wx . Size ( <NUM_LIT> , <NUM_LIT> ) , style = <NUM_LIT:0> ) <EOL> self . rbSelect . SetValue ( False ) <EOL> self . rbSelect . Bind ( wx . EVT_RADIOBUTTON , self . OnRbSelectRadiobutton , <EOL> id = wxID_PNLMETHODSRBSELECT ) <EOL> self . rbCreateNew = wx . RadioButton ( id = wxID_PNLMETHODSRBCREATENEW , <EOL> label = u'<STR_LIT>' , name = u'<STR_LIT>' , parent = self , <EOL> pos = wx . Point ( <NUM_LIT:16> , <NUM_LIT> ) , size = wx . Size ( <NUM_LIT> , <NUM_LIT> ) , style = <NUM_LIT:0> ) <EOL> self . rbCreateNew . SetValue ( False ) <EOL> self . rbCreateNew . Bind ( wx . EVT_RADIOBUTTON , self . OnRbCreateNewRadiobutton , <EOL> id = wxID_PNLMETHODSRBCREATENEW ) <EOL> self . txtMethodDescrip = wx . richtext . RichTextCtrl ( id = wxID_PNLMETHODSRICHTEXTCTRL1 , <EOL> parent = self , pos = wx . Point ( <NUM_LIT:16> , <NUM_LIT> ) , size = wx . Size ( <NUM_LIT> , <NUM_LIT> ) , <EOL> style = wx . richtext . RE_MULTILINE , value = u'<STR_LIT>' ) <EOL> self . txtMethodDescrip . Enable ( False ) <EOL> self . txtMethodDescrip . Bind ( wx . EVT_SET_FOCUS , self . OnTxtMethodDescripSetFocus ) <EOL> self . txtMethodDescrip . Bind ( wx . EVT_KILL_FOCUS , self . OnTxtMethodDescripKillFocus ) <EOL> self . lstMethods = wx . ListCtrl ( id = wxID_PNLMETHODSLISTCTRL1 , <EOL> name = '<STR_LIT>' , parent = self , pos = wx . Point ( <NUM_LIT:16> , <NUM_LIT> ) , <EOL> size = wx . Size ( <NUM_LIT> , <NUM_LIT> ) , style = wx . LC_REPORT | wx . LC_SINGLE_SEL ) <EOL> self . lstMethods . InsertColumn ( <NUM_LIT:0> , '<STR_LIT>' ) <EOL> self . lstMethods . InsertColumn ( <NUM_LIT:1> , '<STR_LIT>' ) <EOL> self . lstMethods . InsertColumn ( <NUM_LIT:2> , '<STR_LIT:id>' ) <EOL> self . lstMethods . SetColumnWidth ( <NUM_LIT:0> , <NUM_LIT:200> ) <EOL> self . lstMethods . SetColumnWidth ( <NUM_LIT:1> , <NUM_LIT> ) <EOL> self . lstMethods . SetColumnWidth ( <NUM_LIT:2> , <NUM_LIT:0> ) <EOL> self . lstMethods . Enable ( False ) <EOL> def __init__ ( self , parent , id , pos , size , style , name , sm , method ) : <EOL> self . series_service = sm . get_series_service ( ) <EOL> self . prev_val = method <EOL> self . _init_ctrls ( parent ) <EOL> def OnRbGenerateRadiobutton ( self , event ) : <EOL> self . lstMethods . Enable ( False ) <EOL> self . txtMethodDescrip . Enable ( False ) <EOL> event . Skip ( ) <EOL> def OnRbSelectRadiobutton ( self , event ) : <EOL> self . lstMethods . Enable ( True ) <EOL> self . txtMethodDescrip . Enable ( False ) <EOL> event . Skip ( ) <EOL> def OnRbCreateNewRadiobutton ( self , event ) : <EOL> self . lstMethods . Enable ( False ) <EOL> self . txtMethodDescrip . Enable ( True ) <EOL> event . Skip ( ) <EOL> def OnTxtMethodDescripSetFocus ( self , event ) : <EOL> if self . txtMethodDescrip . GetValue ( ) == "<STR_LIT>" : <EOL> self . txtMethodDescrip . SetValue ( "<STR_LIT>" ) <EOL> event . Skip ( ) <EOL> def OnTxtMethodDescripKillFocus ( self , event ) : <EOL> if self . txtMethodDescrip . GetValue ( ) == "<STR_LIT>" : <EOL> self . txtMethodDescrip . SetValue ( "<STR_LIT>" ) <EOL> event . Skip ( ) <EOL> def getMethod ( self ) : <EOL> m = Method ( ) <EOL> if self . rbGenerate . Value : <EOL> genmethod = "<STR_LIT>" <EOL> try : <EOL> m = self . series_service . get_method_by_description ( genmethod ) <EOL> except : <EOL> m . description = genmethod <EOL> elif self . rbSelect . Value : <EOL> index = self . lstMethods . GetFirstSelected ( ) <EOL> desc = self . lstMethods . GetItem ( index , <NUM_LIT:0> ) . GetText ( ) <EOL> logger . debug ( desc ) <EOL> m = self . series_service . get_method_by_description ( desc ) <EOL> elif self . rbCreateNew . Value : <EOL> m . description = self . txtMethodDescrip . GetValue ( ) <EOL> return m </s>
