diff options
author | Guido van Rossum <guido@python.org> | 1993-01-04 09:16:51 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1993-01-04 09:16:51 (GMT) |
commit | fea2af1e9b0c99cac6cb8806c4af651a38e92d07 (patch) | |
tree | e9e0ec3b003498ab942e1c0b7dd3d28951ca2701 /Lib/stdwin | |
parent | a2b7f40513ba5d75a2063c3fabe47377cd8c0416 (diff) | |
download | cpython-fea2af1e9b0c99cac6cb8806c4af651a38e92d07.zip cpython-fea2af1e9b0c99cac6cb8806c4af651a38e92d07.tar.gz cpython-fea2af1e9b0c99cac6cb8806c4af651a38e92d07.tar.bz2 |
* More changes due to stricter argument passing rules
* Fixed calendar.py, mimetools.py, whrandom.py to cope with time.time()
returning a floating point number. (And fix old bug in calendar)
* Add recursion level to mainloop.mainloop(), to make it reentrant.
Diffstat (limited to 'Lib/stdwin')
-rwxr-xr-x | Lib/stdwin/BoxParent.py | 5 | ||||
-rwxr-xr-x | Lib/stdwin/DirList.py | 2 | ||||
-rwxr-xr-x | Lib/stdwin/HVSplit.py | 4 | ||||
-rwxr-xr-x | Lib/stdwin/Split.py | 13 | ||||
-rwxr-xr-x | Lib/stdwin/TransParent.py | 12 | ||||
-rwxr-xr-x | Lib/stdwin/WindowParent.py | 4 | ||||
-rwxr-xr-x | Lib/stdwin/mainloop.py | 48 |
7 files changed, 52 insertions, 36 deletions
diff --git a/Lib/stdwin/BoxParent.py b/Lib/stdwin/BoxParent.py index a44995d..c792731 100755 --- a/Lib/stdwin/BoxParent.py +++ b/Lib/stdwin/BoxParent.py @@ -27,15 +27,14 @@ class BoxParent(TransParent): def getbounds(self): return self.bounds # - def draw(self, args): - d, area = args + def draw(self, d, area): (left, top), (right, bottom) = self.bounds left = left + 1 top = top + 1 right = right - 1 bottom = bottom - 1 d.box((left, top), (right, bottom)) - TransParent.draw(self, args) # XXX clip to innerbounds? + TransParent.draw(self, d, area) # XXX clip to innerbounds? # # XXX should scroll clip to innerbounds??? # XXX currently the only user restricts itself to child's bounds diff --git a/Lib/stdwin/DirList.py b/Lib/stdwin/DirList.py index 4b98b1d..446d33b 100755 --- a/Lib/stdwin/DirList.py +++ b/Lib/stdwin/DirList.py @@ -28,7 +28,7 @@ class DirList(VSplit): class DirListWindow(WindowParent): # def create(self, dirname): - self = WindowParent.create(self, (dirname, (0, 0))) + self = WindowParent.create(self, dirname, (0, 0)) child = DirList().create(self, dirname) self.realize() return self diff --git a/Lib/stdwin/HVSplit.py b/Lib/stdwin/HVSplit.py index c42327d..62e0de7 100755 --- a/Lib/stdwin/HVSplit.py +++ b/Lib/stdwin/HVSplit.py @@ -55,8 +55,8 @@ class HVSplit(Split): class HSplit(HVSplit): def create(self, parent): - return HVSplit.create(self, (parent, 0)) + return HVSplit.create(self, parent, 0) class VSplit(HVSplit): def create(self, parent): - return HVSplit.create(self, (parent, 1)) + return HVSplit.create(self, parent, 1) diff --git a/Lib/stdwin/Split.py b/Lib/stdwin/Split.py index 8eb0254..5ff9808 100755 --- a/Lib/stdwin/Split.py +++ b/Lib/stdwin/Split.py @@ -50,10 +50,10 @@ class Split: for child in self.children: child.realize() # - def draw(self, d_detail): + def draw(self, d, detail): # (Could avoid calls to children outside the area) for child in self.children: - child.draw(d_detail) + child.draw(d, detail) # def altdraw(self, detail): for child in self.altdraw_interest: @@ -112,15 +112,14 @@ class Split: if self.keybd_focus: self.keybd_focus.deactivate() # - def keybd(self, type_detail): + def keybd(self, type, detail): if not self.keybd_focus: self.set_keybd_focus(self.keybd_interest[0]) - type, detail = type_detail if type == WE_COMMAND and detail == WC_TAB and \ len(self.keybd_interest) > 1: self.next_keybd_focus() return - self.keybd_focus.keybd(type_detail) + self.keybd_focus.keybd(type, detail) # def timer(self): for child in self.timer_interest: @@ -206,7 +205,7 @@ class Split: # def change(self, area): self.parent.change(area) - def scroll(self, area_vector): - self.parent.scroll(area_vector) + def scroll(self, area, vector): + self.parent.scroll(area, vector) def settimer(self, itimer): self.parent.settimer(itimer) diff --git a/Lib/stdwin/TransParent.py b/Lib/stdwin/TransParent.py index 27e9bbd..49dcd3d 100755 --- a/Lib/stdwin/TransParent.py +++ b/Lib/stdwin/TransParent.py @@ -60,12 +60,12 @@ class TransParent(ManageOneChild): def realize(self): if self.child: self.child.realize() - def draw(self, args): + def draw(self, d, area): if self.child: - self.child.draw(args) - def altdraw(self, args): + self.child.draw(d, area) + def altdraw(self, area): if self.child: - self.child.altdraw(args) + self.child.altdraw(area) # # Downcalls only made after certain upcalls # @@ -117,7 +117,7 @@ class TransParent(ManageOneChild): # def change(self, area): self.parent.change(area) - def scroll(self, args): - self.parent.scroll(args) + def scroll(self, area, vector): + self.parent.scroll(area, vector) def settimer(self, itimer): self.parent.settimer(itimer) diff --git a/Lib/stdwin/WindowParent.py b/Lib/stdwin/WindowParent.py index 1964d38..cdec10b 100755 --- a/Lib/stdwin/WindowParent.py +++ b/Lib/stdwin/WindowParent.py @@ -136,9 +136,9 @@ class WindowParent(ManageOneChild): if self.win: self.win.change(area) # - def scroll(self, args): + def scroll(self, area, vector): if self.win: - self.win.scroll(args) + self.win.scroll(area, vector) # def settimer(self, itimer): if self.win: diff --git a/Lib/stdwin/mainloop.py b/Lib/stdwin/mainloop.py index f1fe617..6b574cf 100755 --- a/Lib/stdwin/mainloop.py +++ b/Lib/stdwin/mainloop.py @@ -4,6 +4,9 @@ # - have a 'dispatch' function as a window member +# XXX This is UNIX specific! For the Mac we need to use a simpler version! + + import stdwin, stdwinq from stdwinevents import * @@ -123,23 +126,38 @@ def do_select(): # Python's stdwin.getevent() turns WE_COMMAND/WC_CANCEL events # into KeyboardInterrupt exceptions; these are turned back in events. # +recursion_level = 0 # Hack to make it reentrant def mainloop(): - stdwin_select_handler() # Process events already in stdwin queue - fd = stdwin.fileno() - while 1: - if windows: - registerfd(fd, 'r', stdwin_select_handler) - try: - while windows: + global recursion_level + recursion_level = recursion_level + 1 + try: + stdwin_select_handler() # Process events already in queue + fd = stdwin.fileno() + while 1: + if windows: + if recursion_level == 1: + registerfd(fd, 'r', stdwin_select_handler) + try: + while windows: + do_select() + stdwin_select_handler() + finally: + if recursion_level == 1: + unregisterfd(fd) + elif fdlist: + while fdlist and not windows: do_select() - stdwin_select_handler() - finally: - unregisterfd(fd) - elif fdlist: - while fdlist and not windows: - do_select() - else: - break + else: + break + finally: + recursion_level = recursion_level - 1 + + +# Check for events without ever blocking +# +def check(): + stdwin_select_handler() + # XXX Should check for socket stuff as well # Handle stdwin events until none are left |