commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue/forms.test gfclient.py manager.py parser.p...


From: Michael Maluck
Subject: gnue/forms.test gfclient.py manager.py parser.p...
Date: Sun, 02 Jun 2002 04:30:04 -0400

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     Michael Maluck <address@hidden> 02/06/02 04:30:02

Modified files:
        forms.test     : gfclient.py manager.py parser.py 
        forms.test/samples: boxLayout.gfd gridBagLayout.gfd tabPage.gfd 
        forms.test/ui/base: boxLayoutMgr.py driver.py geometry.py 
                            gridBagLayoutMgr.py widget.py widgets.py 
        forms.test/ui/webware: driver.py widget.py widgets.py 
        forms.test/ui/wxpython: driver.py widget.py widgets.py 
Added files:
        forms.test/common/forms: login.gfd 
        forms.test/samples: xyLayout.gfd 
        forms.test/ui  : config.py utils.py 
        forms.test/ui/base: xyLayoutMgr.py 
        forms.test/ui/webware: config.py 
        forms.test/ui/wxpython: config.py 

Log message:
        Many bug fixes
        New features
        New widgets
        Some code cleanup

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/gfclient.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/manager.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/parser.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/common/forms/login.gfd?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/samples/xyLayout.gfd?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/samples/boxLayout.gfd.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/samples/gridBagLayout.gfd.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/samples/tabPage.gfd.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/ui/config.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/ui/utils.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/ui/base/xyLayoutMgr.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/ui/base/boxLayoutMgr.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/ui/base/driver.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/ui/base/geometry.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/ui/base/gridBagLayoutMgr.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/ui/base/widget.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/ui/base/widgets.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/ui/webware/config.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/ui/webware/driver.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/ui/webware/widget.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/ui/webware/widgets.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/ui/wxpython/config.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/ui/wxpython/driver.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/ui/wxpython/widget.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms.test/ui/wxpython/widgets.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: gnue/forms.test/gfclient.py
diff -c gnue/forms.test/gfclient.py:1.1 gnue/forms.test/gfclient.py:1.2
*** gnue/forms.test/gfclient.py:1.1     Sat May 25 14:51:53 2002
--- gnue/forms.test/gfclient.py Sun Jun  2 04:30:01 2002
***************
*** 43,76 ****
  #output=0 #html output
  output=1 #wx output
  
! fileName = "samples/tabPage.gfd"
  
  # Add dir of gfclient.py to module search path
  scriptdir = abspath(dirname(sys.argv[0]))
  sys.path.append(scriptdir)
  
  if output == 0:
-     mgr = Manager()
      mgr.setUi("ui.webware.driver")
!     mgr.loadForm(fileName)
!     form = mgr.uiBuilder.form
      form.autoLayout()
  #    print form.size
      hw = mgr.uiDriver.HtmlWriter()
      hw.open("site.html")
!     mgr.uiBuilder.form.outputHtml(hw)
      hw.close()
      
  #    from ui.base.driver import DumpWidgetTree
  #    DumpWidgetTree(mgr.uiBuilder.form)
  
  else:
-     mgr = Manager()
      mgr.setUi("ui.wxpython.driver")
!     mgr.loadForm(fileName)
!     form = mgr.uiBuilder.form
!     form.autoLayout()
!     from ui.base.driver import DumpWidgetTree
! #    DumpWidgetTree(mgr.uiBuilder.form)
!     mgr.runForm()
  
--- 43,74 ----
  #output=0 #html output
  output=1 #wx output
  
! #fileName = "samples/test.gfd"
! fileName = "common/forms/login.gfd"
  
  # Add dir of gfclient.py to module search path
  scriptdir = abspath(dirname(sys.argv[0]))
  sys.path.append(scriptdir)
  
  if output == 0:
      mgr.setUi("ui.webware.driver")
!     form = mgr.loadForm(fileName)
      form.autoLayout()
  #    print form.size
      hw = mgr.uiDriver.HtmlWriter()
      hw.open("site.html")
!     form.outputHtml(hw)
      hw.close()
      
  #    from ui.base.driver import DumpWidgetTree
  #    DumpWidgetTree(mgr.uiBuilder.form)
  
  else:
      mgr.setUi("ui.wxpython.driver")
!     form = mgr.loadForm(fileName)
!     mgr.runForm(form)
!     #from ui.base.driver import DumpWidgetTree
!     #DumpWidgetTree(form)
!     #form = mgr.loadForm(fileName)
! #    mgr.runForm(form)
  
Index: gnue/forms.test/manager.py
diff -c gnue/forms.test/manager.py:1.1 gnue/forms.test/manager.py:1.2
*** gnue/forms.test/manager.py:1.1      Sat May 25 14:51:53 2002
--- gnue/forms.test/manager.py  Sun Jun  2 04:30:01 2002
***************
*** 47,56 ****
    def getUiBuilder(self):
      return self.uiBuilder
  
!   def runForm(self):
!     self.uiBuilder.run()
  
    def loadForm(self, fname):
      f = open(fname, "r")
!     loadXMLobject(f, self.uiBuilder)
      f.close()
--- 47,60 ----
    def getUiBuilder(self):
      return self.uiBuilder
  
!   def runForm(self, form):
!     self.uiDriver.runForm(form)
  
    def loadForm(self, fname):
      f = open(fname, "r")
!     form = loadXMLobject(f, self.uiBuilder)
      f.close()
+ 
+     return form
+ 
+ mgr = Manager()
Index: gnue/forms.test/parser.py
diff -c gnue/forms.test/parser.py:1.1 gnue/forms.test/parser.py:1.2
*** gnue/forms.test/parser.py:1.1       Sat May 25 14:51:53 2002
--- gnue/forms.test/parser.py   Sun Jun  2 04:30:01 2002
***************
*** 75,124 ****
      self.buildContext.objStack = self.objStack
      self.buildContext.createdObject = createdObject
      self.buildStack.insert(0, copy.copy(self.buildContext))
!     if createdObject != None:
!       self.buildContext.parentObject = createdObject
      self.objStack.insert(0, createdObject)
- ##    if tag == 'form':
- ##      object = self.uiBuilder.createForm(tag, saxattrs)
- ##      self.containerStack.insert(0, object)
- ##      self.curContainer = object
- 
- ##    elif tag == 'panel':
- ##      object = self.uiBuilder.createPanel(tag, saxattrs, self.curContainer)
- ##      self.containerStack.insert(0, object)
- ##      self.curContainer = object
-                                          
- ##    elif tag == 'tabPage':
- ##      object = self.uiBuilder.createTabPage(tag, saxattrs, 
self.objectStack[0])
- ##      self.containerStack.insert(0, object)
- ##      self.curContainer = object
- 
- ##    elif tag == 'label':
- ##      object = self.uiBuilder.createLabel(tag, saxattrs, self.curContainer)
- 
- ##    elif tag == 'button':
- ##      object = self.uiBuilder.createButton(tag, saxattrs, self.curContainer)
- 
- ##    elif tag == 'entry':
- ##      object = self.uiBuilder.createEntry(tag, saxattrs, self.curContainer)
-       
- ##    elif tag == 'boxLayout':
- ##      object = self.uiBuilder.createBoxLayoutMgr(tag, saxattrs, 
self.curContainer)
- 
- ##    elif tag == 'gridBagLayout':
- ##      object = self.uiBuilder.createGridBagLayoutMgr(tag, saxattrs, 
self.curContainer)
- 
- ##    elif tag == 'tabPageMgr':
- ##      object = self.uiBuilder.createTabPageMgr(tag, saxattrs, 
self.curContainer)
  
    def endElement(self, name):
      self.buildContext = self.buildStack.pop(0)
- #    if obj == self.containerStack[0]:
- #      self.containerStack.pop(0)
- #      if len(self.containerStack) > 0:
- #        self.curContainer = self.containerStack[0]
- #      else:
- #        self.curContainer = None
  
    def characters(self, ch, start, length):
      pass
--- 75,85 ----
      self.buildContext.objStack = self.objStack
      self.buildContext.createdObject = createdObject
      self.buildStack.insert(0, copy.copy(self.buildContext))
!     self.buildContext.parentObject = createdObject
      self.objStack.insert(0, createdObject)
  
    def endElement(self, name):
      self.buildContext = self.buildStack.pop(0)
  
    def characters(self, ch, start, length):
      pass
***************
*** 130,132 ****
--- 91,95 ----
    parser.setDocumentHandler(dh)
    parser.parseFile(fileHandle)
    parser.close()
+ 
+   return dh.buildContext.createdObject
Index: gnue/forms.test/samples/boxLayout.gfd
diff -c gnue/forms.test/samples/boxLayout.gfd:1.1 
gnue/forms.test/samples/boxLayout.gfd:1.2
*** gnue/forms.test/samples/boxLayout.gfd:1.1   Sat May 25 14:51:54 2002
--- gnue/forms.test/samples/boxLayout.gfd       Sun Jun  2 04:30:02 2002
***************
*** 2,12 ****
  
  <form>
      <boxLayout orientation="vertical">
!       <label insets="1;1;1;1" alignX="left" text="123456"/>
        <label alignX="right" text="456"/>
        <label alignX="left" text="78901"/>
!       <boxLayout orientation="horizontal">
!         <label text="nothing"/>
        </boxLayout>
      </boxLayout>
  </form>
--- 2,12 ----
  
  <form>
      <boxLayout orientation="vertical">
!       <label insets="0;0;0;0" alignX="left" text="123456"/>
        <label alignX="right" text="456"/>
        <label alignX="left" text="78901"/>
!       <boxLayout orientation="vertical">
!         <label alignX="center" text="nothing"/>
        </boxLayout>
      </boxLayout>
  </form>
Index: gnue/forms.test/samples/gridBagLayout.gfd
diff -c gnue/forms.test/samples/gridBagLayout.gfd:1.1 
gnue/forms.test/samples/gridBagLayout.gfd:1.2
*** gnue/forms.test/samples/gridBagLayout.gfd:1.1       Sat May 25 14:51:54 2002
--- gnue/forms.test/samples/gridBagLayout.gfd   Sun Jun  2 04:30:02 2002
***************
*** 9,14 ****
        <label text="sowas" gridWidth="remainder"/>
  <!--      <entry gridWidth="remainder"/>
        <label text="another text" gridWidth="2"/>
!       <entry gridWidth="remainder"/>-->
      </gridBagLayout>
  </form>
--- 9,14 ----
        <label text="sowas" gridWidth="remainder"/>
  <!--      <entry gridWidth="remainder"/>
        <label text="another text" gridWidth="2"/>
!       <entry fill="horizontal" gridWidth="remainder"/>-->
      </gridBagLayout>
  </form>
Index: gnue/forms.test/samples/tabPage.gfd
diff -c gnue/forms.test/samples/tabPage.gfd:1.1 
gnue/forms.test/samples/tabPage.gfd:1.2
*** gnue/forms.test/samples/tabPage.gfd:1.1     Sat May 25 14:51:54 2002
--- gnue/forms.test/samples/tabPage.gfd Sun Jun  2 04:30:02 2002
***************
*** 3,12 ****
  <form>
    <boxLayout orientation="vertical">
      <label text="Topics"/>
!     <tabPageMgr>
        <tabPage title="page1">
          <boxLayout orientation="vertical">
!           <label text="hello world. more text to make the window bigger"/>
          </boxLayout>
        </tabPage>
        <tabPage title="page2">
--- 3,12 ----
  <form>
    <boxLayout orientation="vertical">
      <label text="Topics"/>
!     <tabPageMgr insets="10;10;10;10">
        <tabPage title="page1">
          <boxLayout orientation="vertical">
!           <label alignX="left" text="hello world. more text to make the 
window bigger"/>
          </boxLayout>
        </tabPage>
        <tabPage title="page2">
***************
*** 27,31 ****
--- 27,32 ----
          </boxLayout>
        </tabPage>
      </tabPageMgr>
+     <label text="Topics"/>
    </boxLayout>
  </form>
Index: gnue/forms.test/ui/base/boxLayoutMgr.py
diff -c gnue/forms.test/ui/base/boxLayoutMgr.py:1.1 
gnue/forms.test/ui/base/boxLayoutMgr.py:1.2
*** gnue/forms.test/ui/base/boxLayoutMgr.py:1.1 Sat May 25 14:51:54 2002
--- gnue/forms.test/ui/base/boxLayoutMgr.py     Sun Jun  2 04:30:02 2002
***************
*** 38,59 ****
    X_AXIS = 0
    Y_AXIS = 1
  
-   # target is the widget container to layout
    def __init__(self, parent):
      super(BoxLayoutMgr, self).__init__(parent)
  
      self.xSizes = None
      self.ySizes = None
  
    def setAttributes(self, attrs):
      if attrs["orientation"] == "vertical":
        self.setOrientation(self.Y_AXIS)
      else:
        self.setOrientation(self.X_AXIS)
  
    def setOrientation(self, orientation):
      self.axis = orientation
!     
    def calcSizes(self):
      if self.xSizes == None or self.ySizes == None:
        self.xSizes = []
--- 38,70 ----
    X_AXIS = 0
    Y_AXIS = 1
  
    def __init__(self, parent):
      super(BoxLayoutMgr, self).__init__(parent)
  
      self.xSizes = None
      self.ySizes = None
+     self.alignX = self.ALIGN_LEFT
+     self.alignY = self.ALIGN_TOP
+     self.fill = self.FILL_BOTH
  
    def setAttributes(self, attrs):
+     super(BoxLayoutMgr, self).setAttributes(attrs)
      if attrs["orientation"] == "vertical":
        self.setOrientation(self.Y_AXIS)
      else:
        self.setOrientation(self.X_AXIS)
  
+   def getOrientation(self):
+     return self.axis
+   
    def setOrientation(self, orientation):
      self.axis = orientation
! 
!   orientation = property(getOrientation,
!                          setOrientation,
!                          None,
!                          "Layout orientation")
!                          
    def calcSizes(self):
      if self.xSizes == None or self.ySizes == None:
        self.xSizes = []
***************
*** 62,77 ****
        wl = self.getChilds()
        for w in wl:
          if not w.isVisible():
!           self.xSizes.append(SizeInfo(0,0,0,0))
!           self.ySizes.append(SizeInfo(0,0,0,0))
          else:
            w.calcSizes()
!           minSize = w.getMinSize()
!           prefSize = w.getPrefSize()
!           maxSize = w.getMaxSize()
!           self.xSizes.append(SizeInfo(minSize.width, prefSize.width, 
maxSize.width, w.getAlignX()))
!           self.ySizes.append(SizeInfo(minSize.height, prefSize.height, 
maxSize.height, w.getAlignY()))
!           #print w.getAlignX(), minSize, prefSize, maxSize
  
        if self.axis == self.X_AXIS:
          self.xTotal = self.getTiledSize(self.xSizes)
--- 73,90 ----
        wl = self.getChilds()
        for w in wl:
          if not w.isVisible():
!           self.xSizes.append(SizeInfo(0, 0, 0, 0, 0))
!           self.ySizes.append(SizeInfo(0, 0, 0, 0, 0))
          else:
            w.calcSizes()
!           minSize = w.minSize
!           prefSize = w.prefSize
!           maxSize = w.maxSize
!           self.xSizes.append(SizeInfo(minSize.width, prefSize.width, 
maxSize.width, w.alignX,
!                                       w.fill==w.FILL_HORIZONTAL or 
w.fill==w.FILL_BOTH))
!           self.ySizes.append(SizeInfo(minSize.height, prefSize.height, 
maxSize.height, w.alignY,
!                                       w.fill==w.FILL_VERTICAL or 
w.fill==w.FILL_BOTH))
!           #print w.alignX(), minSize, prefSize, maxSize
  
        if self.axis == self.X_AXIS:
          self.xTotal = self.getTiledSize(self.xSizes)
***************
*** 80,87 ****
          self.xTotal = self.getAlignedSize(self.xSizes)
          self.yTotal = self.getTiledSize(self.ySizes)
  
!       self.setMinSize(Dimension(self.xTotal.min, self.yTotal.min))
!       self.setPrefSize(Dimension(self.xTotal.pref, self.yTotal.pref))
  
    def getAlignedSize(self, sizes):
      minSize = prefSize = maxSize = 0
--- 93,100 ----
          self.xTotal = self.getAlignedSize(self.xSizes)
          self.yTotal = self.getTiledSize(self.ySizes)
  
!       self.setIMinSize(Dimension(self.xTotal.min, self.yTotal.min))
!       self.setIPrefSize(Dimension(self.xTotal.pref, self.yTotal.pref))
  
    def getAlignedSize(self, sizes):
      minSize = prefSize = maxSize = 0
***************
*** 148,189 ****
  
    def calcAlignedPositions(self, alloc, total, sizes, offsets, spans):
      for s in sizes:
!       size = total.pref
!       if alloc < size: size = alloc
!       offsets.append((size - s.pref) * s.align)
!       spans.append(min(size, s.pref))
  
    def getMinSize(self):
      self.calcSizes()
  
      size = Dimension(self.xTotal.min, self.yTotal.min)
!     insets = self.getInsets()
!     size.width = min(size.width + insets.left + insets.right, MAX_RESOLUTION)
!     size.height = min(size.height + insets.top + insets.bottom, 
MAX_RESOLUTION)
  
!     return size
!   
    def getPrefSize(self):
      self.calcSizes()
  
      size = Dimension(self.xTotal.pref, self.yTotal.pref)
!     insets = self.getInsets()
!     size.width = min(size.width + insets.left + insets.right, MAX_RESOLUTION)
!     size.height = min(size.height + insets.top + insets.bottom, 
MAX_RESOLUTION)
! 
!     return size
  
    def getMaxSize(self):
      self.calcSizes()
  
      size = Dimension(self.xTotal.max, self.yTotal.max)
!     insets = self.getInsets()
!     size.width = min(size.width + insets.left + insets.right, MAX_RESOLUTION)
!     size.height = min(size.height + insets.top + insets.bottom, 
MAX_RESOLUTION)
  
!     return size
  
!   def layoutChilds(self):
      self.calcSizes()
  
      xOffsets = []
--- 161,212 ----
  
    def calcAlignedPositions(self, alloc, total, sizes, offsets, spans):
      for s in sizes:
!       if s.fill:
!         offsets.append(0)
!         spans.append(alloc)
!       else:
!         offsets.append((alloc-s.pref) * s.align)
!         spans.append(s.pref)
!       #size = total.pref
!       #if alloc < size: size = alloc
!       #if s.fill: size = alloc
!       #offsets.append((size - s.pref) * s.align)
!       #spans.append(min(size, s.pref))
!       #print s.align
!       #spans.append(size)
  
    def getMinSize(self):
      self.calcSizes()
  
      size = Dimension(self.xTotal.min, self.yTotal.min)
!     return self._addInsets(size)
  
!   minSize = property(getMinSize, Widget.minSize.fset, None,
!                      Widget.minSize.__doc__)
!                      
    def getPrefSize(self):
      self.calcSizes()
  
      size = Dimension(self.xTotal.pref, self.yTotal.pref)
!     return self._addInsets(size)
  
+   prefSize = property(getPrefSize, Widget.prefSize.fset, None,
+                      Widget.prefSize.__doc__)
+                      
    def getMaxSize(self):
      self.calcSizes()
  
      size = Dimension(self.xTotal.max, self.yTotal.max)
!     return self._addInsets(size)
  
!   maxSize = property(getMaxSize, Widget.maxSize.fset, None,
!                      Widget.maxSize.__doc__)
  
!   def setBounds(self, bounds):
!     super(BoxLayoutMgr, self).setBounds(bounds)
!     self.layout()
!     
!   def layout(self):
      self.calcSizes()
  
      xOffsets = []
***************
*** 194,201 ****
      alloc = self.getSize()
      insets = self.getInsets()
      alloc.width -= insets.left + insets.right
!     alloc.height -+ insets.top + insets.bottom
! 
      if self.axis == self.X_AXIS:
        self.calcTiledPositions(alloc.width, self.xTotal, self.xSizes, 
xOffsets, xSpans)
        self.calcAlignedPositions(alloc.height, self.yTotal, self.ySizes, 
yOffsets, ySpans)
--- 217,223 ----
      alloc = self.getSize()
      insets = self.getInsets()
      alloc.width -= insets.left + insets.right
!     alloc.height -= insets.top + insets.bottom
      if self.axis == self.X_AXIS:
        self.calcTiledPositions(alloc.width, self.xTotal, self.xSizes, 
xOffsets, xSpans)
        self.calcAlignedPositions(alloc.height, self.yTotal, self.ySizes, 
yOffsets, ySpans)
***************
*** 211,223 ****
      for w in wl:
        x = min(insets.left + xOffsets[idx], MAX_RESOLUTION)
        y = min(insets.top + yOffsets[idx], MAX_RESOLUTION)
        self.setWidgetBounds(w, Rectangle(x, y, xSpans[idx], ySpans[idx]))
        #print("%s (x:%s,y:%s,w:%s,h:%s,ax:%s,ay:%s)" % \
        #      (w.__class__, x, y, xSpans[idx], ySpans[idx], w.absoluteX, 
w.absoluteY))
!       w.layoutChilds()
        idx += 1
  
    def setWidgetBounds(self, widget, bounds):
!       widget.setBounds(Rectangle(bounds.x, bounds.y, bounds.width, 
bounds.height))
!       widget.setAbsoluteOrigin(Point(min(self.getAbsoluteOrigin().x + 
bounds.x, MAX_RESOLUTION),
!                             min(self.getAbsoluteOrigin().y + bounds.y, 
MAX_RESOLUTION)))
--- 233,245 ----
      for w in wl:
        x = min(insets.left + xOffsets[idx], MAX_RESOLUTION)
        y = min(insets.top + yOffsets[idx], MAX_RESOLUTION)
+       #x = min(xOffsets[idx], MAX_RESOLUTION)
+       #y = min(yOffsets[idx], MAX_RESOLUTION)
        self.setWidgetBounds(w, Rectangle(x, y, xSpans[idx], ySpans[idx]))
        #print("%s (x:%s,y:%s,w:%s,h:%s,ax:%s,ay:%s)" % \
        #      (w.__class__, x, y, xSpans[idx], ySpans[idx], w.absoluteX, 
w.absoluteY))
!       #w.layoutChilds()
        idx += 1
  
    def setWidgetBounds(self, widget, bounds):
!     widget.setBounds(bounds)
Index: gnue/forms.test/ui/base/driver.py
diff -c gnue/forms.test/ui/base/driver.py:1.1 
gnue/forms.test/ui/base/driver.py:1.2
*** gnue/forms.test/ui/base/driver.py:1.1       Sat May 25 14:51:54 2002
--- gnue/forms.test/ui/base/driver.py   Sun Jun  2 04:30:02 2002
***************
*** 40,60 ****
      self.tagMap = tm
  
    def createForm(self, buildContext):
!     self.form = buildContext.classType()
!     self.form.setAttributes(buildContext.xmlAttrs)
!     self.form.createPeer()
!     #self.buildContext.form = form
!     return self.form
! 
! 
! ##not supported. maybe not needed anymore
! ##  def createPanel(self, tag, saxattrs, container):
! ##    panelClass = self.tagMap[tag][0]
! ##    panel = panelClass(container)
! ##    panel.setAttributes(saxattrs)
! ##    panel.createPeer(saxattrs)
! ##    container.addChild(panel)
! ##    return panel
    
    def createLabel(self, buildContext):
      label = buildContext.classType(buildContext.parentObject)
--- 40,49 ----
      self.tagMap = tm
  
    def createForm(self, buildContext):
!     form = buildContext.classType()
!     form.setAttributes(buildContext.xmlAttrs)
!     form.createPeer()
!     return form
    
    def createLabel(self, buildContext):
      label = buildContext.classType(buildContext.parentObject)
***************
*** 90,96 ****
      tabPage.createPeer()
      buildContext.parentObject.addChild(tabPage, buildContext.xmlAttrs)
      return tabPage
!     
    def createBoxLayoutMgr(self, buildContext):
      boxLayoutMgr = buildContext.classType(buildContext.parentObject)
      boxLayoutMgr.setAttributes(buildContext.xmlAttrs)
--- 79,92 ----
      tabPage.createPeer()
      buildContext.parentObject.addChild(tabPage, buildContext.xmlAttrs)
      return tabPage
! 
!   def createBox(self, buildContext):
!     box = buildContext.classType(buildContext.parentObject)
!     box.setAttributes(buildContext.xmlAttrs)
!     box.createPeer()
!     buildContext.parentObject.addChild(box, buildContext.xmlAttrs)
!     return box
!   
    def createBoxLayoutMgr(self, buildContext):
      boxLayoutMgr = buildContext.classType(buildContext.parentObject)
      boxLayoutMgr.setAttributes(buildContext.xmlAttrs)
***************
*** 105,113 ****
      buildContext.parentObject.addChild(gridBagLayoutMgr, 
buildContext.xmlAttrs)
      return gridBagLayoutMgr
  
!   def run(self):
!     pass
! 
  # ============================================================================
  # - Code for debugging
  # ============================================================================
--- 101,113 ----
      buildContext.parentObject.addChild(gridBagLayoutMgr, 
buildContext.xmlAttrs)
      return gridBagLayoutMgr
  
!   def createXyLayoutMgr(self, buildContext):
!     xyLayoutMgr = buildContext.classType(buildContext.parentObject)
!     xyLayoutMgr.setAttributes(buildContext.xmlAttrs)
!     xyLayoutMgr.createPeer()
!     buildContext.parentObject.addChild(xyLayoutMgr, buildContext.xmlAttrs)
!     return xyLayoutMgr
!   
  # ============================================================================
  # - Code for debugging
  # ============================================================================
Index: gnue/forms.test/ui/base/geometry.py
diff -c gnue/forms.test/ui/base/geometry.py:1.1 
gnue/forms.test/ui/base/geometry.py:1.2
*** gnue/forms.test/ui/base/geometry.py:1.1     Sat May 25 14:51:54 2002
--- gnue/forms.test/ui/base/geometry.py Sun Jun  2 04:30:02 2002
***************
*** 30,35 ****
--- 30,36 ----
  # NOTES:
  #  
  
+ from __future__ import division
  import sys
  import string
  import copy
***************
*** 38,49 ****
  # this is the maximum ui size
  MAX_RESOLUTION=sys.maxint
  
- ALIGN_LEFT = 0
- ALIGN_CENTER = 0.5
- ALIGN_RIGHT = 1
- ALIGN_TOP = 0
- ALIGN_BOTTOM = 1
- 
  # ----------------------------------------------------------------------------
  
  class Point(object):
--- 39,44 ----
***************
*** 94,104 ****
  # ----------------------------------------------------------------------------
  
  class SizeInfo:
!   def __init__(self, min = 0, pref = 0, max = 0, align = 0):
      self.min = min
      self.pref = pref
      self.max = max
      self.align = align
  
    def __repr__(self):
      return "(min:%s,pref:%s,max:%s,align:%s)" % (self.min, self.pref, 
self.max, self.align)
--- 89,100 ----
  # ----------------------------------------------------------------------------
  
  class SizeInfo:
!   def __init__(self, min = 0, pref = 0, max = 0, align = 0, fill=0):
      self.min = min
      self.pref = pref
      self.max = max
      self.align = align
+     self.fill = fill
  
    def __repr__(self):
      return "(min:%s,pref:%s,max:%s,align:%s)" % (self.min, self.pref, 
self.max, self.align)
***************
*** 118,123 ****
--- 114,130 ----
  # ----------------------------------------------------------------------------
  
  class GeometryObject(Hierarchy):
+   ALIGN_LEFT = 0
+   ALIGN_CENTER = 0.5
+   ALIGN_RIGHT = 1
+   ALIGN_TOP = 0
+   ALIGN_BOTTOM = 1
+ 
+   FILL_NONE = 0
+   FILL_BOTH = 1
+   FILL_HORIZONTAL = 2
+   FILL_VERTICAL = 3
+   
    alignXMap = { "left": ALIGN_LEFT,
                  "center": ALIGN_CENTER,
                  "right": ALIGN_RIGHT }
***************
*** 125,130 ****
--- 132,142 ----
    alignYMap = { "top": ALIGN_TOP,
                  "center": ALIGN_RIGHT,
                  "bottom": ALIGN_BOTTOM }
+ 
+   fillMap = { "none": FILL_NONE,
+               "both": FILL_BOTH,
+               "horizontal": FILL_HORIZONTAL,
+               "vertical": FILL_VERTICAL }
    
    def __init__(self, parent = None):
      super(GeometryObject, self).__init__(parent)
***************
*** 136,144 ****
      self._maxSize = Dimension(MAX_RESOLUTION, MAX_RESOLUTION)
      self._size = Dimension(0, 0)
      self._valid = False
      self._insets = Insets(0, 0, 0, 0)
!     self.alignX = ALIGN_LEFT
!     self.alignY = ALIGN_TOP
  
    def getInsets(self):
      return self._insets
--- 148,159 ----
      self._maxSize = Dimension(MAX_RESOLUTION, MAX_RESOLUTION)
      self._size = Dimension(0, 0)
      self._valid = False
+     self._fill = self.FILL_NONE
      self._insets = Insets(0, 0, 0, 0)
!     self._alignX = self.ALIGN_LEFT
!     self._alignY = self.ALIGN_TOP
! 
!   # ----------------------------------------
  
    def getInsets(self):
      return self._insets
***************
*** 149,254 ****
    insets = property(getInsets, setInsets, None,
                      "Widget insets")
    
    def getSize(self):
!     return copy.copy(self._size)
    
    def setSize(self, size):
!     self._size = size
  
    size = property(getSize, setSize, None,
                    "Current size of the widget")
  
    def getPrefSize(self):
!     size = self._prefSize
!     insets = self.insets
!     return Dimension(size.width + insets.left + insets.right,
!                 size.height + insets.top + insets.bottom)
  
    def setPrefSize(self, size):
!     width = size.width - (self._insets.left + self._insets.right)
!     if width < 0: width = 0
!     height = size.height - (self._insets.top + self._insets.bottom)
!     if height < 0: height = 0
!     self._prefSize = Dimension(width, height)
  
-   def setIPrefSize(self, size):
-     self._prefSize = size
-     
    prefSize = property(getPrefSize, setPrefSize, None,
                        "Preferred size of the widget")
  
!   def getMinSize(self):
!     size = self._minSize
!     insets = self.insets
!     return Dimension(size.width + insets.left + insets.right,
!                 size.height + insets.top + insets.bottom)
  
!   def setMinSize(self, size):
!     width = size.width - (self._insets.left + self._insets.right)
!     if width < 0: width = 0
!     height = size.height - (self._insets.top + self._insets.bottom)
!     if height < 0: height = 0
!     self._minSize = Dimension(width, height)
  
    def setIMinSize(self, size):
!     self._minSize = size
!     
!   minSize = property(getMinSize, setMinSize, None,
!                      "Minimum size required to display the widget")
  
!   def getMaxSize(self):
!     size = self._maxSize
!     insets = self.insets
!     return Dimension(size.width + insets.left + insets.right,
!                 size.height + insets.top + insets.bottom)
  
!   def setMaxSize(self, size):
!     width = size.width - (self._insets.left + self._insets.right)
!     if width < 0: width = 0
!     height = size.height - (self._insets.top + self._insets.bottom)
!     if height < 0: height = 0
!     self._maxSize = Dimension(width, height)
  
    def setIMaxSize(self, size):
!     self._maxSize = size
!     
!   maxSize = property(getMaxSize, setMaxSize, None,
!                      "Maximum size of the widget")
  
    def getOrigin(self):
      return self._origin
  
    def setOrigin(self, origin):
!     self._origin = origin
  
    origin = property(getOrigin, setOrigin, None,
                      "Widget origin relative to parent")
  
    def setAbsoluteOrigin(self, origin):
!     self._absoluteOrigin = origin
  
!   def setAlignX(self, align):
!     self.alignX = align
  
!   def setAlignY(self, align):
!     self.alignY = align
  
!   def getAbsoluteOrigin(self):
!     return self._absoluteOrigin
    
!   def getInsets(self):
!     return self.insets
  
    def getAlignX(self):
!     return self.alignX
  
    def getAlignY(self):
!     return self.alignY
  
    def setBounds(self, bounds):
      self.setOrigin(Point(bounds.x, bounds.y))
      self.setSize(Dimension(bounds.width, bounds.height))
  
    def validate(self):    
      if self._size.width < self._minSize.width:
        self._size.width = self._minSize.width
--- 164,357 ----
    insets = property(getInsets, setInsets, None,
                      "Widget insets")
    
+   # ----------------------------------------
+ 
+   def _addInsets(self, size):
+     insets = self._insets
+     return Dimension(
+       size.width + insets.left + insets.right,
+       size.height + insets.top + insets.bottom)
+ 
+   def _subInsets(self, size):
+     insets = self._insets
+     return Dimension(
+       size.width - (insets.left + insets.right),
+       size.height - (insets.top + insets.bottom))
+   
+   # ----------------------------------------
+ 
    def getSize(self):
!     return self._addInsets(self._size)
    
    def setSize(self, size):
!     self._size = self._subInsets(size)
  
    size = property(getSize, setSize, None,
                    "Current size of the widget")
  
+   # ----------------------------------------
+   
+   def getMinSize(self):
+     return self._addInsets(self._minSize)
+   
+   def setMinSize(self, size):
+     self._minSize = self._subInsets(size)
+     
+   minSize = property(getMinSize, setMinSize, None,
+                      "Minimum size required to display the widget")
+ 
+   # ----------------------------------------
+   
    def getPrefSize(self):
!     return self._addInsets(self._prefSize)
  
    def setPrefSize(self, size):
!     self._prefSize = self._subInsets(size)
  
    prefSize = property(getPrefSize, setPrefSize, None,
                        "Preferred size of the widget")
  
!   # ----------------------------------------
!   
!   def getMaxSize(self):
!     return self._addInsets(self._maxSize)
!   
!   def setMaxSize(self, size):
!     self._maxSize = self._subInsets(size)
!     
!   maxSize = property(getMaxSize, setMaxSize, None,
!                      "Maximum size of the widget")
  
!   # ----------------------------------------
! 
!   def getISize(self):
!     return copy.copy(self._size)
  
+   def setISize(self, size):
+     self._size = copy.copy(size)
+ 
+   iSize = property(getISize, setISize, None,
+                    "Widget inner size (without insets)")
+ 
+   # ----------------------------------------
+ 
+   def getIMinSize(self):
+     return copy.copy(self._minSize)
+   
    def setIMinSize(self, size):
!     self._minSize = copy.copy(size)
  
!   iMinSize = property(getIMinSize, setIMinSize, None,
!                       "Minimum inner size (without insets)")
  
!   # ----------------------------------------
  
+   def getIPrefSize(self):
+     return copy.copy(self._prefSize)
+   
+   def setIPrefSize(self, size):
+     self._prefSize = copy.copy(size)
+ 
+   iPrefSize = property(getIPrefSize, setIPrefSize, None,
+                        "Preffered inner size (without insets)")
+ 
+   # ----------------------------------------
+ 
+   def getIMaxSize(self):
+     return copy.copy(self._maxSize)
+   
    def setIMaxSize(self, size):
!     self._maxSize = copy.copy(size)
! 
!   iMaxSize = property(getIMaxSize, setIMaxSize, None,
!                       "Maximum inner size (without insets)")
  
+   # ----------------------------------------
+                       
    def getOrigin(self):
      return self._origin
  
    def setOrigin(self, origin):
!     self._origin = copy.copy(origin)
!     if self._parent != None:
!       parentOrigin = self._parent.absoluteOrigin
!     else:
!       parentOrigin = Point(0, 0)
!       
!     self.absoluteOrigin = Point(parentOrigin.x + origin.x,
!                                 parentOrigin.y + origin.y)
  
    origin = property(getOrigin, setOrigin, None,
                      "Widget origin relative to parent")
  
+   # ----------------------------------------
+   
+   def getAbsoluteOrigin(self):
+     #return copy.copy(self._absoluteOrigin)
+     return self._absoluteOrigin
+   
    def setAbsoluteOrigin(self, origin):
!     self._absoluteOrigin = copy.copy(origin)
  
!   absoluteOrigin = property(getAbsoluteOrigin, setAbsoluteOrigin, None,
!                             "Origin relative to top level form's origin")
  
!   # ----------------------------------------
  
!   def getIAbsoluteOrigin(self):
!     return Point(self._absoluteOrigin.x + self._insets.left,
!                  self._absoluteOrigin.y + self._insets.top)
! 
!   iAbsoluteOrigin = property(getIAbsoluteOrigin,
!                              None,
!                              None,
!                              "AbsoluteOrigin + left and top insets")
    
!   # ----------------------------------------
! 
!   def setAlignX(self, align):
!     self._alignX = align
  
    def getAlignX(self):
!     return self._alignX
! 
!   alignX = property(getAlignX, setAlignX, "Horizontal alignment")
  
+   # ----------------------------------------
+   
    def getAlignY(self):
!     return self._alignY
! 
!   def setAlignY(self, align):
!     self._alignY = align
  
+   alignY = property(getAlignY, setAlignY, "Vertical alignment")
+ 
+   # ----------------------------------------
+   
+   def getFill(self):
+     return self._fill
+ 
+   def setFill(self, fill):
+     self._fill = fill
+ 
+   fill = property(getFill, setFill, "Fill in more space if available")
+ 
+   # ----------------------------------------
+   
    def setBounds(self, bounds):
      self.setOrigin(Point(bounds.x, bounds.y))
      self.setSize(Dimension(bounds.width, bounds.height))
  
+   def getBounds(self):
+     origin = self.origin
+     size = self.size  
+     return Rectangle(origin.x, origin.y, size.width, size.height)
+ 
+   bounds = property(getBounds, setBounds, "Widget bounds")
+ 
+   # ----------------------------------------
+ 
    def validate(self):    
      if self._size.width < self._minSize.width:
        self._size.width = self._minSize.width
***************
*** 269,272 ****
        insets = attrs["insets"]
        l,t,r,b = string.split(insets, ";")
        self.insets = Insets(int(l), int(t), int(r), int(b))
!   
--- 372,383 ----
        insets = attrs["insets"]
        l,t,r,b = string.split(insets, ";")
        self.insets = Insets(int(l), int(t), int(r), int(b))
!     if "x" in attrs:
!       self.origin.x = int(attrs["x"])
!       self.absoluteOrigin.x = int(attrs["x"])
!     if "y" in attrs:
!       self.origin.y = int(attrs["y"])
!       self.absoluteOrigin.y = int(attrs["y"])
!     if "fill" in attrs:
!       self._fill = self.fillMap[attrs["fill"]]
!       
Index: gnue/forms.test/ui/base/gridBagLayoutMgr.py
diff -c gnue/forms.test/ui/base/gridBagLayoutMgr.py:1.1 
gnue/forms.test/ui/base/gridBagLayoutMgr.py:1.2
*** gnue/forms.test/ui/base/gridBagLayoutMgr.py:1.1     Sat May 25 14:51:54 2002
--- gnue/forms.test/ui/base/gridBagLayoutMgr.py Sun Jun  2 04:30:02 2002
***************
*** 31,36 ****
--- 31,37 ----
  #  
  
  from widget import *
+ from string import *
  
  # ----------------------------------------------------------------------------
  
***************
*** 98,109 ****
                  'northwest': 18,
                  }
  
-   fillMap = { 'none': 0,
-               'both': 1,
-               'horizontal': 2,
-               'vertical': 3,
-               }
- 
    def __init__(self, parent):
      super(GridBagLayoutMgr, self).__init__(parent)
      
--- 99,104 ----
***************
*** 113,118 ****
--- 108,114 ----
      self.rowHeights = None
      self.columnWeights = None
      self.rowWeights = None
+     self.fill = self.FILL_BOTH
      self.defaultConstraints = GridBagConstraints()
  
    def setConstraints(self, widget, constraints):
***************
*** 149,154 ****
--- 145,156 ----
  
      return dimensions
  
+   def setOrigin(self, origin):
+     super(GridBagLayoutMgr, self).setOrigin(origin)
+     if self.layoutInfo != None:
+       self.layoutInfo.startx = origin.x
+       self.layoutInfo.starty = origin.y
+     
    def getLayoutWeights(self):
      if self.layoutInfo == None:
        weights = [ None, None ]
***************
*** 207,221 ****
          constraints.weightY = float(attrs['weightY'])
        if attrs.has_key('anchor'):
          constraints.anchor = self.anchorMap[attrs['anchor']]
-       if attrs.has_key('fill'):
-         constraints.fill = self.fillMap[attrs['fill']]
        if attrs.has_key('insets'):
!         left, top, right, bottom = split(attrs['insets'], ",")
          constraints.insets = Insets(int(left), int(top), int(right), 
int(bottom))
        if attrs.has_key('ipadx'):
          constraints.iPadX = int(attrs['ipadx'])
        if attrs.has_key('ipady'):
          constraints.iPadY = int(attrs['ipady'])
      else:
        constraints = None
                                
--- 209,222 ----
          constraints.weightY = float(attrs['weightY'])
        if attrs.has_key('anchor'):
          constraints.anchor = self.anchorMap[attrs['anchor']]
        if attrs.has_key('insets'):
!         left, top, right, bottom = split(attrs['insets'], ";")
          constraints.insets = Insets(int(left), int(top), int(right), 
int(bottom))
        if attrs.has_key('ipadx'):
          constraints.iPadX = int(attrs['ipadx'])
        if attrs.has_key('ipady'):
          constraints.iPadY = int(attrs['ipady'])
+       constraints.fill = widget.fill
      else:
        constraints = None
                                
***************
*** 235,253 ****
    def getMaxSize(self):
      return Dimension(MAX_RESOLUTION, MAX_RESOLUTION)
  
!   def getAlignX(self):
!     return 0.5
! 
!   def getAlignY(self):
!     return 0.5
! 
!   def layoutChilds(self):
      self.arrangeGrid()
  
    def getLayoutInfo(self, sizeFlag):
      r = GridBagLayoutInfo()
      wl = self.getChilds()
  
      r.width = r.height = 0
      curRow = curCol = -1
      xMax = self.MAXGRIDSIZE*[0]
--- 236,251 ----
    def getMaxSize(self):
      return Dimension(MAX_RESOLUTION, MAX_RESOLUTION)
  
!   def layout(self):
      self.arrangeGrid()
  
    def getLayoutInfo(self, sizeFlag):
      r = GridBagLayoutInfo()
      wl = self.getChilds()
  
+     # Pass #1
+     # Figure out the dimensions of the layout grid (use a value of 1 for
+     # zero or negative widths and heights).
      r.width = r.height = 0
      curRow = curCol = -1
      xMax = self.MAXGRIDSIZE*[0]
***************
*** 267,272 ****
--- 265,271 ----
        if curHeight <= 0:
          curHeight = 1
  
+       # If x or y is negative, then use relative positioning: */
        if curX < 0 and curY < 0:
          if curRow >= 0:
            curY = curRow
***************
*** 293,298 ****
--- 292,298 ----
          if curY < 0:
            curY = 0
  
+       # Adjust the grid width and height
        px = curX + curWidth
        while r.width < px:
          r.width += 1
***************
*** 300,305 ****
--- 300,306 ----
        while r.height < py:
          r.height += 1
  
+       # Adjust the xMax and yMax arrays
        i = curX
        while i < curX + curWidth:
          yMax[i] = py
***************
*** 309,314 ****
--- 310,316 ----
          xMax[i] = px
          i += 1
  
+       # Cache the current slave's size.
        if sizeFlag == self.PREFERREDSIZE:
          d = widget.getPrefSize()
        else:
***************
*** 316,335 ****
--- 318,347 ----
        constraints.minWidth = d.width
        constraints.minHeight = d.height
  
+       # Zero width and height must mean that this is the last item (or
+       # else something is wrong). */
        if constraints.gridHeight == 0 and constraints.gridWidth == 0:
          curRow = curCol = -1
  
+       # Zero width starts a new row
        if constraints.gridHeight == 0 and curRow < 0:
          curCol = curX + curWidth
  
+       # Zero height starts a new column
        elif constraints.gridWidth == 0 and curCol < 0:
          curRow = curY + curHeight
  
+     # Apply minimum row/column dimensions
      if self.columnWidths != None and r.width < len(self.columnWidth):
        r.width = len(columnWidths)
      if self.rowHeights != None and r.height < len(self.rowHeights):
        r.height = len(self.rowHeights)
  
+     # Pass #2
+     # Negative values for gridX are filled in with the current x value.
+     # Negative values for gridY are filled in with the current y value.
+     # Negative or zero values for gridWidth and gridHeight end the current
+     # row or column, respectively.
      curRow = curCol = -1
      xMax = self.MAXGRIDSIZE * [0]
      yMax = self.MAXGRIDSIZE * [0]
***************
*** 344,349 ****
--- 356,362 ----
        curWidth = constraints.gridWidth
        curHeight = constraints.gridHeight
  
+       # If x or y is negative, then use relative positioning:
        if curX < 0 and curY < 0:
          if curRow >= 0:
            curY = curRow
***************
*** 405,410 ****
--- 418,424 ----
          xMax[i] = px
          i += 1
  
+       # Make negative sizes start a new row/column
        if constraints.gridHeight == 0 and constraints.gridWidth == 0:
          curRow = curCol = -1
        if constraints.gridHeight == 0 and curRow < 0:
***************
*** 412,422 ****
--- 426,438 ----
        elif constraints.gridWidth == 0 and curCol < 0:
          curRow = curY + curHeight
  
+       # Assign the new values to the gridbag slave
        constraints.tempX = curX
        constraints.tempY = curY
        constraints.tempWidth = curWidth
        constraints.tempHeight = curHeight
  
+     # Apply minimum row/column dimensions and weights
      if self.columnWidths != None:
        for i in range(len(self.columnWidths)):
          r.minWidth[i] = self.columnWidths[i]
***************
*** 430,435 ****
--- 446,453 ----
        for i in range(len(rowWeights)):
          r.weightY[i] = self.rowWeights[i]
  
+     # Pass #3
+     # Distribute the minimun widths and weights:
      nextSize = MAX_RESOLUTION
  
      i = 1
***************
*** 442,447 ****
--- 460,469 ----
          if constraints.tempWidth == i:
            px = constraints.tempX + constraints.tempWidth
  
+         # Figure out if we should use this slave\'s weight.  If the weight
+         # is less than the total weight spanned by the width of the cell,
+         # then discard the weight.  Otherwise split the difference
+         # according to the existing weights.
            weight_diff = constraints.weightX
            k = constraints.tempX
            while k < px:
***************
*** 461,468 ****
--- 483,496 ----
                weight_diff -= dx
                weight -= wt
                k += 1
+           # Assign the remainder to the rightmost cell
              r.weightX[px-1] += weight_diff
  
+         # Calculate the minWidth array values.
+         # First, figure out how wide the current slave needs to be.
+         # Then, see if it will fit within the current minWidth values.
+         # If it will not fit, add the difference according to the
+         # weightX array.
            pixels_diff = \
                        constraints.minWidth + constraints.iPadX + \
                        constraints.insets.left + constraints.insets.right
***************
*** 484,489 ****
--- 512,518 ----
                r.minWidth[k] += dx
                pixels_diff -= dx
                weight -= wt
+               k += 1
              r.minWidth[px-1] += pixels_diff
          elif constraints.tempWidth > i and constraints.tempWidth < nextSize:
            nextSize = constraints.tempWidth
***************
*** 491,496 ****
--- 520,529 ----
          if constraints.tempHeight == i:
            py = constraints.tempY + constraints.tempHeight
  
+         # Figure out if we should use this slave\'s weight.  If the weight
+         # is less than the total weight spanned by the height of the cell,
+         # then discard the weight.  Otherwise split it the difference
+         # according to the existing weights.
            weight_diff = constraints.weightY
            k = constraints.tempY
            while k < py:
***************
*** 512,517 ****
--- 545,555 ----
                k += 1
              r.weightY[py-1] += weight_diff
  
+         # Calculate the minHeight array values.
+         # First, figure out how tall the current slave needs to be.
+         # Then, see if it will fit within the current minHeight values.
+         # If it will not fit, add the difference according to the
+         # weightY array.
            pixels_diff = \
                        constraints.minHeight + constraints.iPadY + \
                        constraints.insets.top + constraints.insets.bottom
***************
*** 533,538 ****
--- 571,577 ----
                pixels_diff -= dy
                weight -= wt
                k += 1
+           # Any leftovers go into the bottom cell
              r.minHeight[py-1] += pixels_diff
          elif constraints.tempHeight > i and constrainte.tempHeight < nextSize:
            nextSize = constraints.tempHeight
***************
*** 695,721 ****
  
        self.adjustForGravity(constraints, r)
        self.setWidgetBounds(widget, r)
!       widget.layoutChilds()
  
    def setWidgetBounds(self, widget, bounds):
!     origin = widget.getOrigin()
!     absOrigin = widget.getAbsoluteOrigin()
!     if bounds.width <= 0 or bounds.height <= 0:
!       widget.setBounds(0,0,0,0)
!       widget.setAbsolutePosition(min(self.absoluteX, MAX_RESOLUTION),
!                                  min(self.absoluteY, MAX_RESOLUTION))
!     elif origin.x != bounds.x or origin.y != bounds.y or widget.size.width != 
bounds.width \
!              or widget.size.height != bounds.height:
!       #print widget.__class__, bounds.x, bounds.y, bounds.width, bounds.height
!       widget.setBounds(Rectangle(bounds.x, bounds.y, bounds.width, 
bounds.height))
!       widget.setAbsoluteOrigin(Point(min(absOrigin.x + bounds.x, 
MAX_RESOLUTION),
!                                      min(absOrigin.y + bounds.y, 
MAX_RESOLUTION)))
  
    def calcSizes(self):
      wl = self.getChilds()
      for widget in wl:
        widget.calcSizes()
      info = self.getLayoutInfo(self.MINSIZE)
!     minSize = self.calcSize(info)
      info = self.getLayoutInfo(self.PREFERREDSIZE)
!     prefSize = self.calcSize(info)
--- 734,754 ----
  
        self.adjustForGravity(constraints, r)
        self.setWidgetBounds(widget, r)
!       widget.layout()
  
    def setWidgetBounds(self, widget, bounds):
!     widget.setBounds(bounds)
  
    def calcSizes(self):
      wl = self.getChilds()
      for widget in wl:
        widget.calcSizes()
      info = self.getLayoutInfo(self.MINSIZE)
!     self.iMinSize = self.calcSize(info)
      info = self.getLayoutInfo(self.PREFERREDSIZE)
!     self.iPrefSize = self.calcSize(info)
! 
!   def setBounds(self, bounds):
!     super(GridBagLayoutMgr, self).setBounds(bounds)
!     self.layout()
!     
Index: gnue/forms.test/ui/base/widget.py
diff -c gnue/forms.test/ui/base/widget.py:1.1 
gnue/forms.test/ui/base/widget.py:1.2
*** gnue/forms.test/ui/base/widget.py:1.1       Sat May 25 14:51:54 2002
--- gnue/forms.test/ui/base/widget.py   Sun Jun  2 04:30:02 2002
***************
*** 56,60 ****
    def calcSizes(self):
      pass
        
!   def layoutChilds(self):
      pass
--- 56,60 ----
    def calcSizes(self):
      pass
        
!   def layout(self):
      pass
Index: gnue/forms.test/ui/base/widgets.py
diff -c gnue/forms.test/ui/base/widgets.py:1.1 
gnue/forms.test/ui/base/widgets.py:1.2
*** gnue/forms.test/ui/base/widgets.py:1.1      Sat May 25 14:51:54 2002
--- gnue/forms.test/ui/base/widgets.py  Sun Jun  2 04:30:02 2002
***************
*** 50,63 ****
      self.setMinSize(lm.getMinSize())
      self.setPrefSize(lm.getPrefSize())
      
!   def layoutChilds(self):
      childs = self.getChilds()
      if len(childs) == 0: return
      lm = childs[0]
      lm.setOrigin(Point(0, 0))
      lm.setAbsoluteOrigin(Point(0, 0))
      lm.setSize(self.getSize())
!     lm.layoutChilds()
  
    def autoLayout(self):
      self.calcSizes()
--- 50,63 ----
      self.setMinSize(lm.getMinSize())
      self.setPrefSize(lm.getPrefSize())
      
!   def layout(self):
      childs = self.getChilds()
      if len(childs) == 0: return
      lm = childs[0]
      lm.setOrigin(Point(0, 0))
      lm.setAbsoluteOrigin(Point(0, 0))
      lm.setSize(self.getSize())
!     lm.layout()
  
    def autoLayout(self):
      self.calcSizes()
***************
*** 68,74 ****
      if size.height > maxSize.height:
        size.height = maxSize.height
      self.setSize(size)
!     self.layoutChilds()
      
  # ----------------------------------------------------------------------------
  
--- 68,74 ----
      if size.height > maxSize.height:
        size.height = maxSize.height
      self.setSize(size)
!     self.layout()
      
  # ----------------------------------------------------------------------------
  
***************
*** 119,124 ****
--- 119,125 ----
  
  class Entry(Widget):
    def setAttributes(self, attrs):
+     super(Entry, self).setAttributes(attrs)
      self.calcSizes()
    
  # ----------------------------------------------------------------------------
***************
*** 130,167 ****
    RIGHT = 4
  
    def __init__(self, parent):
!     Widget.__init__(self, parent)
      self.tabPlacement = self.TOP
!     self.pageList = []
  
    def getTabPlacement(self):
      return self.tabPlacement
  
!   def addPage(self, page, attrs):
!     self.pageList.append(page)
! 
!   def selectPageAt(self, index):
      pass
    
-   def removePageAt(self, index):
-     del self.pageList[index]
- 
    def focusPageAt(self, index):
      pass
  
  # ----------------------------------------------------------------------------
  
  class TabPage(Widget):
    def setAttributes(self, attrs):
      Widget.setAttributes(self, attrs)
      
      if attrs.has_key("title"):
        self.title = attrs['title']
-     else:
-       self.title = "notitle"
  
    def getTitle(self):
!     return self.title
    
  # ----------------------------------------------------------------------------
  
--- 131,211 ----
    RIGHT = 4
  
    def __init__(self, parent):
!     super(TabPageMgr, self).__init__(parent)
      self.tabPlacement = self.TOP
!     self.pageList = self._childs
  
    def getTabPlacement(self):
      return self.tabPlacement
  
!   def selectPage(self, index):
      pass
    
    def focusPageAt(self, index):
      pass
  
  # ----------------------------------------------------------------------------
  
  class TabPage(Widget):
+   def __init__(self, parent):
+     super(TabPage, self).__init__(parent)
+     self._title = "notitle"
+ 
    def setAttributes(self, attrs):
      Widget.setAttributes(self, attrs)
      
      if attrs.has_key("title"):
        self.title = attrs['title']
  
+   # ----------------------------------------
+   
    def getTitle(self):
!     return self._title
! 
!   def setTitle(self, title):
!     self._title = title
! 
!   title = property(getTitle, setTitle, None,
!                    "Title of the tab page")
    
  # ----------------------------------------------------------------------------
  
+ class Box(Widget):
+   def __init__(self, parent):
+     super(Box, self).__init__(parent)
+     self.title = ""
+ 
+   def setAttributes(self, attrs):
+     super(Box, self).setAttributes(attrs)
+     if attrs.has_key("title"):
+       self.title = attrs['title']
+ 
+   def calcSizes(self):
+     childs = self.getChilds()
+     if len(childs) == 0:
+       return
+ 
+     lm = childs[0]
+     lm.calcSizes()
+     minSize = lm.minSize
+     minSize.width += self.BORDER_SIZE_LEFT + self.BORDER_SIZE_RIGHT
+     minSize.height += self.BORDER_SIZE_TOP + self.BORDER_SIZE_BOTTOM
+     prefSize = lm.prefSize
+     prefSize.width += self.BORDER_SIZE_LEFT + self.BORDER_SIZE_RIGHT
+     prefSize.height += self.BORDER_SIZE_TOP + self.BORDER_SIZE_BOTTOM
+ 
+     self.iMinSize = minSize
+     self.iPrefSize = prefSize
+ 
+   def setBounds(self, bounds):
+     Widget.setBounds(self, bounds)
+     childs = self.getChilds()
+     if len(childs) == 0:
+       return
+     lm = childs[0]
+     insets = self.insets
+     bounds.x = self.BORDER_SIZE_LEFT + insets.left
+     bounds.y = self.BORDER_SIZE_TOP + insets.top
+     bounds.width -= self.BORDER_SIZE_LEFT + self.BORDER_SIZE_RIGHT + 
insets.left + insets.right
+     bounds.height -= self.BORDER_SIZE_TOP + self.BORDER_SIZE_BOTTOM + 
insets.top + insets.bottom
+     lm.setBounds(bounds)
Index: gnue/forms.test/ui/webware/driver.py
diff -c gnue/forms.test/ui/webware/driver.py:1.1 
gnue/forms.test/ui/webware/driver.py:1.2
*** gnue/forms.test/ui/webware/driver.py:1.1    Sat May 25 14:51:54 2002
--- gnue/forms.test/ui/webware/driver.py        Sun Jun  2 04:30:02 2002
***************
*** 34,50 ****
  
  from widgets import *
  import ui.base.driver
!      
  tagMap = {
    'form': [ HtmlForm, "createForm" ],
    'label': [ HtmlLabel, "createLabel" ],
    'button': [ HtmlButton, "createButton" ],
    'entry': [ HtmlEntry, "createEntry" ],
    'boxLayout': [ HtmlBoxLayoutMgr, "createBoxLayoutMgr" ],
    'gridBagLayout': [ HtmlGridBagLayoutMgr, "createGridBagLayoutMgr" ],
! ##  'panel': [ HtmlPanel, "createHtmlPanel" ],
! ##  'tabPageMgr': [ HtmlTabPageMgr, "createTabPageMgr" ],
! ##  'tabPage': [ HtmlTabPage, "createTabPage" ],
  }
  
  BuilderClass = ui.base.driver.Builder
--- 34,54 ----
  
  from widgets import *
  import ui.base.driver
! 
  tagMap = {
    'form': [ HtmlForm, "createForm" ],
    'label': [ HtmlLabel, "createLabel" ],
    'button': [ HtmlButton, "createButton" ],
    'entry': [ HtmlEntry, "createEntry" ],
+   'tabPageMgr': [ HtmlTabPageMgr, "createTabPageMgr" ],
+   'tabPage': [ HtmlTabPage, "createTabPage" ],
+   'box': [ HtmlBox, "createBox" ],
    'boxLayout': [ HtmlBoxLayoutMgr, "createBoxLayoutMgr" ],
    'gridBagLayout': [ HtmlGridBagLayoutMgr, "createGridBagLayoutMgr" ],
!   'xyLayout': [ HtmlXyLayoutMgr, "createXyLayoutMgr" ],
  }
+ 
+ def runForm(form):
+     pass
  
  BuilderClass = ui.base.driver.Builder
Index: gnue/forms.test/ui/webware/widget.py
diff -c gnue/forms.test/ui/webware/widget.py:1.1 
gnue/forms.test/ui/webware/widget.py:1.2
*** gnue/forms.test/ui/webware/widget.py:1.1    Sat May 25 14:51:54 2002
--- gnue/forms.test/ui/webware/widget.py        Sun Jun  2 04:30:02 2002
***************
*** 31,47 ****
  #  
  
  from ui.base.geometry import *
  
  class HtmlWidget:
!   def getIOrigin(self):
!     """Inner widget position regarding to insets"""
!     origin = self.getAbsoluteOrigin()
!     insets = self.insets
!     return Point(origin.x + insets.left,
!                  origin.y + insets.top)
! 
!   def getISize(self):
!     size = self.size
!     insets = self.insets
!     return Dimension(size.width - (insets.left + insets.right),
!                      size.height - (insets.top + insets.bottom))
--- 31,38 ----
  #  
  
  from ui.base.geometry import *
+ from config import *
  
  class HtmlWidget:
!   def __init__(self, parent):
!     pass
Index: gnue/forms.test/ui/webware/widgets.py
diff -c gnue/forms.test/ui/webware/widgets.py:1.1 
gnue/forms.test/ui/webware/widgets.py:1.2
*** gnue/forms.test/ui/webware/widgets.py:1.1   Sat May 25 14:51:54 2002
--- gnue/forms.test/ui/webware/widgets.py       Sun Jun  2 04:30:02 2002
***************
*** 30,46 ****
  # NOTES:
  #  
  
  from widget import *
  from ui.base.widgets import *
  from ui.base.boxLayoutMgr import *
  from ui.base.gridBagLayoutMgr import *
  
- SCALE_X = 9
- SCALE_Y = 21
- BORDER = 1
- 
- FONT_SIZE = 16
- 
  class HtmlWriter:
    def __init__(self):
      self._stream = None
--- 30,45 ----
  # NOTES:
  #  
  
+ #SCALE_X=9
+ #SCALE_Y=21
+ 
+ from __future__ import division
  from widget import *
  from ui.base.widgets import *
  from ui.base.boxLayoutMgr import *
+ from ui.base.xyLayoutMgr import *
  from ui.base.gridBagLayoutMgr import *
  
  class HtmlWriter:
    def __init__(self):
      self._stream = None
***************
*** 109,149 ****
      self.closeTag('html')
  
  class HtmlLabel(HtmlWidget, Label):
    def outputHtml(self, htmlWriter):
!     position = self.getIOrigin()
      htmlWriter.writeln('<div 
style="position:absolute;left:%s;top:%s">%s</div>' % ( \
!       position.x*SCALE_X, position.y*SCALE_Y+3, self.text))
  
    def calcSizes(self):
!     self.setIMinSize(Dimension(len(self.text), 1))
!     self.setIPrefSize(Dimension(len(self.text), 1))
  
  class HtmlButton(HtmlWidget, Button):
    def outputHtml(self, htmlWriter):
!     position = self.getIOrigin()
!     size = self.getISize()
      htmlWriter.writeln('<input 
style="position:absolute;left:%s;top:%s;width:%spt" type="button" value="%s"/>' 
% ( \
!       position.x*SCALE_X, position.y*SCALE_Y, size.width*SCALE_X, self.label))
  
    def calcSizes(self):
!     self.setIMinSize(Dimension(len(self.label) + 1, 1))
!     self.setIPrefSize(Dimension(len(self.label) + 1, 1))
  
  class HtmlEntry(HtmlWidget, Entry):
    def outputHtml(self, htmlWriter):
!     position = self.getIOrigin()
      htmlWriter.writeln('<input style="position:absolute;left:%s;top:%s" 
type="text"/>' % ( \
!       position.x*SCALE_X, position.y*SCALE_Y))
  
    def calcSizes(self):
!     self.setIMinSize(Dimension(21, 1))
!     self.setIPrefSize(Dimension(21,1))
      
- ##class HtmlPanel(Panel):
- ##  def outputHtml(self, htmlWriter):
- ##    for widget in self.getChilds():
- ##      widget.outputHtml(htmlWriter)
- 
  class HtmlForm(Form):
    def _outputStartTag(self, htmlWriter):
      htmlWriter.openTag('form')
--- 108,155 ----
      self.closeTag('html')
  
  class HtmlLabel(HtmlWidget, Label):
+   def __init__(self, parent):
+     HtmlWidget.__init__(self, parent)
+     Label.__init__(self, parent)
+     
    def outputHtml(self, htmlWriter):
!     position = self.iAbsoluteOrigin
      htmlWriter.writeln('<div 
style="position:absolute;left:%s;top:%s">%s</div>' % ( \
!       position.x, position.y, self.text))
  
    def calcSizes(self):
!     self.setIMinSize(Dimension(len(self.text) * SCALE_X, SCALE_Y))
!     self.setIPrefSize(Dimension(len(self.text) * SCALE_X, SCALE_Y))
  
  class HtmlButton(HtmlWidget, Button):
+   def __init__(self, parent):
+     HtmlWidget.__init__(self, parent)
+     Button.__init__(self, parent)
+     
    def outputHtml(self, htmlWriter):
!     position = self.iAbsoluteOrigin
!     size = self.iSize
      htmlWriter.writeln('<input 
style="position:absolute;left:%s;top:%s;width:%spt" type="button" value="%s"/>' 
% ( \
!       position.x, position.y, size.width, self.label))
  
    def calcSizes(self):
!     self.setIMinSize(Dimension((len(self.label) + 2) * SCALE_X, SCALE_Y))
!     self.setIPrefSize(Dimension((len(self.label) + 2) * SCALE_X, SCALE_Y))
  
  class HtmlEntry(HtmlWidget, Entry):
+   def __init__(self, parent):
+     HtmlWidget.__init__(self, parent)
+     Entry.__init__(self, parent)
+     
    def outputHtml(self, htmlWriter):
!     position = self.iAbsoluteOrigin
      htmlWriter.writeln('<input style="position:absolute;left:%s;top:%s" 
type="text"/>' % ( \
!       position.x, position.y))
  
    def calcSizes(self):
!     self.setIMinSize(Dimension(21 * SCALE_X, SCALE_Y))
!     self.setIPrefSize(Dimension(21 * SCALE_X, SCALE_Y))
      
  class HtmlForm(Form):
    def _outputStartTag(self, htmlWriter):
      htmlWriter.openTag('form')
***************
*** 159,164 ****
--- 165,251 ----
  
      self._outputEndTag(htmlWriter)
  
+ class HtmlTabPageMgr(TabPageMgr):
+   def __init__(self, parent):
+     TabPageMgr.__init__(self, parent)
+     self.head = ""
+     self.currentPage = -1
+     self.headSize = Dimension(0, 0)
+ 
+   def addChild(self, page, attrs):
+     super(HtmlTabPageMgr, self).addChild(page, attrs)
+     self.selectPage(self.currentPage)
+ 
+   def outputHtml(self, htmlWriter):
+     position = self.iAbsoluteOrigin
+     htmlWriter.writeln('<div 
style="position:absolute;left:%s;top:%s">%s</div>' % ( \
+       position.x, position.y, self.head))
+     
+     pages = self.pageList
+     if self.currentPage < 0 or self.currentPage > len(pages):
+       return
+     
+     pages[self.currentPage].outputHtml(htmlWriter)
+ 
+   def selectPage(self, index):
+     idx = 0
+     pages = self.pageList
+     if index < 0 or index > len(pages):
+       if len(pages) > 0:
+         index = 0
+ 
+     self.currentPage = index
+     self.head = ""
+     for page in pages:
+       if idx == index:
+         self.head = self.head + "[" + page.title + "]"
+       else:
+         self.head = self.head + "&nbsp;" + page.title + "&nbsp;"
+       idx = idx + 1
+ 
+   def calcSizes(self):
+     minSize = Dimension(0, 0)
+     prefSize = Dimension(0, 0)
+     for page in self.pageList:
+       page.calcSizes()
+       tpMinSize = page.minSize
+       tpPrefSize = page.prefSize
+       if tpMinSize.width > minSize.width:
+         minSize.width = tpMinSize.width
+       if tpMinSize.height > minSize.height:
+         minSize.height = tpMinSize.height
+       if tpPrefSize.width > prefSize.width:
+         prefSize.width = tpPrefSize.width
+       if tpPrefSize.height > prefSize.height:
+         prefSize.height = tpPrefSize.height
+ 
+     headSize = Dimension((len(self.head) + 2) * SCALE_X, SCALE_Y)
+     self.headSize = headSize
+ 
+     if headSize.width > minSize.width:
+       minSize.width = headSize.width
+     if headSize.width > prefSize.width:
+       prefSize.width = headSize.width
+ 
+     minSize.height = minSize.height + headSize.height
+     prefSize.height = prefSize.height + headSize.height
+     
+     self.iMinSize = minSize
+     self.iPrefSize = prefSize
+ 
+   def setBounds(self, bounds):
+     super(HtmlTabPageMgr, self).setBounds(bounds)
+     self.layout()
+ 
+   def layout(self):
+     size = self.size
+     insets = self.insets
+     bounds = Rectangle(insets.left, self.headSize.height + insets.top,
+                        size.width, size.height - self.headSize.height)
+     pages = self.pageList
+     for page in pages:
+       page.setBounds(bounds)
+     
  class HtmlBoxLayoutMgr(BoxLayoutMgr):
    def outputHtml(self, htmlWriter):
      for widget in self.getChilds():
***************
*** 169,213 ****
      for widget in self.getChilds():
        widget.outputHtml(htmlWriter)
  
! ##class HtmlTabPageMgr(TabPageMgr):
! ##  def __init__(self, parent):
! ##    TabPageMgr.__init__(self, parent)
!     
! ##    bl = BoxLayoutMgr(self)
! ##    bl.setOrientation(BoxLayoutMgr.Y_AXIS)
! ##    self.setLayoutMgr(bl)
! 
! ##    self.chooser = HtmlPanel(self)
! ##    bl = BoxLayoutMgr(self.chooser)
! ##    bl.setOrientation(BoxLayoutMgr.X_AXIS)
! ##    self.chooser.setLayoutMgr(bl)
! ##    self.add(self.chooser, None)
! 
! ##    self.currentPage = -1
! 
! ##  def addPage(self, page, attrs):
! ##    TabPageMgr.addPage(self, page, attrs)
! ##    label = HtmlLabel(self.chooser)
! ##    label.setText(page.getTitle())
! ##    self.chooser.add(label)
! ##    if len(self.pageList) == 1:
! ##      self.selectPageAt(0)
! 
! ##  def outputHtml(self, htmlWriter):    
! ##    for widget in self.widgetList:
! ##      widget.outputHtml(htmlWriter)
! 
! ##  def selectPageAt(self, index):
! ##    if self.currentPage >= 0:
! ##      label = self.chooser.widgetList[self.currentPage]
! ##      label.setText(label.getText()[1:-1])
! ##      del self.widgetList[1]
! ##    currentPage = index
! ##    label = self.chooser.widgetList[index]
! ##    label.setText("[" + label.getText() + "]")
! ##    self.add(self.pageList[index], None)
! 
! ##class HtmlTabPage(TabPage):
! ##  def outputHtml(self, htmlWriter):
! ##    for widget in self.widgetList:
! ##      widget.outputHtml(htmlWriter)
--- 256,300 ----
      for widget in self.getChilds():
        widget.outputHtml(htmlWriter)
  
! class HtmlTabPage(HtmlBoxLayoutMgr, TabPage):
!   def __init__(self, parent):
!     HtmlBoxLayoutMgr.__init__(self, parent)
!     TabPage.__init__(self, parent)
!     self.orientation = self.Y_AXIS
! 
!   def setAttributes(self, attrs):
!     TabPage.setAttributes(self, attrs)
! 
! class HtmlBox(HtmlWidget, Box):
!   BORDER_SIZE_TOP = 21
!   BORDER_SIZE_LEFT = 10
!   BORDER_SIZE_RIGHT = 10
!   BORDER_SIZE_BOTTOM = 10
! 
!   def __init__(self, parent):
!     HtmlWidget.__init__(self, parent)
!     Box.__init__(self, parent)
! 
!   def outputHtml(self, htmlWriter):
!     position = self.iAbsoluteOrigin
!     titlePos = self.iAbsoluteOrigin
!     titlePos.x += self.BORDER_SIZE_LEFT
!     position.y += 6
!     size = self.iSize
!     size.height -= 12
!     
!     htmlWriter.writeln('<div 
style="position:absolute;left:%s;top:%s;width:%s;height:%s;border:solid 
1px">&nbsp;</div>' % ( \
!       position.x, position.y, size.width, size.height))
!     htmlWriter.writeln('<div 
style="position:absolute;left:%s;top:%s;background:#FFFFFF">%s</div>' % ( \
!       titlePos.x, titlePos.y , self.title))
! 
!     childs = self.getChilds()
!     if len(childs) == 0:
!       return
!     childs[0].outputHtml(htmlWriter)
!   
! class HtmlXyLayoutMgr(XyLayoutMgr):
!   def outputHtml(self, htmlWriter):
!     for widget in self.getChilds():
!       widget.outputHtml(htmlWriter)
!       
Index: gnue/forms.test/ui/wxpython/driver.py
diff -c gnue/forms.test/ui/wxpython/driver.py:1.1 
gnue/forms.test/ui/wxpython/driver.py:1.2
*** gnue/forms.test/ui/wxpython/driver.py:1.1   Sat May 25 14:51:54 2002
--- gnue/forms.test/ui/wxpython/driver.py       Sun Jun  2 04:30:02 2002
***************
*** 34,39 ****
--- 34,40 ----
  
  from widgets import *
  from ui.base.driver import *
+ from manager import *
  
  # ----------------------------------------------------------------------------
  
***************
*** 42,124 ****
    'label': [ WxLabel, "createLabel" ],
    'button': [ WxButton, "createButton" ],
    'entry': [ WxEntry, "createEntry" ],
-   'boxLayout': [ WxBoxLayoutMgr, "createBoxLayoutMgr" ],
-   'gridBagLayout': [ WxGridBagLayoutMgr, "createGridBagLayoutMgr" ],
    'tabPageMgr': [ WxTabPageMgr, "createTabPageMgr" ],
    'tabPage': [ WxTabPage, "createTabPage" ],
    }
  
  # ----------------------------------------------------------------------------
  
! class WxBuilder(Builder):
!   def __init__(self):
!     wxApp.OnInit = lambda self: true
!     self.wxApp = wxApp()
! 
!   def run(self):
!     Builder.run(self)
!     formPeer = self.form.peer
!     sizer = formPeer.GetSizer()
!     #print sizer.CalcMin()
!     #print sizer.GetMinSize()
!     formPeer.GetSizer().Fit(formPeer)
!     formPeer.Show(true)
!     self.wxApp.SetTopWindow(formPeer)
! #    DumpWidgetTree(self.form)
!     self.wxApp.MainLoop()
! 
! ##  def chainLayoutMgr(self, container):
! ##    parentContainer = container.getParentContainer()
! ##    if parentContainer != None:
! ##      parentLmp = parentContainer.getLayoutMgrPeer()
! ##      childLmp = container.getTopLevelLayoutMgrPeer()
! ##      if parentLmp != None and childLmp != None:
! ##        parentLmp.Add(childLmp)
! ##        print "[registerLayoutMgr] current: %s parent: %s" % 
(container.__class__, parentContainer.__class__)
      
! ##  def createTabPageMgr(self, tag, saxattrs, container):
! ##    tabPageMgrClass = self.tag2ClassMap[tag][0]
! ##    tabPageMgr = tabPageMgrClass(container)
! ##    tabPageMgr.setAttributes(saxattrs)
! ##    tabPageMgr.createPeer(saxattrs)
! ##    #WARNING: Using container.add will add the widget
! ##    #         to the layout manager that is used for
! ##    #         the container. Doing this for wxNotebook
! ##    #         sizes the wxNotebook wrong!
! ##    #         As recommended workaround the createPeer
! ##    #         method adds a wxNotebookSizer to the
! ##    #         peer sizer of the container
! ##    #container.add(tabPageMgr, saxattrs)
! ##    container.widgetList.append(tabPageMgr)
! ##    return tabPageMgr
! 
! #  def createBoxLayoutMgr(self, buildContext):
! #    boxLayoutMgr = Builder.createBoxLayoutMgr(self, buildContext)
! #    self.chainLayoutMgr(container)
! #    return boxLayoutMgr
! 
! ##  def createGridBagLayoutMgr(self, tag, saxattrs, container):
! ##    gridBagLayoutMgr = Builder.createGridBagLayoutMgr(self, tag, saxattrs, 
container)
! ##    self.chainLayoutMgr(container)
! ##    return gridBagLayoutMgr
! 
! ##  def createLabel(self, tag, saxattrs, container):
! ##    label = Builder.createLabel(self, tag, saxattrs, container)
! ##    sizer = container.getLayoutMgr()
! ##    sizer.addWidget(label, saxattrs)
! ##    return label
! 
! ##  def createButton(self, tag, saxattrs, container):
! ##    button = Builder.createButton(self, tag, saxattrs, container)
! ##    sizer = container.getLayoutMgr()
! ##    sizer.addWidget(button, saxattrs)
! ##    return button
! 
! ##  def createEntry(self, tag, saxattrs, container):
! ##    entry = Builder.createEntry(self, tag, saxattrs, container)
! ##    sizer = container.getLayoutMgr()
! ##    sizer.addWidget(entry, saxattrs)
! ##    return entry
    
  # ----------------------------------------------------------------------------
  
--- 43,84 ----
    'label': [ WxLabel, "createLabel" ],
    'button': [ WxButton, "createButton" ],
    'entry': [ WxEntry, "createEntry" ],
    'tabPageMgr': [ WxTabPageMgr, "createTabPageMgr" ],
    'tabPage': [ WxTabPage, "createTabPage" ],
+   'box': [ WxBox, "createBox" ],
+   'boxLayout': [ WxBoxLayoutMgr, "createBoxLayoutMgr" ],
+   'gridBagLayout': [ WxGridBagLayoutMgr, "createGridBagLayoutMgr" ],
+   'xyLayout': [ WxXyLayoutMgr, "createXyLayoutMgr" ],
    }
  
  # ----------------------------------------------------------------------------
  
! class FormsApplication(wxApp):
!   def OnInit(self):
! #    form = mgr.loadForm("common/forms/login.gfd")
! #    formPeer = form.peer
! #    formPeer.GetSizer().Fit(formPeer)
! #    formPeer.Show(true)
!     return true
      
! # ----------------------------------------------------------------------------
! 
! class WxBuilder(Builder):
!   pass
! 
! # ----------------------------------------------------------------------------
! 
! def runForm(form):
!   application = FormsApplication()
!   formPeer = form.peer
!   sizer = formPeer.GetSizer()
!   sizer.Fit(formPeer)
!   formPeer.Show(true)
!   
!   application.SetTopWindow(formPeer)
!   #DumpWidgetTree(form)
!   application.MainLoop()
!   #print formPeer.GetSizer()
    
  # ----------------------------------------------------------------------------
  
Index: gnue/forms.test/ui/wxpython/widget.py
diff -c gnue/forms.test/ui/wxpython/widget.py:1.1 
gnue/forms.test/ui/wxpython/widget.py:1.2
*** gnue/forms.test/ui/wxpython/widget.py:1.1   Sat May 25 14:51:54 2002
--- gnue/forms.test/ui/wxpython/widget.py       Sun Jun  2 04:30:02 2002
***************
*** 33,39 ****
  
  # ----------------------------------------------------------------------------
  
! class WxWidget:
    def getParentWxWindow(self):
      parent = self.parent
      while parent != None:
--- 33,39 ----
  
  # ----------------------------------------------------------------------------
  
! class WxWidget(Widget):
    def getParentWxWindow(self):
      parent = self.parent
      while parent != None:
***************
*** 52,75 ****
  
    def calcSizes(self):
      if self.peer != None:
!       size = self.peer.GetBestSize()
!       self.minSize = Dimension(size.x, size.y)
!       self.prefSize = Dimension(size.x, size.y)
! 
    def getMinSize(self):
      self.calcSizes()
!     return self.minSize
  
    def getPrefSize(self):
      self.calcSizes()
!     return self.prefSize
  
!   def setBounds(self, bounds):
!     Widget.setBounds(self, bounds)
      if self.peer != None:
!       self.peer.SetSize(wxSize(bounds.width, bounds.height))
  
    def setAbsoluteOrigin(self, origin):
!     Widget.setAbsoluteOrigin(self, origin)
      if self.peer != None:
!       self.peer.SetPosition(wxPoint(origin.x, origin.y))
--- 52,125 ----
  
    def calcSizes(self):
      if self.peer != None:
!       size = self._wx2size(self.peer.GetBestSize())
!       self.iMinSize = size
!       self.iPrefSize = size
! 
!   def _size2wx(self, size):
!     return wxSize(size.width, size.height)
! 
!   def _wx2size(self, size):
!     return Dimension(size.x, size.y)
!   
!   # ----------------------------------------
!   
    def getMinSize(self):
      self.calcSizes()
!     return self._addInsets(self._minSize)
! 
!   minSize = property(getMinSize,
!                      Widget.minSize.fset,
!                      Widget.minSize.fdel,
!                      Widget.minSize.__doc__)
! 
!   # ----------------------------------------
! 
!   def setMaxSize(self, size):
!     super(WxWidget, self).setMaxSize(size)
!     if self.peer != None:
!       self.peer.SetSizeHints(-1, -1,
!                              self._maxSize.width, self._maxSize.height)
  
+   maxSize = property(Widget.maxSize.fget,
+                      setMaxSize,
+                      Widget.maxSize.fdel,
+                      Widget.maxSize.__doc__)
+   
+   # ----------------------------------------
+   
    def getPrefSize(self):
      self.calcSizes()
!     return self._addInsets(self._prefSize)
  
!   prefSize = property(getPrefSize,
!                       Widget.prefSize.fset,
!                       Widget.prefSize.fdel,
!                       Widget.prefSize.__doc__)
! 
!   # ----------------------------------------
! 
!   def setSize(self, size):
!     super(WxWidget, self).setSize(size)
      if self.peer != None:
!       self.peer.SetSize(self._size2wx(self._subInsets(size)))
! 
!   size = property(Widget.size.fget,
!                   setSize,
!                   Widget.size.fdel,
!                   Widget.size.__doc__)
  
+   # ----------------------------------------
+   
    def setAbsoluteOrigin(self, origin):
!     insets = self.insets
!     super(WxWidget, self).setAbsoluteOrigin(origin)
      if self.peer != None:
!       position = wxPoint(origin.x + insets.left, origin.y + insets.top)
!       self.peer.SetPosition(position)
! 
!   absoluteOrigin = property(Widget.absoluteOrigin.fget,
!                             setAbsoluteOrigin,
!                             Widget.absoluteOrigin.fdel,
!                             Widget.absoluteOrigin.__doc__)
! 
Index: gnue/forms.test/ui/wxpython/widgets.py
diff -c gnue/forms.test/ui/wxpython/widgets.py:1.1 
gnue/forms.test/ui/wxpython/widgets.py:1.2
*** gnue/forms.test/ui/wxpython/widgets.py:1.1  Sat May 25 14:51:54 2002
--- gnue/forms.test/ui/wxpython/widgets.py      Sun Jun  2 04:30:02 2002
***************
*** 34,39 ****
--- 34,40 ----
  from ui.base.widgets import *
  from ui.base.boxLayoutMgr import *
  from ui.base.gridBagLayoutMgr import *
+ from ui.base.xyLayoutMgr import *
  from widget import *
  
  # ----------------------------------------------------------------------------
***************
*** 99,129 ****
      TabPageMgr.addChild(self, page, attrs)
      self.peer.AddPage(page.getPeer(), page.getTitle())
  
!   def getMinSize(self):
!     size = self.notesizer.CalcMin()
!     return Dimension(size.width, size.height)
! 
!   def getPrefSize(self):
!     self.notesizer.RecalcSizes()
!     size = self.peer.GetSize()
! 
!     minSize = self.notesizer.CalcMin()
!     if minSize.width > size.width:
!       size.width = minSize.width
!     if minSize.height > size.height:
!       size.height = minSize.height
        
!     return Dimension(size.width, size.height)
  
    def setBounds(self, bounds):
      TabPageMgr.setBounds(self, bounds)
!     self.notesizer.SetDimension(bounds.x, bounds.y, bounds.width, 
bounds.height)
  
    def calcSizes(self):
!     self.minSize = self.getMinSize()
!     self.prefSize = self.getPrefSize()
  
!   def layoutChilds(self):
      self.notesizer.Layout()
  
  #  def setAbsoluteOrigin(self, origin):
--- 100,133 ----
      TabPageMgr.addChild(self, page, attrs)
      self.peer.AddPage(page.getPeer(), page.getTitle())
  
! ##  def getMinSize(self):
! ##    size = self.notesizer.CalcMin()
! ##    return Dimension(size.width, size.height)
! 
! ##  def getPrefSize(self):
! ##    self.notesizer.RecalcSizes()
! ##    size = self.peer.GetSize()
! 
! ##    minSize = self.notesizer.CalcMin()
! ##    if minSize.width > size.width:
! ##      size.width = minSize.width
! ##    if minSize.height > size.height:
! ##      size.height = minSize.height
        
! ##    return Dimension(size.width, size.height)
  
    def setBounds(self, bounds):
      TabPageMgr.setBounds(self, bounds)
!     origin = self.iAbsoluteOrigin
!     size = self.iSize
!     self.notesizer.SetDimension(origin.x, origin.y, size.width, size.height)
  
    def calcSizes(self):
!     size = self._wx2size(self.notesizer.CalcMin())
!     self.iMinSize = size
!     self.iPrefSize = size
  
!   def layout(self):
      self.notesizer.Layout()
  
  #  def setAbsoluteOrigin(self, origin):
***************
*** 135,156 ****
    def createPeer(self):
      self.peer = wxPanel(self.parent.getPeer(), -1)
  
!   def setLayoutMgr(self, layoutMgr):
!     TabPage.setLayoutMgr(self, layoutMgr)
!     self.peer.SetAutoLayout(true)
!     self.peer.SetSizer(layoutMgr.getPeer())
  
    def addChild(self, layoutMgr, buildContext):
      TabPage.addChild(self, layoutMgr, buildContext)
      self.peer.SetAutoLayout(true)
      self.peer.SetSizer(layoutMgr.getPeer())
  
    def calcSizes(self):
!     self.minSize = self.peer.GetSizer().CalcMin
!     self.prefSize = self.minSize
  
!   def layoutChilds(self):
!     self.peer.GetSizer().RecalcSizes()
      
  # ----------------------------------------------------------------------------
  
--- 139,182 ----
    def createPeer(self):
      self.peer = wxPanel(self.parent.getPeer(), -1)
  
! ##  def setLayoutMgr(self, layoutMgr):
! ##    TabPage.setLayoutMgr(self, layoutMgr)
! ##    self.peer.SetAutoLayout(true)
! ##    self.peer.SetSizer(layoutMgr.getPeer())
  
    def addChild(self, layoutMgr, buildContext):
      TabPage.addChild(self, layoutMgr, buildContext)
      self.peer.SetAutoLayout(true)
      self.peer.SetSizer(layoutMgr.getPeer())
  
+ #  def calcSizes(self):
+ #    self.minSize = self.peer.GetSizer().CalcMin
+ #    self.prefSize = self.minSize
+     
+   def layout(self):
+     self.peer.GetSizer().RecalcSizes()
+     
+ # ----------------------------------------------------------------------------
+ 
+ class WxBox(WxWidget, Box):
+   BORDER_SIZE_TOP = 20
+   BORDER_SIZE_LEFT = 10
+   BORDER_SIZE_RIGHT = 10
+   BORDER_SIZE_BOTTOM = 10
+   
+   def __init__(self, parent):
+     WxWidget.__init__(self, parent)
+     Box.__init__(self, parent)
+ 
+   def createPeer(self):
+     pwxw = self.getParentWxWindow()
+     self.peer = wxStaticBox(pwxw, -1, self.title)
+ 
    def calcSizes(self):
!     Box.calcSizes(self)
  
!   def setBounds(self, bounds):
!     Box.setBounds(self, bounds)
      
  # ----------------------------------------------------------------------------
  
***************
*** 162,180 ****
    def CalcMin(self):
      size = self.GetSize()
      self.boxLayoutMgr.setSize(Dimension(size.x, size.y))
!     self.boxLayoutMgr.calcSizes()
      minSize = self.boxLayoutMgr.minSize
      return wxSize(minSize.width, minSize.height)
  
    def RecalcSizes(self):
      size = self.GetSize()
      self.boxLayoutMgr.setSize(Dimension(size.x, size.y))
!     #size = self.GetSize()
!     #self.boxLayoutMgr.setSize(size.width, size.height)
!     #self.boxLayoutMgr.calcSizes()
!     self.boxLayoutMgr.layoutChilds()
!     #self.boxLayoutMgr.target.validate()
!     #print "RecalcSizes:", self.boxLayoutMgr.getPeer().GetPosition()
  
  # ----------------------------------------------------------------------------
  
--- 188,201 ----
    def CalcMin(self):
      size = self.GetSize()
      self.boxLayoutMgr.setSize(Dimension(size.x, size.y))
!     #self.boxLayoutMgr.calcSizes()
      minSize = self.boxLayoutMgr.minSize
      return wxSize(minSize.width, minSize.height)
  
    def RecalcSizes(self):
      size = self.GetSize()
      self.boxLayoutMgr.setSize(Dimension(size.x, size.y))
!     self.boxLayoutMgr.layout()
  
  # ----------------------------------------------------------------------------
  
***************
*** 187,205 ****
      else:
        raise RuntimeError, 'BoxContainer._orientation invalid'
  
-     #self.peer = wxBoxSizer(wxOrientation)
      self.peer = WxBoxLayoutMgrPeer(self)
  
-   #def addWidget(self, widget, attrs):
-   #  BoxLayoutMgr.add(self, widget)
-   #self.peer.Add(widget.peer, 0, wxALL, 0)
- 
-   def setWidgetBounds(self, widget, bounds):
-     origin = self.getAbsoluteOrigin()
-     widget.setBounds(Rectangle(bounds.x, bounds.y, bounds.width, 
bounds.height))
-     widget.setAbsoluteOrigin(Point(min(origin.x + bounds.x, MAX_RESOLUTION),
-                           min(origin.y + bounds.y, MAX_RESOLUTION)))
- 
  # ----------------------------------------------------------------------------
  
  class WxGridBagLayoutMgrPeer(wxPySizer):
--- 208,215 ----
***************
*** 215,224 ****
  
    def RecalcSizes(self):
      size = self.GetSize()
!     self.gidBagLayoutMgr.setSize(Dimension(size.x, size.y))
      #size = self.GetSize()
      #self.gridBagLayoutMgr.setSize(size.width, size.height)
!     self.gridBagLayoutMgr.layoutChilds()
      #self.gridBagLayoutMgr.target.validate()
  
  # ----------------------------------------------------------------------------
--- 225,234 ----
  
    def RecalcSizes(self):
      size = self.GetSize()
!     self.gridBagLayoutMgr.setSize(Dimension(size.x, size.y))
      #size = self.GetSize()
      #self.gridBagLayoutMgr.setSize(size.width, size.height)
!     self.gridBagLayoutMgr.layout()
      #self.gridBagLayoutMgr.target.validate()
  
  # ----------------------------------------------------------------------------
***************
*** 227,241 ****
    def createPeer(self):
      self.peer = WxGridBagLayoutMgrPeer(self)
  
!   def setWidgetBounds(self, widget, bounds):
!     origin = self.getAbsoluteOrigin()
  
!     if bounds.width <= 0 or bounds.height <= 0:
!       widget.setBounds(0,0,0,0)
!       widget.setAbsolutePosition(min(origin.x, MAX_RESOLUTION),
!                                  min(origin.y, MAX_RESOLUTION))
!     elif widget.origin.x != bounds.x or widget.origin.y != bounds.y or 
widget.size.width != bounds.width \
!          or widget.size.height != bounds.height:
!       widget.setBounds(Rectangle(bounds.x, bounds.y, bounds.width, 
bounds.height))
!       widget.setAbsoluteOrigin(Point(min(origin.x + bounds.x, MAX_RESOLUTION),
!                                  min(origin.y + bounds.y, MAX_RESOLUTION)))
--- 237,263 ----
    def createPeer(self):
      self.peer = WxGridBagLayoutMgrPeer(self)
  
! # ----------------------------------------------------------------------------
! 
! class WxXyLayoutMgrPeer(wxPySizer):
!   def __init__(self, xyLayoutMgr):
!     wxPySizer.__init__(self)
!     self.xyLayoutMgr = xyLayoutMgr
! 
!   def CalcMin(self):
!     size = self.GetSize()
!     self.xyLayoutMgr.setSize(Dimension(size.x, size.y))
!     self.xyLayoutMgr.calcSizes()
!     minSize = self.xyLayoutMgr.minSize
!     return wxSize(minSize.width, minSize.height)
! 
!   def RecalcSizes(self):
!     size = self.GetSize()
!     self.xyLayoutMgr.setSize(Dimension(size.x, size.y))
!     self.xyLayoutMgr.layout()
! 
! # ----------------------------------------------------------------------------
  
! class WxXyLayoutMgr(XyLayoutMgr):
!   def createPeer(self):
!     self.peer = WxXyLayoutMgrPeer(self)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]