<s> """<STR_LIT>""" <EOL> import wx <EOL> from traits . trait_base import SequenceTypes <EOL> from color_editor import ToolkitEditorFactory as BaseColorToolkitEditorFactory <EOL> class ToolkitEditorFactory ( BaseColorToolkitEditorFactory ) : <EOL> """<STR_LIT>""" <EOL> def to_wx_color ( self , editor , color = None ) : <EOL> """<STR_LIT>""" <EOL> if color is None : <EOL> try : <EOL> color = getattr ( editor . object , editor . name + '<STR_LIT:_>' ) <EOL> except AttributeError : <EOL> color = getattr ( editor . object , editor . name ) <EOL> if isinstance ( color , tuple ) : <EOL> return wx . Colour ( int ( color [ <NUM_LIT:0> ] * <NUM_LIT> ) , <EOL> int ( color [ <NUM_LIT:1> ] * <NUM_LIT> ) , <EOL> int ( color [ <NUM_LIT:2> ] * <NUM_LIT> ) ) <EOL> return color <EOL> def from_wx_color ( self , color ) : <EOL> """<STR_LIT>""" <EOL> return ( color . Red ( ) / <NUM_LIT> , <EOL> color . Green ( ) / <NUM_LIT> , <EOL> color . Blue ( ) / <NUM_LIT> ) <EOL> def str_color ( self , color ) : <EOL> """<STR_LIT>""" <EOL> if type ( color ) in SequenceTypes : <EOL> return "<STR_LIT>" % ( int ( color [ <NUM_LIT:0> ] * <NUM_LIT> ) , <EOL> int ( color [ <NUM_LIT:1> ] * <NUM_LIT> ) , <EOL> int ( color [ <NUM_LIT:2> ] * <NUM_LIT> ) ) <EOL> return super ( ToolkitEditorFactory , self ) . str_color ( color ) </s>
