mirror of https://github.com/python/cpython
Actualized
This commit is contained in:
parent
ffd7fa3634
commit
8de83e041c
|
@ -48,10 +48,10 @@ class DrawingObject:
|
||||||
#print 'box', ((left, top), (right, bottom))
|
#print 'box', ((left, top), (right, bottom))
|
||||||
gl.rect(left, top, right, bottom)
|
gl.rect(left, top, right, bottom)
|
||||||
#
|
#
|
||||||
def circle(self, ((h, v), radius)):
|
def circle(self, (h, v), radius):
|
||||||
gl.circ(h, v, radius)
|
gl.circ(h, v, radius)
|
||||||
#
|
#
|
||||||
def elarc(self, (center, (rh, rv), a1, a2)):
|
def elarc(self, center, (rh, rv), (a1, a2)):
|
||||||
pass # XXX
|
pass # XXX
|
||||||
#
|
#
|
||||||
def erase(self, ((left, top), (right, bottom))):
|
def erase(self, ((left, top), (right, bottom))):
|
||||||
|
@ -68,14 +68,14 @@ class DrawingObject:
|
||||||
gl.color(self.fg)
|
gl.color(self.fg)
|
||||||
gl.logicop(LO_SRC)
|
gl.logicop(LO_SRC)
|
||||||
#
|
#
|
||||||
def line(self, ((h0, v0), (h1, v1))):
|
def line(self, (h0, v0), (h1, v1)):
|
||||||
#print 'line', ((h0, v0), (h1, v1))
|
#print 'line', ((h0, v0), (h1, v1))
|
||||||
gl.bgnline()
|
gl.bgnline()
|
||||||
gl.v2i(h0, v0)
|
gl.v2i(h0, v0)
|
||||||
gl.v2i(h1, v1)
|
gl.v2i(h1, v1)
|
||||||
gl.endline()
|
gl.endline()
|
||||||
#
|
#
|
||||||
def xorline(self, ((h0, v0), (h1, v1))):
|
def xorline(self, (h0, v0), (h1, v1)):
|
||||||
#print 'xorline', ((h0, v0), (h1, v1))
|
#print 'xorline', ((h0, v0), (h1, v1))
|
||||||
gl.logicop(LO_XOR)
|
gl.logicop(LO_XOR)
|
||||||
gl.color(self.bg)
|
gl.color(self.bg)
|
||||||
|
@ -92,7 +92,7 @@ class DrawingObject:
|
||||||
gl.v2i(h, v)
|
gl.v2i(h, v)
|
||||||
gl.endpoint()
|
gl.endpoint()
|
||||||
#
|
#
|
||||||
def text(self, ((h, v), string)):
|
def text(self, (h, v), string):
|
||||||
#print 'text', ((h, v), string)
|
#print 'text', ((h, v), string)
|
||||||
if h < 0:
|
if h < 0:
|
||||||
# If the point is outside the window
|
# If the point is outside the window
|
||||||
|
@ -108,7 +108,7 @@ class DrawingObject:
|
||||||
self.font.setfont()
|
self.font.setfont()
|
||||||
fm.prstr(string)
|
fm.prstr(string)
|
||||||
#
|
#
|
||||||
def shade(self, ((h, v), percent)):
|
def shade(self, (h, v), percent):
|
||||||
pass # XXX
|
pass # XXX
|
||||||
#
|
#
|
||||||
def baseline(self):
|
def baseline(self):
|
||||||
|
@ -121,7 +121,7 @@ class DrawingObject:
|
||||||
height, nglyphs) = self.font.getfontinfo()
|
height, nglyphs) = self.font.getfontinfo()
|
||||||
return height
|
return height
|
||||||
#
|
#
|
||||||
def textbreak(self, (string, width)):
|
def textbreak(self, string, width):
|
||||||
# XXX Slooooow!
|
# XXX Slooooow!
|
||||||
n = len(string)
|
n = len(string)
|
||||||
nwidth = self.textwidth(string[:n])
|
nwidth = self.textwidth(string[:n])
|
||||||
|
|
|
@ -5,7 +5,7 @@ from glstdwin import key2code
|
||||||
|
|
||||||
class MenuObject:
|
class MenuObject:
|
||||||
#
|
#
|
||||||
def _init(self, (win, title)):
|
def _init(self, win, title):
|
||||||
self._win = win
|
self._win = win
|
||||||
self._title = title
|
self._title = title
|
||||||
self._items = []
|
self._items = []
|
||||||
|
@ -15,20 +15,22 @@ class MenuObject:
|
||||||
self._win.remove(self)
|
self._win.remove(self)
|
||||||
del self._win
|
del self._win
|
||||||
#
|
#
|
||||||
def additem(self, arg):
|
def additem(self, *args):
|
||||||
if type(arg) == type(()):
|
if len(args) == 2:
|
||||||
text, shortcut = arg
|
text, shortcut = args
|
||||||
|
elif len(args) == 1:
|
||||||
|
text, shortcut = args[0], None
|
||||||
else:
|
else:
|
||||||
text, shortcut = arg, None
|
raise TypeError, 'arg count'
|
||||||
self._items.append([text, shortcut, 1, 0])
|
self._items.append([text, shortcut, 1, 0])
|
||||||
#
|
#
|
||||||
def setitem(self, (i, text)):
|
def setitem(self, i, text):
|
||||||
self._items[i][0] = text
|
self._items[i][0] = text
|
||||||
#
|
#
|
||||||
def enable(self, (i, flag)):
|
def enable(self, i, flag):
|
||||||
self._items[i][2] = flag
|
self._items[i][2] = flag
|
||||||
#
|
#
|
||||||
def check(self, (i, flag)):
|
def check(self, i, flag):
|
||||||
self._items[i][3] = flag
|
self._items[i][3] = flag
|
||||||
#
|
#
|
||||||
def _makepup(self, firstitem):
|
def _makepup(self, firstitem):
|
||||||
|
|
|
@ -51,7 +51,7 @@ class WindowObject:
|
||||||
def getwinsize(self):
|
def getwinsize(self):
|
||||||
return self._area[1]
|
return self._area[1]
|
||||||
#
|
#
|
||||||
def scroll(self, (area, by)):
|
def scroll(self, area, by):
|
||||||
# XXX ought to use gl.rectcopy()
|
# XXX ought to use gl.rectcopy()
|
||||||
if by <> (0, 0):
|
if by <> (0, 0):
|
||||||
self.change(area)
|
self.change(area)
|
||||||
|
|
|
@ -33,9 +33,9 @@ def main():
|
||||||
d = window.begindrawing()
|
d = window.begindrawing()
|
||||||
if window == w1:
|
if window == w1:
|
||||||
if color: d.setfgcolor(BLACK)
|
if color: d.setfgcolor(BLACK)
|
||||||
d.box((50, 50), (250, 250))
|
d.box(((50, 50), (250, 250)))
|
||||||
if color: d.setfgcolor(RED)
|
if color: d.setfgcolor(RED)
|
||||||
d.cliprect((50, 50), (250, 250))
|
d.cliprect(((50, 50), (250, 250)))
|
||||||
d.paint(w1.box)
|
d.paint(w1.box)
|
||||||
d.noclip()
|
d.noclip()
|
||||||
if color: d.setfgcolor(BLUE)
|
if color: d.setfgcolor(BLUE)
|
||||||
|
@ -59,7 +59,7 @@ def main():
|
||||||
elif type in (WE_MOUSE_DOWN, WE_MOUSE_MOVE, WE_MOUSE_UP):
|
elif type in (WE_MOUSE_DOWN, WE_MOUSE_MOVE, WE_MOUSE_UP):
|
||||||
h, v = detail[0]
|
h, v = detail[0]
|
||||||
window.box = (h, v), (h+80, v+80)
|
window.box = (h, v), (h+80, v+80)
|
||||||
window.change((0,0), (2000, 2000))
|
window.change(((0,0), (2000, 2000)))
|
||||||
elif type == WE_CHAR:
|
elif type == WE_CHAR:
|
||||||
print 'character', `detail`
|
print 'character', `detail`
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -27,7 +27,7 @@ def main():
|
||||||
break
|
break
|
||||||
elif type == WE_DRAW:
|
elif type == WE_DRAW:
|
||||||
d = w.begindrawing()
|
d = w.begindrawing()
|
||||||
d.box((50,50), (100,100))
|
d.box(((50,50), (100,100)))
|
||||||
del d
|
del d
|
||||||
elif type == WE_MENU:
|
elif type == WE_MENU:
|
||||||
mp, i = detail
|
mp, i = detail
|
||||||
|
|
Loading…
Reference in New Issue