Back to index

python3.2  3.2.2
Public Member Functions | Private Member Functions | Private Attributes
pynche.DetailsViewer.DetailsViewer Class Reference

List of all members.

Public Member Functions

def __init__
def withdraw
def deiconify
def update_yourself
def save_options

Private Member Functions

def __effect
def __quit
def __minus25
def __minus10
def __minus1
def __plus1
def __plus10
def __plus25
def __delta

Private Attributes

 __sb
 __blue
 __root
 __frame
 __l1
 __rvar
 __radio1
 __gvar
 __radio2
 __bvar
 __radio3
 __l2
 __l3
 __boundvar
 __omenu
 __btnframe
 __down25
 __down10
 __down1
 __up1
 __up10
 __up25
 __red
 __green

Detailed Description

Definition at line 65 of file DetailsViewer.py.


Constructor & Destructor Documentation

def pynche.DetailsViewer.DetailsViewer.__init__ (   self,
  switchboard,
  master = None 
)

Definition at line 66 of file DetailsViewer.py.

00066 
00067     def __init__(self, switchboard, master=None):
00068         self.__sb = switchboard
00069         optiondb = switchboard.optiondb()
00070         self.__red, self.__green, self.__blue = switchboard.current_rgb()
00071         # GUI
00072         root = self.__root = Toplevel(master, class_='Pynche')
00073         root.protocol('WM_DELETE_WINDOW', self.withdraw)
00074         root.title('Pynche Details Window')
00075         root.iconname('Pynche Details Window')
00076         root.bind('<Alt-q>', self.__quit)
00077         root.bind('<Alt-Q>', self.__quit)
00078         root.bind('<Alt-w>', self.withdraw)
00079         root.bind('<Alt-W>', self.withdraw)
00080         # accelerators
00081         root.bind('<KeyPress-Left>', self.__minus1)
00082         root.bind('<KeyPress-Right>', self.__plus1)
00083         root.bind('<Control-KeyPress-Left>', self.__minus10)
00084         root.bind('<Control-KeyPress-Right>', self.__plus10)
00085         root.bind('<Shift-KeyPress-Left>', self.__minus25)
00086         root.bind('<Shift-KeyPress-Right>', self.__plus25)
00087         #
00088         # color ties
00089         frame = self.__frame = Frame(root)
00090         frame.pack(expand=YES, fill=X)
00091         self.__l1 = Label(frame, text='Move Sliders:')
00092         self.__l1.grid(row=1, column=0, sticky=E)
00093         self.__rvar = IntVar()
00094         self.__rvar.set(optiondb.get('RSLIDER', 4))
00095         self.__radio1 = Checkbutton(frame, text='Red',
00096                                     variable=self.__rvar,
00097                                     command=self.__effect,
00098                                     onvalue=4, offvalue=0)
00099         self.__radio1.grid(row=1, column=1, sticky=W)
00100         self.__gvar = IntVar()
00101         self.__gvar.set(optiondb.get('GSLIDER', 2))
00102         self.__radio2 = Checkbutton(frame, text='Green',
00103                                     variable=self.__gvar,
00104                                     command=self.__effect,
00105                                     onvalue=2, offvalue=0)
00106         self.__radio2.grid(row=2, column=1, sticky=W)
00107         self.__bvar = IntVar()
00108         self.__bvar.set(optiondb.get('BSLIDER', 1))
00109         self.__radio3 = Checkbutton(frame, text='Blue',
00110                                     variable=self.__bvar,
00111                                     command=self.__effect,
00112                                     onvalue=1, offvalue=0)
00113         self.__radio3.grid(row=3, column=1, sticky=W)
00114         self.__l2 = Label(frame)
00115         self.__l2.grid(row=4, column=1, sticky=W)
00116         self.__effect()
00117         #
00118         # Boundary behavior
00119         self.__l3 = Label(frame, text='At boundary:')
00120         self.__l3.grid(row=5, column=0, sticky=E)
00121         self.__boundvar = StringVar()
00122         self.__boundvar.set(optiondb.get('ATBOUND', STOP))
00123         self.__omenu = OptionMenu(frame, self.__boundvar,
00124                                   STOP, WRAP, RATIO, GRAV)
00125         self.__omenu.grid(row=5, column=1, sticky=W)
00126         self.__omenu.configure(width=17)
00127         #
00128         # Buttons
00129         frame = self.__btnframe = Frame(frame)
00130         frame.grid(row=0, column=0, columnspan=2, sticky='EW')
00131         self.__down25 = Button(frame, text='-25',
00132                                command=self.__minus25)
00133         self.__down10 = Button(frame, text='-10',
00134                                command=self.__minus10)
00135         self.__down1 = Button(frame, text='-1',
00136                               command=self.__minus1)
00137         self.__up1 = Button(frame, text='+1',
00138                             command=self.__plus1)
00139         self.__up10 = Button(frame, text='+10',
00140                              command=self.__plus10)
00141         self.__up25 = Button(frame, text='+25',
00142                              command=self.__plus25)
00143         self.__down25.pack(expand=YES, fill=X, side=LEFT)
00144         self.__down10.pack(expand=YES, fill=X, side=LEFT)
00145         self.__down1.pack(expand=YES, fill=X, side=LEFT)
00146         self.__up1.pack(expand=YES, fill=X, side=LEFT)
00147         self.__up10.pack(expand=YES, fill=X, side=LEFT)
00148         self.__up25.pack(expand=YES, fill=X, side=LEFT)

