update windows build to Python 3.7
This commit is contained in:
parent
73105fa71e
commit
ddc59ab92d
5761 changed files with 750298 additions and 213405 deletions
|
|
@ -1,18 +0,0 @@
|
|||
#!e:\oml-win32\local_platform\bin\python.exe
|
||||
from __future__ import print_function
|
||||
import base64
|
||||
import os
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
# create font data chunk for embedding
|
||||
font = "Tests/images/courB08"
|
||||
print(" f._load_pilfont_data(")
|
||||
print(" # %s" % os.path.basename(font))
|
||||
print(" BytesIO(base64.decodestring(b'''")
|
||||
base64.encode(open(font + ".pil", "rb"), sys.stdout)
|
||||
print("''')), Image.open(BytesIO(base64.decodestring(b'''")
|
||||
base64.encode(open(font + ".pbm", "rb"), sys.stdout)
|
||||
print("'''))))")
|
||||
|
||||
# End of file
|
||||
Binary file not shown.
BIN
Scripts/easy_install-3.7.exe
Normal file
BIN
Scripts/easy_install-3.7.exe
Normal file
Binary file not shown.
Binary file not shown.
91
Scripts/edsig
Normal file
91
Scripts/edsig
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
#!c:\python37\python.exe
|
||||
from __future__ import print_function
|
||||
|
||||
import os, sys
|
||||
import ed25519
|
||||
from hashlib import sha256
|
||||
|
||||
def help():
|
||||
print("""\
|
||||
Usage: (ed25519 version %s)
|
||||
|
||||
edsig generate [STEM]
|
||||
creates keypair, writes to 'STEM.signing.key' and 'STEM.verifying.key'
|
||||
default is to 'signing.key' and 'verifying.key'
|
||||
|
||||
edsig sign (signing.key|keyfile) message.file
|
||||
prints signature to stdout
|
||||
If message.file is "-", reads from stdin.
|
||||
|
||||
edsig verify (verifying.key|keyfile) message.file (signature|sigfile)
|
||||
prints 'good signature!' or raises exception
|
||||
If message.file is "-", reads from stdin.
|
||||
|
||||
Key-providing arguments can either be the key itself, or point to a file
|
||||
containing the key.
|
||||
""" % ed25519.__version__)
|
||||
|
||||
def remove_prefix(prefix, s):
|
||||
if not s.startswith(prefix):
|
||||
raise ValueError("no prefix found")
|
||||
return s[len(prefix):]
|
||||
|
||||
def data_from_arg(arg, prefix, keylen, readable):
|
||||
if (readable
|
||||
and arg.startswith(prefix)
|
||||
and len(remove_prefix(prefix, arg))==keylen):
|
||||
return arg
|
||||
if os.path.isfile(arg):
|
||||
return open(arg,"rb").read()
|
||||
raise ValueError("unable to get data from '%s'" % arg)
|
||||
|
||||
def message_rep(msg_arg):
|
||||
if msg_arg == "-":
|
||||
f = sys.stdin
|
||||
else:
|
||||
f = open(msg_arg, "rb")
|
||||
h = sha256()
|
||||
while True:
|
||||
data = f.read(16*1024)
|
||||
if not data:
|
||||
break
|
||||
if not isinstance(data, bytes):
|
||||
data = data.encode(sys.stdin.encoding)
|
||||
h.update(data)
|
||||
return h.digest()
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
help()
|
||||
elif sys.argv[1] == "generate":
|
||||
sk,vk = ed25519.create_keypair()
|
||||
if len(sys.argv) > 2:
|
||||
sk_outfile = sys.argv[2]+".signing.key"
|
||||
vk_outfile = sys.argv[2]+".verifying.key"
|
||||
else:
|
||||
sk_outfile = "signing.key"
|
||||
vk_outfile = "verifying.key"
|
||||
sk_s = sk.to_seed(prefix="sign0-")
|
||||
vk_s = vk.to_ascii("verf0-", "base32").encode('ascii')
|
||||
open(sk_outfile,"wb").write(sk_s)
|
||||
open(vk_outfile,"wb").write(vk_s+b"\n")
|
||||
print("wrote private signing key to", sk_outfile)
|
||||
print("write public verifying key to", vk_outfile)
|
||||
elif sys.argv[1] == "sign":
|
||||
sk_arg = sys.argv[2]
|
||||
msg_arg = sys.argv[3]
|
||||
sk = ed25519.SigningKey(data_from_arg(sk_arg, "sign0-", 52, False),
|
||||
prefix="sign0-")
|
||||
sig = sk.sign(message_rep(msg_arg), prefix="sig0-", encoding="base32")
|
||||
print(sig)
|
||||
elif sys.argv[1] == "verify":
|
||||
vk_arg = sys.argv[2]
|
||||
msg_arg = sys.argv[3]
|
||||
sig_arg = sys.argv[4]
|
||||
vk = ed25519.VerifyingKey(data_from_arg(vk_arg, "verf0-", 52, True),
|
||||
prefix="verf0-", encoding="base32")
|
||||
sig = data_from_arg(sig_arg, "sig0-", 103, True)
|
||||
vk.verify(sig, message_rep(msg_arg),
|
||||
prefix="sig0-", encoding="base32") # could raise BadSignature
|
||||
print("good signature!")
|
||||
else:
|
||||
help()
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
#!e:\oml-win32\local_platform\bin\python.exe
|
||||
#
|
||||
# The Python Imaging Library
|
||||
# $Id$
|
||||
#
|
||||
# split an animation into a number of frame files
|
||||
#
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
from PIL import Image
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
class Interval(object):
|
||||
|
||||
def __init__(self, interval="0"):
|
||||
|
||||
self.setinterval(interval)
|
||||
|
||||
def setinterval(self, interval):
|
||||
|
||||
self.hilo = []
|
||||
|
||||
for s in interval.split(","):
|
||||
if not s.strip():
|
||||
continue
|
||||
try:
|
||||
v = int(s)
|
||||
if v < 0:
|
||||
lo, hi = 0, -v
|
||||
else:
|
||||
lo = hi = v
|
||||
except ValueError:
|
||||
i = s.find("-")
|
||||
lo, hi = int(s[:i]), int(s[i+1:])
|
||||
|
||||
self.hilo.append((hi, lo))
|
||||
|
||||
if not self.hilo:
|
||||
self.hilo = [(sys.maxsize, 0)]
|
||||
|
||||
def __getitem__(self, index):
|
||||
|
||||
for hi, lo in self.hilo:
|
||||
if hi >= index >= lo:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# main program
|
||||
|
||||
html = 0
|
||||
|
||||
if sys.argv[1:2] == ["-h"]:
|
||||
html = 1
|
||||
del sys.argv[1]
|
||||
|
||||
if not sys.argv[2:]:
|
||||
print()
|
||||
print("Syntax: python explode.py infile template [range]")
|
||||
print()
|
||||
print("The template argument is used to construct the names of the")
|
||||
print("individual frame files. The frames are numbered file001.ext,")
|
||||
print("file002.ext, etc. You can insert %d to control the placement")
|
||||
print("and syntax of the frame number.")
|
||||
print()
|
||||
print("The optional range argument specifies which frames to extract.")
|
||||
print("You can give one or more ranges like 1-10, 5, -15 etc. If")
|
||||
print("omitted, all frames are extracted.")
|
||||
sys.exit(1)
|
||||
|
||||
infile = sys.argv[1]
|
||||
outfile = sys.argv[2]
|
||||
|
||||
frames = Interval(",".join(sys.argv[3:]))
|
||||
|
||||
try:
|
||||
# check if outfile contains a placeholder
|
||||
outfile % 1
|
||||
except TypeError:
|
||||
file, ext = os.path.splitext(outfile)
|
||||
outfile = file + "%03d" + ext
|
||||
|
||||
ix = 1
|
||||
|
||||
im = Image.open(infile)
|
||||
|
||||
if html:
|
||||
file, ext = os.path.splitext(outfile)
|
||||
html = open(file+".html", "w")
|
||||
html.write("<html>\n<body>\n")
|
||||
|
||||
while True:
|
||||
|
||||
if frames[ix]:
|
||||
im.save(outfile % ix)
|
||||
print(outfile % ix)
|
||||
|
||||
if html:
|
||||
html.write("<img src='%s'><br>\n" % outfile % ix)
|
||||
|
||||
try:
|
||||
im.seek(ix)
|
||||
except EOFError:
|
||||
break
|
||||
|
||||
ix += 1
|
||||
|
||||
if html:
|
||||
html.write("</body>\n</html>\n")
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
#!e:\oml-win32\local_platform\bin\python.exe
|
||||
#
|
||||
# The Python Imaging Library
|
||||
# $Id$
|
||||
#
|
||||
# this demo script illustrates pasting into an already displayed
|
||||
# photoimage. note that the current version of Tk updates the whole
|
||||
# image everytime we paste, so to get decent performance, we split
|
||||
# the image into a set of tiles.
|
||||
#
|
||||
|
||||
try:
|
||||
from tkinter import Tk, Canvas, NW
|
||||
except ImportError:
|
||||
from Tkinter import Tk, Canvas, NW
|
||||
|
||||
from PIL import Image, ImageTk
|
||||
import sys
|
||||
|
||||
#
|
||||
# painter widget
|
||||
|
||||
|
||||
class PaintCanvas(Canvas):
|
||||
def __init__(self, master, image):
|
||||
Canvas.__init__(self, master, width=image.size[0], height=image.size[1])
|
||||
|
||||
# fill the canvas
|
||||
self.tile = {}
|
||||
self.tilesize = tilesize = 32
|
||||
xsize, ysize = image.size
|
||||
for x in range(0, xsize, tilesize):
|
||||
for y in range(0, ysize, tilesize):
|
||||
box = x, y, min(xsize, x+tilesize), min(ysize, y+tilesize)
|
||||
tile = ImageTk.PhotoImage(image.crop(box))
|
||||
self.create_image(x, y, image=tile, anchor=NW)
|
||||
self.tile[(x, y)] = box, tile
|
||||
|
||||
self.image = image
|
||||
|
||||
self.bind("<B1-Motion>", self.paint)
|
||||
|
||||
def paint(self, event):
|
||||
xy = event.x - 10, event.y - 10, event.x + 10, event.y + 10
|
||||
im = self.image.crop(xy)
|
||||
|
||||
# process the image in some fashion
|
||||
im = im.convert("L")
|
||||
|
||||
self.image.paste(im, xy)
|
||||
self.repair(xy)
|
||||
|
||||
def repair(self, box):
|
||||
# update canvas
|
||||
dx = box[0] % self.tilesize
|
||||
dy = box[1] % self.tilesize
|
||||
for x in range(box[0]-dx, box[2]+1, self.tilesize):
|
||||
for y in range(box[1]-dy, box[3]+1, self.tilesize):
|
||||
try:
|
||||
xy, tile = self.tile[(x, y)]
|
||||
tile.paste(self.image.crop(xy))
|
||||
except KeyError:
|
||||
pass # outside the image
|
||||
self.update_idletasks()
|
||||
|
||||
#
|
||||
# main
|
||||
|
||||
root = Tk()
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: painter file")
|
||||
sys.exit(1)
|
||||
|
||||
im = Image.open(sys.argv[1])
|
||||
|
||||
if im.mode != "RGB":
|
||||
im = im.convert("RGB")
|
||||
|
||||
PaintCanvas(root, im).pack()
|
||||
|
||||
root.mainloop()
|
||||
BIN
Scripts/pip.exe
BIN
Scripts/pip.exe
Binary file not shown.
Binary file not shown.
BIN
Scripts/pip3.7.exe
Normal file
BIN
Scripts/pip3.7.exe
Normal file
Binary file not shown.
BIN
Scripts/pip3.exe
BIN
Scripts/pip3.exe
Binary file not shown.
|
|
@ -1,102 +0,0 @@
|
|||
#!e:\oml-win32\local_platform\bin\python.exe
|
||||
#
|
||||
# The Python Imaging Library
|
||||
# $Id$
|
||||
#
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
try:
|
||||
from tkinter import *
|
||||
except ImportError:
|
||||
from Tkinter import *
|
||||
|
||||
from PIL import Image, ImageTk
|
||||
import sys
|
||||
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# an image animation player
|
||||
|
||||
class UI(Label):
|
||||
|
||||
def __init__(self, master, im):
|
||||
if isinstance(im, list):
|
||||
# list of images
|
||||
self.im = im[1:]
|
||||
im = self.im[0]
|
||||
else:
|
||||
# sequence
|
||||
self.im = im
|
||||
|
||||
if im.mode == "1":
|
||||
self.image = ImageTk.BitmapImage(im, foreground="white")
|
||||
else:
|
||||
self.image = ImageTk.PhotoImage(im)
|
||||
|
||||
Label.__init__(self, master, image=self.image, bg="black", bd=0)
|
||||
|
||||
self.update()
|
||||
|
||||
try:
|
||||
duration = im.info["duration"]
|
||||
except KeyError:
|
||||
duration = 100
|
||||
self.after(duration, self.next)
|
||||
|
||||
def next(self):
|
||||
|
||||
if isinstance(self.im, list):
|
||||
|
||||
try:
|
||||
im = self.im[0]
|
||||
del self.im[0]
|
||||
self.image.paste(im)
|
||||
except IndexError:
|
||||
return # end of list
|
||||
|
||||
else:
|
||||
|
||||
try:
|
||||
im = self.im
|
||||
im.seek(im.tell() + 1)
|
||||
self.image.paste(im)
|
||||
except EOFError:
|
||||
return # end of file
|
||||
|
||||
try:
|
||||
duration = im.info["duration"]
|
||||
except KeyError:
|
||||
duration = 100
|
||||
self.after(duration, self.next)
|
||||
|
||||
self.update_idletasks()
|
||||
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# script interface
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
if not sys.argv[1:]:
|
||||
print("Syntax: python player.py imagefile(s)")
|
||||
sys.exit(1)
|
||||
|
||||
filename = sys.argv[1]
|
||||
|
||||
root = Tk()
|
||||
root.title(filename)
|
||||
|
||||
if len(sys.argv) > 2:
|
||||
# list of images
|
||||
print("loading...")
|
||||
im = []
|
||||
for filename in sys.argv[1:]:
|
||||
im.append(Image.open(filename))
|
||||
else:
|
||||
# sequence
|
||||
im = Image.open(filename)
|
||||
|
||||
UI(root, im).pack()
|
||||
|
||||
root.mainloop()
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
#!e:\oml-win32\local_platform\bin\python.exe
|
||||
#
|
||||
# The Python Imaging Library
|
||||
# $Id$
|
||||
#
|
||||
# this demo script illustrates how a 1-bit BitmapImage can be used
|
||||
# as a dynamically updated overlay
|
||||
#
|
||||
|
||||
try:
|
||||
from tkinter import *
|
||||
except ImportError:
|
||||
from Tkinter import *
|
||||
|
||||
from PIL import Image, ImageTk
|
||||
import sys
|
||||
|
||||
#
|
||||
# an image viewer
|
||||
|
||||
|
||||
class UI(Frame):
|
||||
def __init__(self, master, im, value=128):
|
||||
Frame.__init__(self, master)
|
||||
|
||||
self.image = im
|
||||
self.value = value
|
||||
|
||||
self.canvas = Canvas(self, width=im.size[0], height=im.size[1])
|
||||
self.backdrop = ImageTk.PhotoImage(im)
|
||||
self.canvas.create_image(0, 0, image=self.backdrop, anchor=NW)
|
||||
self.canvas.pack()
|
||||
|
||||
scale = Scale(self, orient=HORIZONTAL, from_=0, to=255,
|
||||
resolution=1, command=self.update_scale, length=256)
|
||||
scale.set(value)
|
||||
scale.bind("<ButtonRelease-1>", self.redraw)
|
||||
scale.pack()
|
||||
|
||||
# uncomment the following line for instant feedback (might
|
||||
# be too slow on some platforms)
|
||||
# self.redraw()
|
||||
|
||||
def update_scale(self, value):
|
||||
self.value = eval(value)
|
||||
|
||||
self.redraw()
|
||||
|
||||
def redraw(self, event=None):
|
||||
|
||||
# create overlay (note the explicit conversion to mode "1")
|
||||
im = self.image.point(lambda v, t=self.value: v >= t, "1")
|
||||
self.overlay = ImageTk.BitmapImage(im, foreground="green")
|
||||
|
||||
# update canvas
|
||||
self.canvas.delete("overlay")
|
||||
self.canvas.create_image(0, 0, image=self.overlay, anchor=NW,
|
||||
tags="overlay")
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# main
|
||||
|
||||
root = Tk()
|
||||
|
||||
im = Image.open(sys.argv[1])
|
||||
|
||||
if im.mode != "L":
|
||||
im = im.convert("L")
|
||||
|
||||
# im.thumbnail((320,200))
|
||||
|
||||
UI(root, im).pack()
|
||||
|
||||
root.mainloop()
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
#!e:\oml-win32\local_platform\bin\python.exe
|
||||
#
|
||||
# The Python Imaging Library
|
||||
# $Id$
|
||||
#
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
try:
|
||||
from tkinter import Tk, Label
|
||||
except ImportError:
|
||||
from Tkinter import Tk, Label
|
||||
|
||||
from PIL import Image, ImageTk
|
||||
|
||||
#
|
||||
# an image viewer
|
||||
|
||||
|
||||
class UI(Label):
|
||||
|
||||
def __init__(self, master, im):
|
||||
|
||||
if im.mode == "1":
|
||||
# bitmap image
|
||||
self.image = ImageTk.BitmapImage(im, foreground="white")
|
||||
Label.__init__(self, master, image=self.image, bg="black", bd=0)
|
||||
|
||||
else:
|
||||
# photo image
|
||||
self.image = ImageTk.PhotoImage(im)
|
||||
Label.__init__(self, master, image=self.image, bd=0)
|
||||
|
||||
#
|
||||
# script interface
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
import sys
|
||||
|
||||
if not sys.argv[1:]:
|
||||
print("Syntax: python viewer.py imagefile")
|
||||
sys.exit(1)
|
||||
|
||||
filename = sys.argv[1]
|
||||
|
||||
root = Tk()
|
||||
root.title(filename)
|
||||
|
||||
im = Image.open(filename)
|
||||
|
||||
UI(root, im).pack()
|
||||
|
||||
root.mainloop()
|
||||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue