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