Back to index

python3.2  3.2.2
Classes | Functions | Variables
pynche.ListViewer Namespace Reference


class  ListViewer


def __toggleupdate
 print 'No color tag found!'
def __quit
def withdraw
def deiconify
def update_yourself
def save_options
def colordb_changed


string ADDTOVIEW = 'Color %List Window...'
tuple tags = self.__canvas.gettags(boxid)
 print 'No box found!'

Detailed Description

ListViewer class.

This class implements an input/output view on the color model.  It lists every
unique color (e.g. unique r/g/b value) found in the color database.  Each
color is shown by small swatch and primary color name.  Some colors have
aliases -- more than one name for the same r/g/b value.  These aliases are
displayed in the small listbox at the bottom of the screen.

Clicking on a color name or swatch selects that color and updates all other
windows.  When a color is selected in a different viewer, the color list is
scrolled to the selected color and it is highlighted.  If the selected color
is an r/g/b value without a name, no scrolling occurs.

You can turn off Update On Click if all you want to see is the alias for a
given name, without selecting the color.

Function Documentation

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

Definition at line 131 of file

00132     def __quit(self, event=None):
00133         self.__root.quit()

def pynche.ListViewer.__toggleupdate (   self,
  event = None 
) [private]

print 'No color tag found!'

Definition at line 127 of file

00128     def __toggleupdate(self, event=None):
00129         if self.__uoc.get():
00130             self.__sb.update_views(self.__red, self.__green, self.__blue)

def pynche.ListViewer.colordb_changed (   self,

Definition at line 173 of file

00174     def colordb_changed(self, colordb):
00175         self.__canvas.delete('all')
00176         self.__populate()
def pynche.ListViewer.deiconify (   self,
  event = None 

Definition at line 137 of file

00138     def deiconify(self, event=None):
00139         self.__root.deiconify()

def pynche.ListViewer.save_options (   self,

Definition at line 170 of file

00171     def save_options(self, optiondb):
00172         optiondb['UPONCLICK'] = self.__uoc.get()

def pynche.ListViewer.update_yourself (   self,

Definition at line 140 of file

00141     def update_yourself(self, red, green, blue):
00142         canvas = self.__canvas
00143         # turn off the last box
00144         if self.__lastbox:
00145             canvas.itemconfigure(self.__lastbox, outline='')
00146         # turn on the current box
00147         colortag = ColorDB.triplet_to_rrggbb((red, green, blue))
00148         canvas.itemconfigure(colortag, outline='black')
00149         self.__lastbox = colortag
00150         # fill the aliases
00151         self.__aliases.delete(0, END)
00152         try:
00153             aliases = self.__sb.colordb().aliases_of(red, green, blue)[1:]
00154         except ColorDB.BadColor:
00155             self.__aliases.insert(END, '<no matching color>')
00156             return
00157         if not aliases:
00158             self.__aliases.insert(END, '<no aliases>')
00159         else:
00160             for name in aliases:
00161                 self.__aliases.insert(END, name)
00162         # maybe scroll the canvas so that the item is visible
00163         if self.__dontcenter:
00164             self.__dontcenter = 0
00165         else:
00166             ig, ig, ig, y1 = canvas.coords(colortag)
00167             ig, ig, ig, y2 = canvas.coords(self.__bboxes[-1])
00168             h = int(canvas['height']) * 0.5
00169             canvas.yview('moveto', (y1-h) / y2)

def pynche.ListViewer.withdraw (   self,
  event = None 

Definition at line 134 of file

00135     def withdraw(self, event=None):
00136         self.__root.withdraw()

Variable Documentation

Definition at line 163 of file

Definition at line 148 of file

string pynche.ListViewer.ADDTOVIEW = 'Color %List Window...'

Definition at line 21 of file

tuple pynche.ListViewer.tags = self.__canvas.gettags(boxid)

print 'No box found!'

Definition at line 112 of file