Update of /cvsroot/pythoncard/PythonCard
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19393
Modified Files:
model.py
Log Message:
added experimental fitToComponents method for testing
Index: model.py
===================================================================
RCS file: /cvsroot/pythoncard/PythonCard/model.py,v
retrieving revision 1.186
retrieving revision 1.187
diff -C2 -d -r1.186 -r1.187
*** model.py 15 Sep 2004 19:25:06 -0000 1.186
--- model.py 24 Sep 2004 22:51:58 -0000 1.187
***************
*** 698,701 ****
--- 698,732 ----
self.panel.Layout()
+ # KEA 2004-09-24
+ # experiment to see if we could fit the panel
+ # to the boundaries of the components with a little
+ # padding to get around the problem of a static layout
+ # having too much vertical space on GTK and Mac or not
+ # enough vertical space on Windows if the layout was designed
+ # for GTK or Mac...
+ # the idea is that this would become an option in the resource
+ # that could be called automatically
+ # but I'm just testing now to see if it actually produces good results
+ def fitToComponents(self, widthPadding=None, heightPadding=5):
+ print "self.size:", self.size
+ print "self.panel.size:", self.panel.size
+ width = 0
+ height = 0
+ # height = self.panel.size
+ for c in self.components.itervalues():
+ print " ", c.name, c.position, c.size
+ x, y = c.position
+ w, h = c.size
+ width = max(x + w, width)
+ height = max(y + h, height)
+ print "width, height", width, height
+ newWidth, newHeight = self.panel.size
+ if widthPadding is not None:
+ newWidth = width + widthPadding
+ if heightPadding is not None:
+ newHeight = height + heightPadding
+ print "newWidth, newHeight", newWidth, newHeight
+ self.panel.SetSize((newWidth, newHeight))
+ self.SetClientSize((newWidth, newHeight))
# KEA 2004-05-09
|