<s> from atom . api import Bool , Enum , Int , Range , Typed , ForwardTyped , observe <EOL> from enaml . core . declarative import d_ <EOL> from . control import Control , ProxyControl <EOL> TickPosition = Enum ( '<STR_LIT>' , '<STR_LIT:left>' , '<STR_LIT:right>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> class ProxySlider ( ProxyControl ) : <EOL> """<STR_LIT>""" <EOL> declaration = ForwardTyped ( lambda : Slider ) <EOL> def set_minimum ( self , minimum ) : <EOL> raise NotImplementedError <EOL> def set_maximum ( self , maximum ) : <EOL> raise NotImplementedError <EOL> def set_value ( self , value ) : <EOL> raise NotImplementedError <EOL> def set_single_step ( self , step ) : <EOL> raise NotImplementedError <EOL> def set_page_step ( self , step ) : <EOL> raise NotImplementedError <EOL> def set_tick_position ( self , position ) : <EOL> raise NotImplementedError <EOL> def set_tick_interval ( self , interval ) : <EOL> raise NotImplementedError <EOL> def set_orientation ( self , orientation ) : <EOL> raise NotImplementedError <EOL> def set_tracking ( self , tracking ) : <EOL> raise NotImplementedError <EOL> class Slider ( Control ) : <EOL> """<STR_LIT>""" <EOL> minimum = d_ ( Int ( <NUM_LIT:0> ) ) <EOL> maximum = d_ ( Int ( <NUM_LIT:100> ) ) <EOL> value = d_ ( Int ( <NUM_LIT:0> ) ) <EOL> single_step = d_ ( Range ( low = <NUM_LIT:1> ) ) <EOL> page_step = d_ ( Range ( low = <NUM_LIT:1> , value = <NUM_LIT:10> ) ) <EOL> tick_position = d_ ( TickPosition ( '<STR_LIT>' ) ) <EOL> tick_interval = d_ ( Range ( low = <NUM_LIT:0> ) ) <EOL> orientation = d_ ( Enum ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> tracking = d_ ( Bool ( True ) ) <EOL> auto_hug = d_ ( Bool ( True ) ) <EOL> proxy = Typed ( ProxySlider ) <EOL> @ observe ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:value>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> def _update_proxy ( self , change ) : <EOL> """<STR_LIT>""" <EOL> super ( Slider , self ) . _update_proxy ( change ) <EOL> def _default_hug_width ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . orientation == '<STR_LIT>' : <EOL> return '<STR_LIT:ignore>' <EOL> return '<STR_LIT>' <EOL> def _default_hug_height ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . orientation == '<STR_LIT>' : <EOL> return '<STR_LIT:ignore>' <EOL> return '<STR_LIT>' <EOL> def _post_setattr_orientation ( self , old , new ) : <EOL> """<STR_LIT>""" <EOL> if self . auto_hug : <EOL> if new == '<STR_LIT>' : <EOL> self . hug_width = '<STR_LIT>' <EOL> self . hug_height = '<STR_LIT:ignore>' <EOL> else : <EOL> self . hug_width = '<STR_LIT:ignore>' <EOL> self . hug_height = '<STR_LIT>' <EOL> def _post_setattr_minimum ( self , old , new ) : <EOL> """<STR_LIT>""" <EOL> if new > self . maximum : <EOL> self . maximum = new <EOL> if new > self . value : <EOL> self . value = new <EOL> def _post_setattr_maximum ( self , old , new ) : <EOL> """<STR_LIT>""" <EOL> if new < self . minimum : <EOL> self . minimum = new <EOL> if new < self . value : <EOL> self . value = new <EOL> def _post_validate_value ( self , old , new ) : <EOL> """<STR_LIT>""" <EOL> return max ( self . minimum , min ( new , self . maximum ) ) </s>
