Ticket #1066 (new discussion)

Opened 1 year ago

Last modified 1 year ago

Sizer vertical alignment differences

Reported by: paul Assigned to: somebody
Priority: minor Milestone: 0.8.3
Component: ui Version: 0.8.1
Keywords: Cc:

Description

I've noticed some differences in how different platforms do the vertical alignment in horizontal sizers, and wanted to start a discussion of it here. I'm using the trac ticket system because I couldn't figure out how to upload images to a trac wiki.

To start the discussion, the following code is used, and screenshots made from various platforms:

#-- begin test code (copy/paste to a .py file and run it)

import dabo
dabo.ui.loadUI("wx")

class MyPanel(dabo.ui.dPanel):
  def afterInit(self):
    vs = self.Sizer = dabo.ui.dSizer("v")
    for alignment in ("top", "middle", "bottom"):
      vs.appendSpacer(10)
      hs = dabo.ui.dSizer("h")
      hs.append(dabo.ui.dLabel(self, Caption="%s:" % alignment), alignment=alignment)
      hs.append(dabo.ui.dTextBox(self))
      vs.append(hs)

if __name__ == "__main__":
        app = dabo.dApp()
        app.setup()
        pan = MyPanel(app.MainForm)
        app.start()

#-- end test code

Attachments

vert_sizer_osx_py2.5_wx2.8.4.png (9.8 kB) - added by paul on 05/19/07 11:47:10.
OS X on Python 2.5 / wxPython 2.8.4.0
vert_sizer_ubuntu_py2.5_wx2.8.4.png (4.7 kB) - added by anonymous on 05/19/07 11:51:40.
vert_sizer_win_py2.5_wx2.8.4.png (7.3 kB) - added by paul on 05/19/07 11:59:18.
label.png (47.9 kB) - added by anonymous on 05/19/07 12:13:51.

Change History

05/19/07 11:47:10 changed by paul

  • attachment vert_sizer_osx_py2.5_wx2.8.4.png added.

OS X on Python 2.5 / wxPython 2.8.4.0

05/19/07 11:51:40 changed by anonymous

  • attachment vert_sizer_ubuntu_py2.5_wx2.8.4.png added.

05/19/07 11:59:18 changed by paul

  • attachment vert_sizer_win_py2.5_wx2.8.4.png added.

05/19/07 12:01:09 changed by paul

Ok, they look fundamentally the same, so I guess my test isn't setting up the appropriate things to reproduce things I've noticed.

One thing I did notice was that on Linux, I needed to first resize the form manually in order for the sizer to layout.

(follow-up: ↓ 4 ) 05/19/07 12:13:03 changed by anonymous

Below is my code but only the last few lines apply. def afterInit(self):

self.Sizer = vs = dabo.ui.dSizer("v") gs = dabo.ui.dGridSizer(MaxCols?=10)

gs.append(dabo.ui.dLabel(self, Caption=" Species # "), halign="right",colSpan=1) lusp=RAfkLookupPanel(self, RegID='SpeciesluPanel?',TargetBizObj?=self.Form.PrimaryBizobj?,

BizObjField?='fk_species', CodeObjRegID='txtSpeciesCodeID', CodeObjFindBtnRegID='btnSpeciesCodeID', DescObjRegID='txtSpeciesNameID', DescObjFindBtnRegID='btnSpeciesNameID', LookupBizObj?=self.Form.SpeciesLookup?, LookupCodeField?='speciesnum', LookupDescField?='species', CodeInputType?='I')

gs.append(lusp,colSpan=1) gs.append(dabo.ui.dLabel(self, Caption=" Variety # "), halign="right") lustring = "'fk_species= %s' % (self.Form.SpeciesluPanel?.LookupVal?)" luvp=RAfkLookupPanel(self, RegID='VarietyluPanel?',TargetBizObj?=self.Form.PrimaryBizobj?,

BizObjField?='fk_variety', CodeObjRegID='txtVarietyCodeID', CodeObjFindBtnRegID='btnVarietyCodeID', DescObjRegID='txtVarietyNameID', DescObjFindBtnRegID='btnVarietyNameID', LookupBizObj?=self.Form.VarietyLookup?, LookupCodeField?='varnum', LookupDescField?='varname', LUFilter=lustring, CodeInputType?='I')

#gs.append(luvp,colSpan=2) gs.append(luvp) gs.appendSpacer(1) gs.appendSpacer(1) gs.appendSpacer(1) gs.appendSpacer(1) gs.appendSpacer(1) gs.appendSpacer(1) #gs.appendSpacer(1) #gs.appendSpacer(1)

gs.append(dabo.ui.dLabel(self, Caption=" Origin # "), halign="right") luop=RAfkLookupPanel(self, RegID='OriginluPanel?',TargetBizObj?=self.Form.PrimaryBizobj?,

BizObjField?='fk_origin', CodeObjRegID='txtOriginCodeID', CodeObjFindBtnRegID='btnOriginCodeID', DescObjRegID='txtOriginDescID', DescObjFindBtnRegID='btnOriginDescID', LookupBizObj?=self.Form.OriginsLookup?, LookupCodeField?='norigincode', LookupDescField?='corigindesc', CodeInputType?='I')

gs.append(luop)

gs.append(dabo.ui.dLabel(self, Caption=" Package # "), halign="right") lupp=RAfkLookupPanel(self, RegID='OriginluPanel?',TargetBizObj?=self.Form.PrimaryBizobj?,

BizObjField?='fk_origin', CodeObjRegID='txtOriginCodeID', CodeObjFindBtnRegID='btnOriginCodeID', DescObjRegID='txtOriginDescID', DescObjFindBtnRegID='btnOriginDescID', LookupBizObj?=self.Form.OriginsLookup?, LookupCodeField?='norigincode', LookupDescField?='corigindesc', CodeInputType?='I')

gs.append(lupp) gs.appendSpacer(1) gs.appendSpacer(1) gs.appendSpacer(1) gs.appendSpacer(1) gs.appendSpacer(1) gs.appendSpacer(1)

vs.append(gs,1,'x') newvs=dabo.ui.dSizer("h") newvs.appendSpacer(1) newvs.append(dabo.ui.dCheckBox(self, Caption="Consigned")) newvs.appendSpacer(1) newvs.append(dabo.ui.dLabel(self, Caption="Quantity"),alignment="middle",proportion=0) newvs.append(RANumBox(self, MinValue?=0.00,MaxValue?=999999999.9999,IntegerWidth?=9,DecimalWidth?=4),proportion=1) newvs.append(dabo.ui.dLabel(self, Caption='Price'),alignment="middle",proportion=0) newvs.append(RANumBox(self, MinValue?=0.00,MaxValue?=999999.99),proportion=1) vs.append(newvs,1,'x')

05/19/07 12:13:51 changed by anonymous

  • attachment label.png added.

05/19/07 12:32:06 changed by johnf

Running your code I don't see a difference between the settings. But if you look at my label.png you can see what happens when I use "alignment="middle". the code that applies is: newvs.append(dabo.ui.dLabel(self, Caption='Price'),alignment="middle",proportion=0)

(in reply to: ↑ 2 ) 05/19/07 13:07:04 changed by uwe_grauer

Replying to anonymous:

Below is my code but only the last few lines apply.

<- snip ->

Your code example doesn't look like a real example, so i didn't run it. Please provide something useable.

(follow-up: ↓ 6 ) 05/19/07 14:15:21 changed by johnf

I provided the code for you to review the statement not for you to run them. So explain to me how provide an example - since I need my classes for my code. Your code runs - I can see small differences between the statements. However, I can NOT see any difference between my call and your call. But my label is almost below the associated textbox (please review my snapshot).

Also if you add a checkbox to your code - notice that the label does not align with checkbox label. Add the below line to the loop in your code. hs.append(dabo.ui.dCheckBox(self, Caption="Consigned"))

(in reply to: ↑ 5 ) 05/21/07 12:03:17 changed by paul

Replying to johnf:

Also if you add a checkbox to your code - notice that the label does not align with checkbox label. Add the below line to the loop in your code. hs.append(dabo.ui.dCheckBox(self, Caption="Consigned"))

Interesting... okay, this must be what I was seeing as well. Next step: implement this test in raw wxPython and if it is there we need to ask if it is a bug or not. It sure smells like one to me!