[Python-checkins] python/dist/src/Tools/pynche PyncheWidget.py, 2.27, 2.28 StripViewer.py, 2.15, 2.16
Update of /cvsroot/python/python/dist/src/Tools/pynche In directory sc8-pr-cvs1:/tmp/cvs-serv25282/Tools/pynche Modified Files: PyncheWidget.py StripViewer.py Log Message: Patch #812378: Normalize white space. Index: PyncheWidget.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/pynche/PyncheWidget.py,v retrieving revision 2.27 retrieving revision 2.28 diff -C2 -d -r2.27 -r2.28 *** PyncheWidget.py 10 Jul 2001 21:43:43 -0000 2.27 --- PyncheWidget.py 24 Oct 2003 20:09:23 -0000 2.28 *************** *** 76,80 **** # helpmenu = Menu(menubar, name='help', tearoff=0) ! helpmenu.add_command(label='About Pynche...', command=self.__popup_about, underline=0) --- 76,80 ---- # helpmenu = Menu(menubar, name='help', tearoff=0) ! helpmenu.add_command(label='About Pynche...', command=self.__popup_about, underline=0) Index: StripViewer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/pynche/StripViewer.py,v retrieving revision 2.15 retrieving revision 2.16 diff -C2 -d -r2.15 -r2.16 *** StripViewer.py 10 Jul 2001 21:44:24 -0000 2.15 --- StripViewer.py 24 Oct 2003 20:09:23 -0000 2.16 *************** *** 36,40 **** foreach c $colors { $canv itemconfigure $i -fill $c -outline $c ! incr i } } --- 36,40 ---- foreach c $colors { $canv itemconfigure $i -fill $c -outline $c ! incr i } } *************** *** 55,61 **** seq = [] while numchips > 0: ! seq.append(int(start)) ! start = start + step ! numchips = numchips - 1 return seq --- 55,61 ---- seq = [] while numchips > 0: ! seq.append(int(start)) ! start = start + step ! numchips = numchips - 1 return seq *************** *** 100,133 **** def __init__(self, canvas, x): ! self._canvas = canvas ! self.__arrow, self.__text = self._create(x) ! self.move_to(x) def _create(self, x): ! arrow = self._canvas.create_line( ! x, self._ARROWHEIGHT + self._YOFFSET, ! x, self._YOFFSET, ! x + self._ARROWWIDTH, self._YOFFSET, ! arrow='first', ! width=3.0, ! tags=self._TAG) ! text = self._canvas.create_text( ! x + self._ARROWWIDTH + 13, ! self._ARROWHEIGHT - self._TEXTYOFFSET, ! tags=self._TAG, ! text='128') ! return arrow, text def _x(self): ! coords = self._canvas.coords(self._TAG) ! assert coords ! return coords[0] def move_to(self, x): ! deltax = x - self._x() ! self._canvas.move(self._TAG, deltax, 0) def set_text(self, text): ! self._canvas.itemconfigure(self.__text, text=text) --- 100,133 ---- def __init__(self, canvas, x): ! self._canvas = canvas ! self.__arrow, self.__text = self._create(x) ! self.move_to(x) def _create(self, x): ! arrow = self._canvas.create_line( ! x, self._ARROWHEIGHT + self._YOFFSET, ! x, self._YOFFSET, ! x + self._ARROWWIDTH, self._YOFFSET, ! arrow='first', ! width=3.0, ! tags=self._TAG) ! text = self._canvas.create_text( ! x + self._ARROWWIDTH + 13, ! self._ARROWHEIGHT - self._TEXTYOFFSET, ! tags=self._TAG, ! text='128') ! return arrow, text def _x(self): ! coords = self._canvas.coords(self._TAG) ! assert coords ! return coords[0] def move_to(self, x): ! deltax = x - self._x() ! self._canvas.move(self._TAG, deltax, 0) def set_text(self, text): ! self._canvas.itemconfigure(self.__text, text=text) *************** *** 136,158 **** def _create(self, x): ! arrow = self._canvas.create_line( ! x, self._YOFFSET, ! x + self._ARROWWIDTH, self._YOFFSET, ! x + self._ARROWWIDTH, self._ARROWHEIGHT + self._YOFFSET, ! arrow='last', ! width=3.0, ! tags=self._TAG) ! text = self._canvas.create_text( ! x - self._ARROWWIDTH + 15, # BAW: kludge ! self._ARROWHEIGHT - self._TEXTYOFFSET, justify=RIGHT, ! text='128', ! tags=self._TAG) ! return arrow, text def _x(self): ! coords = self._canvas.bbox(self._TAG) ! assert coords ! return coords[2] - 6 # BAW: kludge --- 136,158 ---- def _create(self, x): ! arrow = self._canvas.create_line( ! x, self._YOFFSET, ! x + self._ARROWWIDTH, self._YOFFSET, ! x + self._ARROWWIDTH, self._ARROWHEIGHT + self._YOFFSET, ! arrow='last', ! width=3.0, ! tags=self._TAG) ! text = self._canvas.create_text( ! x - self._ARROWWIDTH + 15, # BAW: kludge ! self._ARROWHEIGHT - self._TEXTYOFFSET, justify=RIGHT, ! text='128', ! tags=self._TAG) ! return arrow, text def _x(self): ! coords = self._canvas.bbox(self._TAG) ! assert coords ! return coords[2] - 6 # BAW: kludge *************** *** 174,182 **** hexvar = None): # instance variables ! self.__generator = generator ! self.__axis = axis self.__numchips = numchips ! assert self.__axis in (0, 1, 2) ! self.__uwd = uwdvar self.__hexp = hexvar # the last chip selected --- 174,182 ---- hexvar = None): # instance variables ! self.__generator = generator ! self.__axis = axis self.__numchips = numchips ! assert self.__axis in (0, 1, 2) ! self.__uwd = uwdvar self.__hexp = hexvar # the last chip selected *************** *** 184,192 **** self.__sb = switchboard ! canvaswidth = numchips * (chipwidth + 1) ! canvasheight = chipheight + 43 # BAW: Kludge ! # create the canvas and pack it ! canvas = self.__canvas = Canvas(master, width=canvaswidth, height=canvasheight, --- 184,192 ---- self.__sb = switchboard ! canvaswidth = numchips * (chipwidth + 1) ! canvasheight = chipheight + 43 # BAW: Kludge ! # create the canvas and pack it ! canvas = self.__canvas = Canvas(master, width=canvaswidth, height=canvasheight, *************** *** 195,239 **** ) ! canvas.pack() ! canvas.bind('<ButtonPress-1>', self.__select_chip) ! canvas.bind('<ButtonRelease-1>', self.__select_chip) ! canvas.bind('<B1-Motion>', self.__select_chip) ! # Load a proc into the Tcl interpreter. This is used in the ! # set_color() method to speed up setting the chip colors. ! canvas.tk.eval(TCLPROC) ! # create the color strip ! chips = self.__chips = [] ! x = 1 ! y = 30 ! tags = ('chip',) ! for c in range(self.__numchips): ! color = 'grey' ! canvas.create_rectangle( ! x, y, x+chipwidth, y+chipheight, ! fill=color, outline=color, ! tags=tags) ! x = x + chipwidth + 1 # for outline ! chips.append(color) ! # create the strip label ! self.__label = canvas.create_text( ! 3, y + chipheight + 8, ! text=label, ! anchor=W) ! # create the arrow and text item ! chipx = self.__arrow_x(0) ! self.__leftarrow = LeftArrow(canvas, chipx) ! chipx = self.__arrow_x(len(chips) - 1) ! self.__rightarrow = RightArrow(canvas, chipx) def __arrow_x(self, chipnum): ! coords = self.__canvas.coords(chipnum+1) ! assert coords ! x0, y0, x1, y1 = coords ! return (x1 + x0) / 2.0 # Invoked when one of the chips is clicked. This should just tell the --- 195,239 ---- ) ! canvas.pack() ! canvas.bind('<ButtonPress-1>', self.__select_chip) ! canvas.bind('<ButtonRelease-1>', self.__select_chip) ! canvas.bind('<B1-Motion>', self.__select_chip) ! # Load a proc into the Tcl interpreter. This is used in the ! # set_color() method to speed up setting the chip colors. ! canvas.tk.eval(TCLPROC) ! # create the color strip ! chips = self.__chips = [] ! x = 1 ! y = 30 ! tags = ('chip',) ! for c in range(self.__numchips): ! color = 'grey' ! canvas.create_rectangle( ! x, y, x+chipwidth, y+chipheight, ! fill=color, outline=color, ! tags=tags) ! x = x + chipwidth + 1 # for outline ! chips.append(color) ! # create the strip label ! self.__label = canvas.create_text( ! 3, y + chipheight + 8, ! text=label, ! anchor=W) ! # create the arrow and text item ! chipx = self.__arrow_x(0) ! self.__leftarrow = LeftArrow(canvas, chipx) ! chipx = self.__arrow_x(len(chips) - 1) ! self.__rightarrow = RightArrow(canvas, chipx) def __arrow_x(self, chipnum): ! coords = self.__canvas.coords(chipnum+1) ! assert coords ! x0, y0, x1, y1 = coords ! return (x1 + x0) / 2.0 # Invoked when one of the chips is clicked. This should just tell the *************** *** 261,266 **** self.__canvas.itemconfigure(self.__lastchip, outline=color) self.__lastchip = chip ! # get the arrow's text ! coloraxis = rgbtuple[self.__axis] if self.__hexp.get(): # hex --- 261,266 ---- self.__canvas.itemconfigure(self.__lastchip, outline=color) self.__lastchip = chip ! # get the arrow's text ! coloraxis = rgbtuple[self.__axis] if self.__hexp.get(): # hex *************** *** 269,298 **** # decimal text = repr(coloraxis) ! # move the arrow, and set it's text ! if coloraxis <= 128: ! # use the left arrow ! self.__leftarrow.set_text(text) ! self.__leftarrow.move_to(self.__arrow_x(chip-1)) ! self.__rightarrow.move_to(-100) ! else: ! # use the right arrow ! self.__rightarrow.set_text(text) ! self.__rightarrow.move_to(self.__arrow_x(chip-1)) ! self.__leftarrow.move_to(-100) ! # and set the chip's outline brightness = ColorDB.triplet_to_brightness(rgbtuple) ! if brightness <= 128: ! outline = 'white' ! else: ! outline = 'black' ! self.__canvas.itemconfigure(chip, outline=outline) def update_yourself(self, red, green, blue): ! assert self.__generator ! i = 1 ! chip = 0 ! chips = self.__chips = [] ! tk = self.__canvas.tk # get the red, green, and blue components for all chips for t in self.__generator(self.__numchips, red, green, blue): --- 269,298 ---- # decimal text = repr(coloraxis) ! # move the arrow, and set it's text ! if coloraxis <= 128: ! # use the left arrow ! self.__leftarrow.set_text(text) ! self.__leftarrow.move_to(self.__arrow_x(chip-1)) ! self.__rightarrow.move_to(-100) ! else: ! # use the right arrow ! self.__rightarrow.set_text(text) ! self.__rightarrow.move_to(self.__arrow_x(chip-1)) ! self.__leftarrow.move_to(-100) ! # and set the chip's outline brightness = ColorDB.triplet_to_brightness(rgbtuple) ! if brightness <= 128: ! outline = 'white' ! else: ! outline = 'black' ! self.__canvas.itemconfigure(chip, outline=outline) def update_yourself(self, red, green, blue): ! assert self.__generator ! i = 1 ! chip = 0 ! chips = self.__chips = [] ! tk = self.__canvas.tk # get the red, green, and blue components for all chips for t in self.__generator(self.__numchips, red, green, blue):
participants (1)
-
loewis@users.sourceforge.net