Here is the caller graph for this function:


Member Function Documentation

def pynche.DetailsViewer.DetailsViewer.__delta (   self,
  delta 
) [private]

Definition at line 187 of file DetailsViewer.py.

00187 
00188     def __delta(self, delta):
00189         tie = []
00190         if self.__rvar.get():
00191             red = self.__red + delta
00192             tie.append(red)
00193         else:
00194             red = self.__red
00195         if self.__gvar.get():
00196             green = self.__green + delta
00197             tie.append(green)
00198         else:
00199             green = self.__green
00200         if self.__bvar.get():
00201             blue = self.__blue + delta
00202             tie.append(blue)
00203         else:
00204             blue = self.__blue
00205         # now apply at boundary behavior
00206         atbound = self.__boundvar.get()
00207         if atbound == STOP:
00208             if red < 0 or green < 0 or blue < 0 or \
00209                red > 255 or green > 255 or blue > 255:
00210                 # then
00211                 red, green, blue = self.__red, self.__green, self.__blue
00212         elif atbound == WRAP or (atbound == RATIO and len(tie) < 2):
00213             if red < 0:
00214                 red += 256
00215             if green < 0:
00216                 green += 256
00217             if blue < 0:
00218                 blue += 256
00219             if red > 255:
00220                 red -= 256
00221             if green > 255:
00222                 green -= 256
00223             if blue > 255:
00224                 blue -= 256
00225         elif atbound == RATIO:
00226             # for when 2 or 3 colors are tied together
00227             dir = 0
00228             for c in tie:
00229                 if c < 0:
00230                     dir = -1
00231                 elif c > 255:
00232                     dir = 1
00233             if dir == -1:
00234                 delta = max(tie)
00235                 if self.__rvar.get():
00236                     red = red + 255 - delta
00237                 if self.__gvar.get():
00238                     green = green + 255 - delta
00239                 if self.__bvar.get():
00240                     blue = blue + 255 - delta
00241             elif dir == 1:
00242                 delta = min(tie)
00243                 if self.__rvar.get():
00244                     red = red - delta
00245                 if self.__gvar.get():
00246                     green = green - delta
00247                 if self.__bvar.get():
00248                     blue = blue - delta
00249         elif atbound == GRAV:
00250             if red < 0:
00251                 red = 0
00252             if green < 0:
00253                 green = 0
00254             if blue < 0:
00255                 blue = 0
00256             if red > 255:
00257                 red = 255
00258             if green > 255:
00259                 green = 255
00260             if blue > 255:
00261                 blue = 255
00262         self.__sb.update_views(red, green, blue)
00263         self.__root.update_idletasks()

Here is the caller graph for this function:

def pynche.DetailsViewer.DetailsViewer.__effect (   self,
  event = None 
) [private]

Definition at line 149 of file DetailsViewer.py.

00149 
00150     def __effect(self, event=None):
00151         tie = self.__rvar.get() + self.__gvar.get() + self.__bvar.get()
00152         if tie in (0, 1, 2, 4):
00153             text = ''
00154         else:
00155             text = '(= %s Level)' % {3: 'Cyan',
00156                                      5: 'Magenta',
00157                                      6: 'Yellow',
00158                                      7: 'Grey'}[tie]
00159         self.__l2.configure(text=text)

def pynche.DetailsViewer.DetailsViewer.__minus1 (   self,
  event = None 
) [private]

Definition at line 175 of file DetailsViewer.py.

00175 
00176     def __minus1(self, event=None):
00177         self.__delta(-1)

Here is the call graph for this function:

def pynche.DetailsViewer.DetailsViewer.__minus10 (   self,
  event = None 
) [private]

Definition at line 172 of file DetailsViewer.py.

00172 
00173     def __minus10(self, event=None):
00174         self.__delta(-10)

Here is the call graph for this function:

def pynche.DetailsViewer.DetailsViewer.__minus25 (   self,
  event = None 
) [private]

Definition at line 169 of file DetailsViewer.py.

00169 
00170     def __minus25(self, event=None):
00171         self.__delta(-25)

Here is the call graph for this function:

def pynche.DetailsViewer.DetailsViewer.__plus1 (   self,
  event = None 
) [private]

Definition at line 178 of file DetailsViewer.py.

00178 
00179     def __plus1(self, event=None):
00180         self.__delta(1)

Here is the call graph for this function:

def pynche.DetailsViewer.DetailsViewer.__plus10 (   self,
  event = None 
) [private]

Definition at line 181 of file DetailsViewer.py.

00181 
00182     def __plus10(self, event=None):
00183         self.__delta(10)

Here is the call graph for this function:

def pynche.DetailsViewer.DetailsViewer.__plus25 (   self,
  event = None 
) [private]

Definition at line 184 of file DetailsViewer.py.

00184 
00185     def __plus25(self, event=None):
00186         self.__delta(25)

Here is the call graph for this function:

def pynche.DetailsViewer.DetailsViewer.__quit (   self,
  event = None 
) [private]

Definition at line 160 of file DetailsViewer.py.

00160 
00161     def __quit(self, event=None):
00162         self.__root.quit()

Here is the caller graph for this function:

def pynche.DetailsViewer.DetailsViewer.deiconify (   self,
  event = None 
)

Definition at line 166 of file DetailsViewer.py.

00166 
00167     def deiconify(self, event=None):
00168         self.__root.deiconify()

def pynche.DetailsViewer.DetailsViewer.save_options (   self,
  optiondb 
)

Definition at line 269 of file DetailsViewer.py.

00269 
00270     def save_options(self, optiondb):
00271         optiondb['RSLIDER'] = self.__rvar.get()
00272         optiondb['GSLIDER'] = self.__gvar.get()
00273         optiondb['BSLIDER'] = self.__bvar.get()
00274         optiondb['ATBOUND'] = self.__boundvar.get()
def pynche.DetailsViewer.DetailsViewer.update_yourself (   self,
  red,
  green,
  blue 
)

Definition at line 264 of file DetailsViewer.py.

00264 
00265     def update_yourself(self, red, green, blue):
00266         self.__red = red
00267         self.__green = green
00268         self.__blue = blue

Here is the caller graph for this function:

def pynche.DetailsViewer.DetailsViewer.withdraw (   self,
  event = None 
)

Definition at line 163 of file DetailsViewer.py.

00163 
00164     def withdraw(self, event=None):
00165         self.__root.withdraw()


Member Data Documentation

Definition at line 69 of file DetailsViewer.py.

Definition at line 120 of file DetailsViewer.py.

Definition at line 128 of file DetailsViewer.py.

Definition at line 106 of file DetailsViewer.py.

Definition at line 134 of file DetailsViewer.py.

Definition at line 132 of file DetailsViewer.py.

Definition at line 130 of file DetailsViewer.py.

Definition at line 88 of file DetailsViewer.py.

Definition at line 266 of file DetailsViewer.py.

Definition at line 99 of file DetailsViewer.py.

Definition at line 90 of file DetailsViewer.py.

Definition at line 113 of file DetailsViewer.py.

Definition at line 118 of file DetailsViewer.py.

Definition at line 122 of file DetailsViewer.py.

Definition at line 94 of file DetailsViewer.py.

Definition at line 101 of file DetailsViewer.py.

Definition at line 108 of file DetailsViewer.py.

Definition at line 265 of file DetailsViewer.py.

Definition at line 71 of file DetailsViewer.py.

Definition at line 92 of file DetailsViewer.py.

Definition at line 67 of file DetailsViewer.py.

Definition at line 136 of file DetailsViewer.py.

Definition at line 138 of file DetailsViewer.py.

Definition at line 140 of file DetailsViewer.py.


The documentation for this class was generated from the following file: