<s> import wx <EOL> from enaml . fontext import FontStyle <EOL> FONT_STYLE = { <EOL> FontStyle . Normal : wx . FONTSTYLE_NORMAL , <EOL> FontStyle . Italic : wx . FONTSTYLE_ITALIC , <EOL> FontStyle . Oblique : wx . FONTSTYLE_SLANT , <EOL> } <EOL> def wxColor_from_Color ( color ) : <EOL> """<STR_LIT>""" <EOL> return wx . Color ( color . red , color . green , color . blue , color . alpha ) <EOL> def get_cached_wxcolor ( color ) : <EOL> """<STR_LIT>""" <EOL> wxcolor = color . _tkdata <EOL> if not isinstance ( wxcolor , wx . Color ) : <EOL> wxcolor = color . _tkdata = wxColor_from_Color ( color ) <EOL> return wxcolor <EOL> def wxFont_from_Font ( font ) : <EOL> """<STR_LIT>""" <EOL> wxstyle = FONT_STYLE [ font . style ] <EOL> if font . weight < <NUM_LIT:50> : <EOL> wxweight = wx . FONTWEIGHT_LIGHT <EOL> elif font . weight >= <NUM_LIT> : <EOL> wxweight = wx . FONTWEIGHT_BOLD <EOL> else : <EOL> wxweight = wx . FONTWEIGHT_NORMAL <EOL> wxfamily = wx . FONTFAMILY_DEFAULT <EOL> wxfont = wx . Font ( font . pointsize , wxfamily , wxstyle , wxweight ) <EOL> wxfont . SetFaceName ( font . family ) <EOL> return wxfont <EOL> def get_cached_wxfont ( font ) : <EOL> """<STR_LIT>""" <EOL> wxfont = font . _tkdata <EOL> if not isinstance ( wxfont , wx . Font ) : <EOL> wxfont = font . _tkdata = wxFont_from_Font ( font ) <EOL> return wxfont </s>
