<s> """<STR_LIT>""" <EOL> from Tkinter import * <EOL> STOP = '<STR_LIT>' <EOL> WRAP = '<STR_LIT>' <EOL> RATIO = '<STR_LIT>' <EOL> GRAV = '<STR_LIT>' <EOL> ADDTOVIEW = '<STR_LIT>' <EOL> class DetailsViewer : <EOL> def __init__ ( self , switchboard , master = None ) : <EOL> self . __sb = switchboard <EOL> optiondb = switchboard . optiondb ( ) <EOL> self . __red , self . __green , self . __blue = switchboard . current_rgb ( ) <EOL> root = self . __root = Toplevel ( master , class_ = '<STR_LIT>' ) <EOL> root . protocol ( '<STR_LIT>' , self . withdraw ) <EOL> root . title ( '<STR_LIT>' ) <EOL> root . iconname ( '<STR_LIT>' ) <EOL> root . bind ( '<STR_LIT>' , self . __quit ) <EOL> root . bind ( '<STR_LIT>' , self . __quit ) <EOL> root . bind ( '<STR_LIT>' , self . withdraw ) <EOL> root . bind ( '<STR_LIT>' , self . withdraw ) <EOL> root . bind ( '<STR_LIT>' , self . __minus1 ) <EOL> root . bind ( '<STR_LIT>' , self . __plus1 ) <EOL> root . bind ( '<STR_LIT>' , self . __minus10 ) <EOL> root . bind ( '<STR_LIT>' , self . __plus10 ) <EOL> root . bind ( '<STR_LIT>' , self . __minus25 ) <EOL> root . bind ( '<STR_LIT>' , self . __plus25 ) <EOL> frame = self . __frame = Frame ( root ) <EOL> frame . pack ( expand = YES , fill = X ) <EOL> self . __l1 = Label ( frame , text = '<STR_LIT>' ) <EOL> self . __l1 . grid ( row = <NUM_LIT:1> , column = <NUM_LIT:0> , sticky = E ) <EOL> self . __rvar = IntVar ( ) <EOL> self . __rvar . set ( optiondb . get ( '<STR_LIT>' , <NUM_LIT:4> ) ) <EOL> self . __radio1 = Checkbutton ( frame , text = '<STR_LIT>' , <EOL> variable = self . __rvar , <EOL> command = self . __effect , <EOL> onvalue = <NUM_LIT:4> , offvalue = <NUM_LIT:0> ) <EOL> self . __radio1 . grid ( row = <NUM_LIT:1> , column = <NUM_LIT:1> , sticky = W ) <EOL> self . __gvar = IntVar ( ) <EOL> self . __gvar . set ( optiondb . get ( '<STR_LIT>' , <NUM_LIT:2> ) ) <EOL> self . __radio2 = Checkbutton ( frame , text = '<STR_LIT>' , <EOL> variable = self . __gvar , <EOL> command = self . __effect , <EOL> onvalue = <NUM_LIT:2> , offvalue = <NUM_LIT:0> ) <EOL> self . __radio2 . grid ( row = <NUM_LIT:2> , column = <NUM_LIT:1> , sticky = W ) <EOL> self . __bvar = IntVar ( ) <EOL> self . __bvar . set ( optiondb . get ( '<STR_LIT>' , <NUM_LIT:1> ) ) <EOL> self . __radio3 = Checkbutton ( frame , text = '<STR_LIT>' , <EOL> variable = self . __bvar , <EOL> command = self . __effect , <EOL> onvalue = <NUM_LIT:1> , offvalue = <NUM_LIT:0> ) <EOL> self . __radio3 . grid ( row = <NUM_LIT:3> , column = <NUM_LIT:1> , sticky = W ) <EOL> self . __l2 = Label ( frame ) <EOL> self . __l2 . grid ( row = <NUM_LIT:4> , column = <NUM_LIT:1> , sticky = W ) <EOL> self . __effect ( ) <EOL> self . __l3 = Label ( frame , text = '<STR_LIT>' ) <EOL> self . __l3 . grid ( row = <NUM_LIT:5> , column = <NUM_LIT:0> , sticky = E ) <EOL> self . __boundvar = StringVar ( ) <EOL> self . __boundvar . set ( optiondb . get ( '<STR_LIT>' , STOP ) ) <EOL> self . __omenu = OptionMenu ( frame , self . __boundvar , <EOL> STOP , WRAP , RATIO , GRAV ) <EOL> self . __omenu . grid ( row = <NUM_LIT:5> , column = <NUM_LIT:1> , sticky = W ) <EOL> self . __omenu . configure ( width = <NUM_LIT> ) <EOL> frame = self . __btnframe = Frame ( frame ) <EOL> frame . grid ( row = <NUM_LIT:0> , column = <NUM_LIT:0> , columnspan = <NUM_LIT:2> , sticky = '<STR_LIT>' ) <EOL> self . __down25 = Button ( frame , text = '<STR_LIT>' , <EOL> command = self . __minus25 ) <EOL> self . __down10 = Button ( frame , text = '<STR_LIT>' , <EOL> command = self . __minus10 ) <EOL> self . __down1 = Button ( frame , text = '<STR_LIT>' , <EOL> command = self . __minus1 ) <EOL> self . __up1 = Button ( frame , text = '<STR_LIT>' , <EOL> command = self . __plus1 ) <EOL> self . __up10 = Button ( frame , text = '<STR_LIT>' , <EOL> command = self . __plus10 ) <EOL> self . __up25 = Button ( frame , text = '<STR_LIT>' , <EOL> command = self . __plus25 ) <EOL> self . __down25 . pack ( expand = YES , fill = X , side = LEFT ) <EOL> self . __down10 . pack ( expand = YES , fill = X , side = LEFT ) <EOL> self . __down1 . pack ( expand = YES , fill = X , side = LEFT ) <EOL> self . __up1 . pack ( expand = YES , fill = X , side = LEFT ) <EOL> self . __up10 . pack ( expand = YES , fill = X , side = LEFT ) <EOL> self . __up25 . pack ( expand = YES , fill = X , side = LEFT ) <EOL> def __effect ( self , event = None ) : <EOL> tie = self . __rvar . get ( ) + self . __gvar . get ( ) + self . __bvar . get ( ) <EOL> if tie in ( <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:4> ) : <EOL> text = '<STR_LIT>' <EOL> else : <EOL> text = '<STR_LIT>' % { <NUM_LIT:3> : '<STR_LIT>' , <EOL> <NUM_LIT:5> : '<STR_LIT>' , <EOL> <NUM_LIT:6> : '<STR_LIT>' , <EOL> <NUM_LIT:7> : '<STR_LIT>' } [ tie ] <EOL> self . __l2 . configure ( text = text ) <EOL> def __quit ( self , event = None ) : <EOL> self . __root . quit ( ) <EOL> def withdraw ( self , event = None ) : <EOL> self . __root . withdraw ( ) <EOL> def deiconify ( self , event = None ) : <EOL> self . __root . deiconify ( ) <EOL> def __minus25 ( self , event = None ) : <EOL> self . __delta ( - <NUM_LIT> ) <EOL> def __minus10 ( self , event = None ) : <EOL> self . __delta ( - <NUM_LIT:10> ) <EOL> def __minus1 ( self , event = None ) : <EOL> self . __delta ( - <NUM_LIT:1> ) <EOL> def __plus1 ( self , event = None ) : <EOL> self . __delta ( <NUM_LIT:1> ) <EOL> def __plus10 ( self , event = None ) : <EOL> self . __delta ( <NUM_LIT:10> ) <EOL> def __plus25 ( self , event = None ) : <EOL> self . __delta ( <NUM_LIT> ) <EOL> def __delta ( self , delta ) : <EOL> tie = [ ] <EOL> if self . __rvar . get ( ) : <EOL> red = self . __red + delta <EOL> tie . append ( red ) <EOL> else : <EOL> red = self . __red <EOL> if self . __gvar . get ( ) : <EOL> green = self . __green + delta <EOL> tie . append ( green ) <EOL> else : <EOL> green = self . __green <EOL> if self . __bvar . get ( ) : <EOL> blue = self . __blue + delta <EOL> tie . append ( blue ) <EOL> else : <EOL> blue = self . __blue <EOL> atbound = self . __boundvar . get ( ) <EOL> if atbound == STOP : <EOL> if red < <NUM_LIT:0> or green < <NUM_LIT:0> or blue < <NUM_LIT:0> or red > <NUM_LIT:255> or green > <NUM_LIT:255> or blue > <NUM_LIT:255> : <EOL> red , green , blue = self . __red , self . __green , self . __blue <EOL> elif atbound == WRAP or ( atbound == RATIO and len ( tie ) < <NUM_LIT:2> ) : <EOL> if red < <NUM_LIT:0> : <EOL> red += <NUM_LIT> <EOL> if green < <NUM_LIT:0> : <EOL> green += <NUM_LIT> <EOL> if blue < <NUM_LIT:0> : <EOL> blue += <NUM_LIT> <EOL> if red > <NUM_LIT:255> : <EOL> red -= <NUM_LIT> <EOL> if green > <NUM_LIT:255> : <EOL> green -= <NUM_LIT> <EOL> if blue > <NUM_LIT:255> : <EOL> blue -= <NUM_LIT> <EOL> elif atbound == RATIO : <EOL> dir = <NUM_LIT:0> <EOL> for c in tie : <EOL> if c < <NUM_LIT:0> : <EOL> dir = - <NUM_LIT:1> <EOL> elif c > <NUM_LIT:255> : <EOL> dir = <NUM_LIT:1> <EOL> if dir == - <NUM_LIT:1> : <EOL> delta = max ( tie ) <EOL> if self . __rvar . get ( ) : <EOL> red = red + <NUM_LIT:255> - delta <EOL> if self . __gvar . get ( ) : <EOL> green = green + <NUM_LIT:255> - delta <EOL> if self . __bvar . get ( ) : <EOL> blue = blue + <NUM_LIT:255> - delta <EOL> elif dir == <NUM_LIT:1> : <EOL> delta = min ( tie ) <EOL> if self . __rvar . get ( ) : <EOL> red = red - delta <EOL> if self . __gvar . get ( ) : <EOL> green = green - delta <EOL> if self . __bvar . get ( ) : <EOL> blue = blue - delta <EOL> elif atbound == GRAV : <EOL> if red < <NUM_LIT:0> : <EOL> red = <NUM_LIT:0> <EOL> if green < <NUM_LIT:0> : <EOL> green = <NUM_LIT:0> <EOL> if blue < <NUM_LIT:0> : <EOL> blue = <NUM_LIT:0> <EOL> if red > <NUM_LIT:255> : <EOL> red = <NUM_LIT:255> <EOL> if green > <NUM_LIT:255> : <EOL> green = <NUM_LIT:255> <EOL> if blue > <NUM_LIT:255> : <EOL> blue = <NUM_LIT:255> <EOL> self . __sb . update_views ( red , green , blue ) <EOL> self . __root . update_idletasks ( ) <EOL> def update_yourself ( self , red , green , blue ) : <EOL> self . __red = red <EOL> self . __green = green <EOL> self . __blue = blue <EOL> def save_options ( self , optiondb ) : <EOL> optiondb [ '<STR_LIT>' ] = self . __rvar . get ( ) <EOL> optiondb [ '<STR_LIT>' ] = self . __gvar . get ( ) <EOL> optiondb [ '<STR_LIT>' ] = self . __bvar . get ( ) <EOL> optiondb [ '<STR_LIT>' ] = self . __boundvar . get ( ) </s>
