mirror of
https://github.com/python/cpython.git
synced 2025-07-22 10:45:22 +00:00
Patch #812378: Normalize white space.
This commit is contained in:
parent
f8d59d28e0
commit
23b44a39ce
10 changed files with 203 additions and 204 deletions
|
@ -70,9 +70,9 @@ def get_python_inc(plat_specific=0, prefix=None):
|
||||||
return os.path.join(prefix, "include")
|
return os.path.join(prefix, "include")
|
||||||
elif os.name == "mac":
|
elif os.name == "mac":
|
||||||
if plat_specific:
|
if plat_specific:
|
||||||
return os.path.join(prefix, "Mac", "Include")
|
return os.path.join(prefix, "Mac", "Include")
|
||||||
else:
|
else:
|
||||||
return os.path.join(prefix, "Include")
|
return os.path.join(prefix, "Include")
|
||||||
elif os.name == "os2":
|
elif os.name == "os2":
|
||||||
return os.path.join(prefix, "Include")
|
return os.path.join(prefix, "Include")
|
||||||
else:
|
else:
|
||||||
|
@ -160,7 +160,7 @@ def customize_compiler(compiler):
|
||||||
if os.environ.has_key('LDFLAGS'):
|
if os.environ.has_key('LDFLAGS'):
|
||||||
ldshared = ldshared + ' ' + os.environ['LDFLAGS']
|
ldshared = ldshared + ' ' + os.environ['LDFLAGS']
|
||||||
if basecflags:
|
if basecflags:
|
||||||
opt = basecflags + ' ' + opt
|
opt = basecflags + ' ' + opt
|
||||||
if os.environ.has_key('CFLAGS'):
|
if os.environ.has_key('CFLAGS'):
|
||||||
opt = opt + ' ' + os.environ['CFLAGS']
|
opt = opt + ' ' + os.environ['CFLAGS']
|
||||||
ldshared = ldshared + ' ' + os.environ['CFLAGS']
|
ldshared = ldshared + ' ' + os.environ['CFLAGS']
|
||||||
|
|
|
@ -15,20 +15,20 @@ SECTION_TITLES = {
|
||||||
|
|
||||||
# Parameters you definitely want to change
|
# Parameters you definitely want to change
|
||||||
|
|
||||||
SHORTNAME = "Generic" # FAQ name with "FAQ" omitted
|
SHORTNAME = "Generic" # FAQ name with "FAQ" omitted
|
||||||
PASSWORD = "" # Password for editing
|
PASSWORD = "" # Password for editing
|
||||||
OWNERNAME = "FAQ owner" # Name for feedback
|
OWNERNAME = "FAQ owner" # Name for feedback
|
||||||
OWNEREMAIL = "nobody@anywhere.org" # Email for feedback
|
OWNEREMAIL = "nobody@anywhere.org" # Email for feedback
|
||||||
HOMEURL = "http://www.python.org" # Related home page
|
HOMEURL = "http://www.python.org" # Related home page
|
||||||
HOMENAME = "Python home" # Name of related home page
|
HOMENAME = "Python home" # Name of related home page
|
||||||
RCSBINDIR = "/usr/local/bin/" # Directory containing RCS commands
|
RCSBINDIR = "/usr/local/bin/" # Directory containing RCS commands
|
||||||
# (must end in a slash)
|
# (must end in a slash)
|
||||||
|
|
||||||
# Parameters you can normally leave alone
|
# Parameters you can normally leave alone
|
||||||
|
|
||||||
MAXHITS = 10 # Max #hits to be shown directly
|
MAXHITS = 10 # Max #hits to be shown directly
|
||||||
COOKIE_LIFETIME = 28*24*3600 # Cookie expiration in seconds
|
COOKIE_LIFETIME = 28*24*3600 # Cookie expiration in seconds
|
||||||
# (28*24*3600 = 28 days = 4 weeks)
|
# (28*24*3600 = 28 days = 4 weeks)
|
||||||
PROCESS_PREFORMAT = 1 # toggle whether preformatted text
|
PROCESS_PREFORMAT = 1 # toggle whether preformatted text
|
||||||
# will replace urls and emails with
|
# will replace urls and emails with
|
||||||
# HTML links
|
# HTML links
|
||||||
|
@ -36,10 +36,10 @@ PROCESS_PREFORMAT = 1 # toggle whether preformatted text
|
||||||
# Markers appended to title to indicate recently change
|
# Markers appended to title to indicate recently change
|
||||||
# (may contain HTML, e.g. <IMG>); and corresponding
|
# (may contain HTML, e.g. <IMG>); and corresponding
|
||||||
|
|
||||||
MARK_VERY_RECENT = " **" # Changed very recently
|
MARK_VERY_RECENT = " **" # Changed very recently
|
||||||
MARK_RECENT = " *" # Changed recently
|
MARK_RECENT = " *" # Changed recently
|
||||||
DT_VERY_RECENT = 24*3600 # 24 hours
|
DT_VERY_RECENT = 24*3600 # 24 hours
|
||||||
DT_RECENT = 7*24*3600 # 7 days
|
DT_RECENT = 7*24*3600 # 7 days
|
||||||
|
|
||||||
EXPLAIN_MARKS = """
|
EXPLAIN_MARKS = """
|
||||||
<P>(Entries marked with ** were changed within the last 24 hours;
|
<P>(Entries marked with ** were changed within the last 24 hours;
|
||||||
|
@ -49,18 +49,18 @@ entries marked with * were changed within the last 7 days.)
|
||||||
|
|
||||||
# Version -- don't change unless you edit faqwiz.py
|
# Version -- don't change unless you edit faqwiz.py
|
||||||
|
|
||||||
WIZVERSION = "1.0.4" # FAQ Wizard version
|
WIZVERSION = "1.0.4" # FAQ Wizard version
|
||||||
|
|
||||||
import os, sys
|
import os, sys
|
||||||
if os.name in ['nt',]:
|
if os.name in ['nt',]:
|
||||||
# On NT we'll probably be running python from a batch file,
|
# On NT we'll probably be running python from a batch file,
|
||||||
# so sys.argv[0] is not helpful
|
# so sys.argv[0] is not helpful
|
||||||
FAQCGI = 'faq.bat' # Relative URL of the FAQ cgi script
|
FAQCGI = 'faq.bat' # Relative URL of the FAQ cgi script
|
||||||
# LOGNAME is not typically set on NT
|
# LOGNAME is not typically set on NT
|
||||||
os.environ[ 'LOGNAME' ] = "FAQWizard"
|
os.environ[ 'LOGNAME' ] = "FAQWizard"
|
||||||
else:
|
else:
|
||||||
# This parameter is normally overwritten with a dynamic value
|
# This parameter is normally overwritten with a dynamic value
|
||||||
FAQCGI = 'faqw.py' # Relative URL of the FAQ cgi script
|
FAQCGI = 'faqw.py' # Relative URL of the FAQ cgi script
|
||||||
FAQCGI = os.path.basename(sys.argv[0]) or FAQCGI
|
FAQCGI = os.path.basename(sys.argv[0]) or FAQCGI
|
||||||
del os, sys
|
del os, sys
|
||||||
|
|
||||||
|
@ -84,8 +84,8 @@ except ImportError:
|
||||||
|
|
||||||
# Calculated parameter names
|
# Calculated parameter names
|
||||||
|
|
||||||
COOKIE_NAME = SHORTNAME + "-FAQ-Wizard" # Name used for Netscape cookie
|
COOKIE_NAME = SHORTNAME + "-FAQ-Wizard" # Name used for Netscape cookie
|
||||||
FAQNAME = SHORTNAME + " FAQ" # Name of the FAQ
|
FAQNAME = SHORTNAME + " FAQ" # Name of the FAQ
|
||||||
|
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -175,22 +175,22 @@ HOME = """
|
||||||
<INPUT TYPE=submit VALUE="Search"><BR>
|
<INPUT TYPE=submit VALUE="Search"><BR>
|
||||||
<INPUT TYPE=radio NAME=querytype VALUE=simple CHECKED>
|
<INPUT TYPE=radio NAME=querytype VALUE=simple CHECKED>
|
||||||
Simple string
|
Simple string
|
||||||
/
|
/
|
||||||
<INPUT TYPE=radio NAME=querytype VALUE=regex>
|
<INPUT TYPE=radio NAME=querytype VALUE=regex>
|
||||||
Regular expression
|
Regular expression
|
||||||
/<BR>
|
/<BR>
|
||||||
<INPUT TYPE=radio NAME=querytype VALUE=anykeywords>
|
<INPUT TYPE=radio NAME=querytype VALUE=anykeywords>
|
||||||
Keywords (any)
|
Keywords (any)
|
||||||
/
|
/
|
||||||
<INPUT TYPE=radio NAME=querytype VALUE=allkeywords>
|
<INPUT TYPE=radio NAME=querytype VALUE=allkeywords>
|
||||||
Keywords (all)
|
Keywords (all)
|
||||||
<BR>
|
<BR>
|
||||||
<INPUT TYPE=radio NAME=casefold VALUE=yes CHECKED>
|
<INPUT TYPE=radio NAME=casefold VALUE=yes CHECKED>
|
||||||
Fold case
|
Fold case
|
||||||
/
|
/
|
||||||
<INPUT TYPE=radio NAME=casefold VALUE=no>
|
<INPUT TYPE=radio NAME=casefold VALUE=no>
|
||||||
Case sensitive
|
Case sensitive
|
||||||
<BR>
|
<BR>
|
||||||
<INPUT TYPE=hidden NAME=req VALUE=search>
|
<INPUT TYPE=hidden NAME=req VALUE=search>
|
||||||
</FORM>
|
</FORM>
|
||||||
|
|
||||||
|
@ -362,14 +362,14 @@ Log message (reason for the change):<BR>
|
||||||
Please provide the following information for logging purposes:
|
Please provide the following information for logging purposes:
|
||||||
<TABLE FRAME=none COLS=2>
|
<TABLE FRAME=none COLS=2>
|
||||||
<TR>
|
<TR>
|
||||||
<TD>Name:
|
<TD>Name:
|
||||||
<TD><INPUT TYPE=text SIZE=40 NAME=author VALUE="%(author)s">
|
<TD><INPUT TYPE=text SIZE=40 NAME=author VALUE="%(author)s">
|
||||||
<TR>
|
<TR>
|
||||||
<TD>Email:
|
<TD>Email:
|
||||||
<TD><INPUT TYPE=text SIZE=40 NAME=email VALUE="%(email)s">
|
<TD><INPUT TYPE=text SIZE=40 NAME=email VALUE="%(email)s">
|
||||||
<TR>
|
<TR>
|
||||||
<TD>Password:
|
<TD>Password:
|
||||||
<TD><INPUT TYPE=password SIZE=20 NAME=password VALUE="%(password)s">
|
<TD><INPUT TYPE=password SIZE=20 NAME=password VALUE="%(password)s">
|
||||||
</TABLE>
|
</TABLE>
|
||||||
|
|
||||||
<INPUT TYPE=submit NAME=review VALUE="Preview Edit">
|
<INPUT TYPE=submit NAME=review VALUE="Preview Edit">
|
||||||
|
|
|
@ -19,14 +19,14 @@ methoddef_start = """\
|
||||||
static struct PyMethodDef %(MethodDefName)s[] = {"""
|
static struct PyMethodDef %(MethodDefName)s[] = {"""
|
||||||
|
|
||||||
methoddef_def = """\
|
methoddef_def = """\
|
||||||
{"%(PythonName)s", (PyCFunction)%(CName)s, %(MethType)s},"""
|
{"%(PythonName)s", (PyCFunction)%(CName)s, %(MethType)s},"""
|
||||||
|
|
||||||
methoddef_def_doc = """\
|
methoddef_def_doc = """\
|
||||||
{"%(PythonName)s", (PyCFunction)%(CName)s, %(MethType)s,
|
{"%(PythonName)s", (PyCFunction)%(CName)s, %(MethType)s,
|
||||||
%(DocstringVar)s},"""
|
%(DocstringVar)s},"""
|
||||||
|
|
||||||
methoddef_end = """\
|
methoddef_end = """\
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ memberdef_def = """\
|
||||||
{"%(PythonName)s", %(Type)s, OFF(%(CName)s), %(Flags)s},"""
|
{"%(PythonName)s", %(Type)s, OFF(%(CName)s), %(Flags)s},"""
|
||||||
|
|
||||||
memberdef_end = """\
|
memberdef_end = """\
|
||||||
{NULL}
|
{NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef OFF
|
#undef OFF
|
||||||
|
|
|
@ -34,7 +34,7 @@ o3.name = 'over-the-top object'
|
||||||
o3.abbrev = 'ot'
|
o3.abbrev = 'ot'
|
||||||
o3.methodlist = ['method1', 'method2']
|
o3.methodlist = ['method1', 'method2']
|
||||||
o3.funclist = ['new', 'tp_dealloc', 'tp_print', 'tp_getattr', 'tp_setattr',
|
o3.funclist = ['new', 'tp_dealloc', 'tp_print', 'tp_getattr', 'tp_setattr',
|
||||||
'tp_compare', 'tp_repr', 'tp_hash']
|
'tp_compare', 'tp_repr', 'tp_hash']
|
||||||
o3.typelist = ['tp_as_sequence', 'structure']
|
o3.typelist = ['tp_as_sequence', 'structure']
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -14,24 +14,24 @@ from Tkinter import *
|
||||||
from Tkinter import _cnfmerge
|
from Tkinter import _cnfmerge
|
||||||
|
|
||||||
class ScrolledListbox(Listbox):
|
class ScrolledListbox(Listbox):
|
||||||
def __init__(self, master=None, cnf={}):
|
def __init__(self, master=None, cnf={}):
|
||||||
cnf = _cnfmerge(cnf)
|
cnf = _cnfmerge(cnf)
|
||||||
fcnf = {}
|
fcnf = {}
|
||||||
vcnf = {'name': 'vbar',
|
vcnf = {'name': 'vbar',
|
||||||
Pack: {'side': 'right', 'fill': 'y'},}
|
Pack: {'side': 'right', 'fill': 'y'},}
|
||||||
for k in cnf.keys():
|
for k in cnf.keys():
|
||||||
if type(k) == ClassType or k == 'name':
|
if type(k) == ClassType or k == 'name':
|
||||||
fcnf[k] = cnf[k]
|
fcnf[k] = cnf[k]
|
||||||
del cnf[k]
|
del cnf[k]
|
||||||
self.frame = Frame(master, fcnf)
|
self.frame = Frame(master, fcnf)
|
||||||
self.vbar = Scrollbar(self.frame, vcnf)
|
self.vbar = Scrollbar(self.frame, vcnf)
|
||||||
cnf[Pack] = {'side': 'left', 'fill': 'both', 'expand': 'yes'}
|
cnf[Pack] = {'side': 'left', 'fill': 'both', 'expand': 'yes'}
|
||||||
cnf['name'] = 'list'
|
cnf['name'] = 'list'
|
||||||
Listbox.__init__(self, self.frame, cnf)
|
Listbox.__init__(self, self.frame, cnf)
|
||||||
self['yscrollcommand'] = (self.vbar, 'set')
|
self['yscrollcommand'] = (self.vbar, 'set')
|
||||||
self.vbar['command'] = (self, 'yview')
|
self.vbar['command'] = (self, 'yview')
|
||||||
|
|
||||||
# Copy Pack methods of self.frame -- hack!
|
# Copy Pack methods of self.frame -- hack!
|
||||||
for m in Pack.__dict__.keys():
|
for m in Pack.__dict__.keys():
|
||||||
if m[0] != '_' and m != 'config':
|
if m[0] != '_' and m != 'config':
|
||||||
setattr(self, m, getattr(self.frame, m))
|
setattr(self, m, getattr(self.frame, m))
|
||||||
|
|
|
@ -75,7 +75,7 @@ class PyncheWidget:
|
||||||
# Help menu
|
# Help menu
|
||||||
#
|
#
|
||||||
helpmenu = Menu(menubar, name='help', tearoff=0)
|
helpmenu = Menu(menubar, name='help', tearoff=0)
|
||||||
helpmenu.add_command(label='About Pynche...',
|
helpmenu.add_command(label='About Pynche...',
|
||||||
command=self.__popup_about,
|
command=self.__popup_about,
|
||||||
underline=0)
|
underline=0)
|
||||||
helpmenu.add_command(label='Help...',
|
helpmenu.add_command(label='Help...',
|
||||||
|
|
|
@ -35,7 +35,7 @@ proc setcolor {canv colors} {
|
||||||
set i 1
|
set i 1
|
||||||
foreach c $colors {
|
foreach c $colors {
|
||||||
$canv itemconfigure $i -fill $c -outline $c
|
$canv itemconfigure $i -fill $c -outline $c
|
||||||
incr i
|
incr i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
|
@ -54,9 +54,9 @@ def constant(numchips):
|
||||||
start = 0.0
|
start = 0.0
|
||||||
seq = []
|
seq = []
|
||||||
while numchips > 0:
|
while numchips > 0:
|
||||||
seq.append(int(start))
|
seq.append(int(start))
|
||||||
start = start + step
|
start = start + step
|
||||||
numchips = numchips - 1
|
numchips = numchips - 1
|
||||||
return seq
|
return seq
|
||||||
|
|
||||||
# red variations, green+blue = cyan constant
|
# red variations, green+blue = cyan constant
|
||||||
|
@ -99,61 +99,61 @@ class LeftArrow:
|
||||||
_TAG = ('leftarrow',)
|
_TAG = ('leftarrow',)
|
||||||
|
|
||||||
def __init__(self, canvas, x):
|
def __init__(self, canvas, x):
|
||||||
self._canvas = canvas
|
self._canvas = canvas
|
||||||
self.__arrow, self.__text = self._create(x)
|
self.__arrow, self.__text = self._create(x)
|
||||||
self.move_to(x)
|
self.move_to(x)
|
||||||
|
|
||||||
def _create(self, x):
|
def _create(self, x):
|
||||||
arrow = self._canvas.create_line(
|
arrow = self._canvas.create_line(
|
||||||
x, self._ARROWHEIGHT + self._YOFFSET,
|
x, self._ARROWHEIGHT + self._YOFFSET,
|
||||||
x, self._YOFFSET,
|
x, self._YOFFSET,
|
||||||
x + self._ARROWWIDTH, self._YOFFSET,
|
x + self._ARROWWIDTH, self._YOFFSET,
|
||||||
arrow='first',
|
arrow='first',
|
||||||
width=3.0,
|
width=3.0,
|
||||||
tags=self._TAG)
|
tags=self._TAG)
|
||||||
text = self._canvas.create_text(
|
text = self._canvas.create_text(
|
||||||
x + self._ARROWWIDTH + 13,
|
x + self._ARROWWIDTH + 13,
|
||||||
self._ARROWHEIGHT - self._TEXTYOFFSET,
|
self._ARROWHEIGHT - self._TEXTYOFFSET,
|
||||||
tags=self._TAG,
|
tags=self._TAG,
|
||||||
text='128')
|
text='128')
|
||||||
return arrow, text
|
return arrow, text
|
||||||
|
|
||||||
def _x(self):
|
def _x(self):
|
||||||
coords = self._canvas.coords(self._TAG)
|
coords = self._canvas.coords(self._TAG)
|
||||||
assert coords
|
assert coords
|
||||||
return coords[0]
|
return coords[0]
|
||||||
|
|
||||||
def move_to(self, x):
|
def move_to(self, x):
|
||||||
deltax = x - self._x()
|
deltax = x - self._x()
|
||||||
self._canvas.move(self._TAG, deltax, 0)
|
self._canvas.move(self._TAG, deltax, 0)
|
||||||
|
|
||||||
def set_text(self, text):
|
def set_text(self, text):
|
||||||
self._canvas.itemconfigure(self.__text, text=text)
|
self._canvas.itemconfigure(self.__text, text=text)
|
||||||
|
|
||||||
|
|
||||||
class RightArrow(LeftArrow):
|
class RightArrow(LeftArrow):
|
||||||
_TAG = ('rightarrow',)
|
_TAG = ('rightarrow',)
|
||||||
|
|
||||||
def _create(self, x):
|
def _create(self, x):
|
||||||
arrow = self._canvas.create_line(
|
arrow = self._canvas.create_line(
|
||||||
x, self._YOFFSET,
|
x, self._YOFFSET,
|
||||||
x + self._ARROWWIDTH, self._YOFFSET,
|
x + self._ARROWWIDTH, self._YOFFSET,
|
||||||
x + self._ARROWWIDTH, self._ARROWHEIGHT + self._YOFFSET,
|
x + self._ARROWWIDTH, self._ARROWHEIGHT + self._YOFFSET,
|
||||||
arrow='last',
|
arrow='last',
|
||||||
width=3.0,
|
width=3.0,
|
||||||
tags=self._TAG)
|
tags=self._TAG)
|
||||||
text = self._canvas.create_text(
|
text = self._canvas.create_text(
|
||||||
x - self._ARROWWIDTH + 15, # BAW: kludge
|
x - self._ARROWWIDTH + 15, # BAW: kludge
|
||||||
self._ARROWHEIGHT - self._TEXTYOFFSET,
|
self._ARROWHEIGHT - self._TEXTYOFFSET,
|
||||||
justify=RIGHT,
|
justify=RIGHT,
|
||||||
text='128',
|
text='128',
|
||||||
tags=self._TAG)
|
tags=self._TAG)
|
||||||
return arrow, text
|
return arrow, text
|
||||||
|
|
||||||
def _x(self):
|
def _x(self):
|
||||||
coords = self._canvas.bbox(self._TAG)
|
coords = self._canvas.bbox(self._TAG)
|
||||||
assert coords
|
assert coords
|
||||||
return coords[2] - 6 # BAW: kludge
|
return coords[2] - 6 # BAW: kludge
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -173,68 +173,68 @@ class StripWidget:
|
||||||
uwdvar = None,
|
uwdvar = None,
|
||||||
hexvar = None):
|
hexvar = None):
|
||||||
# instance variables
|
# instance variables
|
||||||
self.__generator = generator
|
self.__generator = generator
|
||||||
self.__axis = axis
|
self.__axis = axis
|
||||||
self.__numchips = numchips
|
self.__numchips = numchips
|
||||||
assert self.__axis in (0, 1, 2)
|
assert self.__axis in (0, 1, 2)
|
||||||
self.__uwd = uwdvar
|
self.__uwd = uwdvar
|
||||||
self.__hexp = hexvar
|
self.__hexp = hexvar
|
||||||
# the last chip selected
|
# the last chip selected
|
||||||
self.__lastchip = None
|
self.__lastchip = None
|
||||||
self.__sb = switchboard
|
self.__sb = switchboard
|
||||||
|
|
||||||
canvaswidth = numchips * (chipwidth + 1)
|
canvaswidth = numchips * (chipwidth + 1)
|
||||||
canvasheight = chipheight + 43 # BAW: Kludge
|
canvasheight = chipheight + 43 # BAW: Kludge
|
||||||
|
|
||||||
# create the canvas and pack it
|
# create the canvas and pack it
|
||||||
canvas = self.__canvas = Canvas(master,
|
canvas = self.__canvas = Canvas(master,
|
||||||
width=canvaswidth,
|
width=canvaswidth,
|
||||||
height=canvasheight,
|
height=canvasheight,
|
||||||
## borderwidth=2,
|
## borderwidth=2,
|
||||||
## relief=GROOVE
|
## relief=GROOVE
|
||||||
)
|
)
|
||||||
|
|
||||||
canvas.pack()
|
canvas.pack()
|
||||||
canvas.bind('<ButtonPress-1>', self.__select_chip)
|
canvas.bind('<ButtonPress-1>', self.__select_chip)
|
||||||
canvas.bind('<ButtonRelease-1>', self.__select_chip)
|
canvas.bind('<ButtonRelease-1>', self.__select_chip)
|
||||||
canvas.bind('<B1-Motion>', self.__select_chip)
|
canvas.bind('<B1-Motion>', self.__select_chip)
|
||||||
|
|
||||||
# Load a proc into the Tcl interpreter. This is used in the
|
# Load a proc into the Tcl interpreter. This is used in the
|
||||||
# set_color() method to speed up setting the chip colors.
|
# set_color() method to speed up setting the chip colors.
|
||||||
canvas.tk.eval(TCLPROC)
|
canvas.tk.eval(TCLPROC)
|
||||||
|
|
||||||
# create the color strip
|
# create the color strip
|
||||||
chips = self.__chips = []
|
chips = self.__chips = []
|
||||||
x = 1
|
x = 1
|
||||||
y = 30
|
y = 30
|
||||||
tags = ('chip',)
|
tags = ('chip',)
|
||||||
for c in range(self.__numchips):
|
for c in range(self.__numchips):
|
||||||
color = 'grey'
|
color = 'grey'
|
||||||
canvas.create_rectangle(
|
canvas.create_rectangle(
|
||||||
x, y, x+chipwidth, y+chipheight,
|
x, y, x+chipwidth, y+chipheight,
|
||||||
fill=color, outline=color,
|
fill=color, outline=color,
|
||||||
tags=tags)
|
tags=tags)
|
||||||
x = x + chipwidth + 1 # for outline
|
x = x + chipwidth + 1 # for outline
|
||||||
chips.append(color)
|
chips.append(color)
|
||||||
|
|
||||||
# create the strip label
|
# create the strip label
|
||||||
self.__label = canvas.create_text(
|
self.__label = canvas.create_text(
|
||||||
3, y + chipheight + 8,
|
3, y + chipheight + 8,
|
||||||
text=label,
|
text=label,
|
||||||
anchor=W)
|
anchor=W)
|
||||||
|
|
||||||
# create the arrow and text item
|
# create the arrow and text item
|
||||||
chipx = self.__arrow_x(0)
|
chipx = self.__arrow_x(0)
|
||||||
self.__leftarrow = LeftArrow(canvas, chipx)
|
self.__leftarrow = LeftArrow(canvas, chipx)
|
||||||
|
|
||||||
chipx = self.__arrow_x(len(chips) - 1)
|
chipx = self.__arrow_x(len(chips) - 1)
|
||||||
self.__rightarrow = RightArrow(canvas, chipx)
|
self.__rightarrow = RightArrow(canvas, chipx)
|
||||||
|
|
||||||
def __arrow_x(self, chipnum):
|
def __arrow_x(self, chipnum):
|
||||||
coords = self.__canvas.coords(chipnum+1)
|
coords = self.__canvas.coords(chipnum+1)
|
||||||
assert coords
|
assert coords
|
||||||
x0, y0, x1, y1 = coords
|
x0, y0, x1, y1 = coords
|
||||||
return (x1 + x0) / 2.0
|
return (x1 + x0) / 2.0
|
||||||
|
|
||||||
# Invoked when one of the chips is clicked. This should just tell the
|
# Invoked when one of the chips is clicked. This should just tell the
|
||||||
# switchboard to set the color on all the output components
|
# switchboard to set the color on all the output components
|
||||||
|
@ -260,40 +260,40 @@ class StripWidget:
|
||||||
color = self.__canvas.itemcget(self.__lastchip, 'fill')
|
color = self.__canvas.itemcget(self.__lastchip, 'fill')
|
||||||
self.__canvas.itemconfigure(self.__lastchip, outline=color)
|
self.__canvas.itemconfigure(self.__lastchip, outline=color)
|
||||||
self.__lastchip = chip
|
self.__lastchip = chip
|
||||||
# get the arrow's text
|
# get the arrow's text
|
||||||
coloraxis = rgbtuple[self.__axis]
|
coloraxis = rgbtuple[self.__axis]
|
||||||
if self.__hexp.get():
|
if self.__hexp.get():
|
||||||
# hex
|
# hex
|
||||||
text = hex(coloraxis)
|
text = hex(coloraxis)
|
||||||
else:
|
else:
|
||||||
# decimal
|
# decimal
|
||||||
text = repr(coloraxis)
|
text = repr(coloraxis)
|
||||||
# move the arrow, and set it's text
|
# move the arrow, and set it's text
|
||||||
if coloraxis <= 128:
|
if coloraxis <= 128:
|
||||||
# use the left arrow
|
# use the left arrow
|
||||||
self.__leftarrow.set_text(text)
|
self.__leftarrow.set_text(text)
|
||||||
self.__leftarrow.move_to(self.__arrow_x(chip-1))
|
self.__leftarrow.move_to(self.__arrow_x(chip-1))
|
||||||
self.__rightarrow.move_to(-100)
|
self.__rightarrow.move_to(-100)
|
||||||
else:
|
else:
|
||||||
# use the right arrow
|
# use the right arrow
|
||||||
self.__rightarrow.set_text(text)
|
self.__rightarrow.set_text(text)
|
||||||
self.__rightarrow.move_to(self.__arrow_x(chip-1))
|
self.__rightarrow.move_to(self.__arrow_x(chip-1))
|
||||||
self.__leftarrow.move_to(-100)
|
self.__leftarrow.move_to(-100)
|
||||||
# and set the chip's outline
|
# and set the chip's outline
|
||||||
brightness = ColorDB.triplet_to_brightness(rgbtuple)
|
brightness = ColorDB.triplet_to_brightness(rgbtuple)
|
||||||
if brightness <= 128:
|
if brightness <= 128:
|
||||||
outline = 'white'
|
outline = 'white'
|
||||||
else:
|
else:
|
||||||
outline = 'black'
|
outline = 'black'
|
||||||
self.__canvas.itemconfigure(chip, outline=outline)
|
self.__canvas.itemconfigure(chip, outline=outline)
|
||||||
|
|
||||||
|
|
||||||
def update_yourself(self, red, green, blue):
|
def update_yourself(self, red, green, blue):
|
||||||
assert self.__generator
|
assert self.__generator
|
||||||
i = 1
|
i = 1
|
||||||
chip = 0
|
chip = 0
|
||||||
chips = self.__chips = []
|
chips = self.__chips = []
|
||||||
tk = self.__canvas.tk
|
tk = self.__canvas.tk
|
||||||
# get the red, green, and blue components for all chips
|
# get the red, green, and blue components for all chips
|
||||||
for t in self.__generator(self.__numchips, red, green, blue):
|
for t in self.__generator(self.__numchips, red, green, blue):
|
||||||
rrggbb = ColorDB.triplet_to_rrggbb(t)
|
rrggbb = ColorDB.triplet_to_rrggbb(t)
|
||||||
|
|
|
@ -9,8 +9,8 @@ _VERSION="1.0"
|
||||||
_URL="http://www.cwi.nl/~jack/versioncheck/curversion.txt"
|
_URL="http://www.cwi.nl/~jack/versioncheck/curversion.txt"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
_myverbose=VERBOSE
|
_myverbose=VERBOSE
|
||||||
except NameError:
|
except NameError:
|
||||||
_myverbose=1
|
_myverbose=1
|
||||||
|
|
||||||
pyversioncheck.versioncheck(_PACKAGE, _URL, _VERSION, verbose=_myverbose)
|
pyversioncheck.versioncheck(_PACKAGE, _URL, _VERSION, verbose=_myverbose)
|
||||||
|
|
|
@ -23,32 +23,32 @@ Values for verboselevel:
|
||||||
3 - Check every URL for packages with multiple locations"""
|
3 - Check every URL for packages with multiple locations"""
|
||||||
|
|
||||||
def check1dir(dummy, dir, files):
|
def check1dir(dummy, dir, files):
|
||||||
if CHECKNAME in files:
|
if CHECKNAME in files:
|
||||||
fullname = os.path.join(dir, CHECKNAME)
|
fullname = os.path.join(dir, CHECKNAME)
|
||||||
try:
|
try:
|
||||||
execfile(fullname)
|
execfile(fullname)
|
||||||
except:
|
except:
|
||||||
print '** Exception in', fullname
|
print '** Exception in', fullname
|
||||||
|
|
||||||
def walk1tree(tree):
|
def walk1tree(tree):
|
||||||
os.path.walk(tree, check1dir, None)
|
os.path.walk(tree, check1dir, None)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
global VERBOSE
|
global VERBOSE
|
||||||
try:
|
try:
|
||||||
options, arguments = getopt.getopt(sys.argv[1:], 'v:')
|
options, arguments = getopt.getopt(sys.argv[1:], 'v:')
|
||||||
except getopt.error:
|
except getopt.error:
|
||||||
print USAGE
|
print USAGE
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
for o, a in options:
|
for o, a in options:
|
||||||
if o == '-v':
|
if o == '-v':
|
||||||
VERBOSE = int(a)
|
VERBOSE = int(a)
|
||||||
if not arguments:
|
if not arguments:
|
||||||
arguments = [sys.prefix]
|
arguments = [sys.prefix]
|
||||||
for dir in arguments:
|
for dir in arguments:
|
||||||
walk1tree(dir)
|
walk1tree(dir)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,10 @@ import urllib
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# Verbose options
|
# Verbose options
|
||||||
VERBOSE_SILENT=0 # Single-line reports per package
|
VERBOSE_SILENT=0 # Single-line reports per package
|
||||||
VERBOSE_NORMAL=1 # Single-line reports per package, more info if outdated
|
VERBOSE_NORMAL=1 # Single-line reports per package, more info if outdated
|
||||||
VERBOSE_EACHFILE=2 # Report on each URL checked
|
VERBOSE_EACHFILE=2 # Report on each URL checked
|
||||||
VERBOSE_CHECKALL=3 # Check each URL for each package
|
VERBOSE_CHECKALL=3 # Check each URL for each package
|
||||||
|
|
||||||
# Test directory
|
# Test directory
|
||||||
## urllib bug: _TESTDIR="ftp://ftp.cwi.nl/pub/jack/python/versiontestdir/"
|
## urllib bug: _TESTDIR="ftp://ftp.cwi.nl/pub/jack/python/versiontestdir/"
|
||||||
|
@ -96,5 +96,4 @@ def _test():
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
_test()
|
_test()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue