aboutsummaryrefslogtreecommitdiff
path: root/lib/TransParent.py
diff options
context:
space:
mode:
authorSkip Montanaro <[email protected]>2021-02-16 20:14:16 -0600
committerSkip Montanaro <[email protected]>2021-02-16 20:14:16 -0600
commitc2587c76f1b416cdbecb979e54941933246bf856 (patch)
treebb61ee9128075ce22af4eafa232f13c2e5a07896 /lib/TransParent.py
parentd90761a005b24018ae237bf551515772a1de656f (diff)
downloadpython-0.9.1-patched-QoL-c2587c76f1b416cdbecb979e54941933246bf856.tar.xz
python-0.9.1-patched-QoL-c2587c76f1b416cdbecb979e54941933246bf856.zip
starting over
Diffstat (limited to 'lib/TransParent.py')
-rw-r--r--lib/TransParent.py174
1 files changed, 87 insertions, 87 deletions
diff --git a/lib/TransParent.py b/lib/TransParent.py
index a07b4c4..8cee283 100644
--- a/lib/TransParent.py
+++ b/lib/TransParent.py
@@ -3,94 +3,94 @@
# Use this as a base class for objects that are almost transparent.
# Don't use as a base class for parents with multiple children.
-Error = 'TransParent.Error' # Exception
+Error = 'TransParent.Error' # Exception
class ManageOneChild():
- #
- # Upcalls shared with other single-child parents
- #
- def addchild(self, child):
- if self.child:
- raise Error, 'addchild: one child only'
- if not child:
- raise Error, 'addchild: bad child'
- self.child = child
- #
- def delchild(self, child):
- if not self.child:
- raise Error, 'delchild: no child'
- if child <> self.child:
- raise Error, 'delchild: not my child'
- self.child = 0
+ #
+ # Upcalls shared with other single-child parents
+ #
+ def addchild(self, child):
+ if self.child:
+ raise Error, 'addchild: one child only'
+ if not child:
+ raise Error, 'addchild: bad child'
+ self.child = child
+ #
+ def delchild(self, child):
+ if not self.child:
+ raise Error, 'delchild: no child'
+ if child <> self.child:
+ raise Error, 'delchild: not my child'
+ self.child = 0
class TransParent() = ManageOneChild():
- #
- # Calls from creator
- # NB derived classes may add parameters to create()
- #
- def create(self, parent):
- parent.addchild(self)
- self.parent = parent
- self.child = 0 # No child yet
- #
- # Downcalls from parent to child
- #
- def destroy(self):
- del self.parent
- if self.child: self.child.destroy()
- del self.child
- #
- def minsize(self, m):
- if not self.child:
- return 0, 0
- else:
- return self.child.minsize(m)
- def getbounds(self, bounds):
- if not self.child:
- raise Error, 'getbounds w/o child'
- else:
- return self.child.getbounds()
- def setbounds(self, bounds):
- if not self.child:
- raise Error, 'setbounds w/o child'
- else:
- self.child.setbounds(bounds)
- def draw(self, args):
- if self.child:
- self.child.draw(args)
- #
- # Downcalls only made after certain upcalls
- #
- def mouse_down(self, detail):
- if self.child: self.child.mouse_down(detail)
- def mouse_move(self, detail):
- if self.child: self.child.mouse_move(detail)
- def mouse_up(self, detail):
- if self.child: self.child.mouse_up(detail)
- #
- def timer(self):
- if self.child: self.child.timer()
- #
- # Upcalls from child to parent
- #
- def need_mouse(self, child):
- self.parent.need_mouse(self)
- def no_mouse(self, child):
- self.parent.no_mouse(self)
- #
- def need_timer(self, child):
- self.parent.need_timer(self)
- def no_timer(self, child):
- self.parent.no_timer(self)
- #
- def begindrawing(self):
- return self.parent.begindrawing()
- def beginmeasuring(self):
- return self.parent.beginmeasuring()
- #
- def change(self, area):
- self.parent.change(area)
- def scroll(self, args):
- self.parent.scroll(args)
- def settimer(self, itimer):
- self.parent.settimer(itimer)
+ #
+ # Calls from creator
+ # NB derived classes may add parameters to create()
+ #
+ def create(self, parent):
+ parent.addchild(self)
+ self.parent = parent
+ self.child = 0 # No child yet
+ #
+ # Downcalls from parent to child
+ #
+ def destroy(self):
+ del self.parent
+ if self.child: self.child.destroy()
+ del self.child
+ #
+ def minsize(self, m):
+ if not self.child:
+ return 0, 0
+ else:
+ return self.child.minsize(m)
+ def getbounds(self, bounds):
+ if not self.child:
+ raise Error, 'getbounds w/o child'
+ else:
+ return self.child.getbounds()
+ def setbounds(self, bounds):
+ if not self.child:
+ raise Error, 'setbounds w/o child'
+ else:
+ self.child.setbounds(bounds)
+ def draw(self, args):
+ if self.child:
+ self.child.draw(args)
+ #
+ # Downcalls only made after certain upcalls
+ #
+ def mouse_down(self, detail):
+ if self.child: self.child.mouse_down(detail)
+ def mouse_move(self, detail):
+ if self.child: self.child.mouse_move(detail)
+ def mouse_up(self, detail):
+ if self.child: self.child.mouse_up(detail)
+ #
+ def timer(self):
+ if self.child: self.child.timer()
+ #
+ # Upcalls from child to parent
+ #
+ def need_mouse(self, child):
+ self.parent.need_mouse(self)
+ def no_mouse(self, child):
+ self.parent.no_mouse(self)
+ #
+ def need_timer(self, child):
+ self.parent.need_timer(self)
+ def no_timer(self, child):
+ self.parent.no_timer(self)
+ #
+ def begindrawing(self):
+ return self.parent.begindrawing()
+ def beginmeasuring(self):
+ return self.parent.beginmeasuring()
+ #
+ def change(self, area):
+ self.parent.change(area)
+ def scroll(self, args):
+ self.parent.scroll(args)
+ def settimer(self, itimer):
+ self.parent.settimer(itimer)