<s> from calvin . actor . actor import Actor , ActionResult , condition , manage <EOL> class ImageRenderer ( Actor ) : <EOL> """<STR_LIT>""" <EOL> @ manage ( [ '<STR_LIT:width>' , '<STR_LIT>' ] ) <EOL> def init ( self , width = <NUM_LIT> , height = <NUM_LIT> ) : <EOL> self . width = width <EOL> self . height = height <EOL> self . setup ( ) <EOL> def setup ( self ) : <EOL> self . use ( "<STR_LIT>" , shorthand = "<STR_LIT:image>" ) <EOL> self . image = self [ "<STR_LIT:image>" ] <EOL> def did_migrate ( self ) : <EOL> self . setup ( ) <EOL> def will_end ( self ) : <EOL> self . image . close ( ) <EOL> def will_migrate ( self ) : <EOL> self . image . close ( ) <EOL> @ condition ( action_input = ( '<STR_LIT:image>' , ) ) <EOL> def render_image ( self , image ) : <EOL> if image is not None : <EOL> self . image . show_image ( image , self . width , self . height ) <EOL> return ActionResult ( production = ( ) ) <EOL> action_priority = ( render_image , ) <EOL> requires = [ '<STR_LIT>' ] </s>
