problems with grid layout

Can anyone see anything odd with the parenting or other layout
related things in the attached screenshot ?

The problem being that the grid showing the measurements does
not properly fit itself into the panel it is shown on:

- it bleeds into the sizer/widgets below it
- it doesn't effect a vertical scrollbar despite being "too large" vertically
- it doesn't sufficiently expand horizontally to fully fit the columns
  (the last column is slightly clipped which probably makes it show
   a horizontal scrollbar)
- it does not expand into the available horizontal space

Here are relevant parts of the grid class that's used:

screenshot_001.png

wxgMeasurementsPnl.py (6.3 KB)

···

#---------------------------
class cMeasurementsGrid(wx.grid.Grid):

  def __init__(self, *args, **kwargs):

    wx.grid.Grid.__init__(self, *args, **kwargs)

    self.__patient = None
    self.__panel_to_show = None
    self.__show_by_panel = False
    self.__cell_data = {}
    self.__row_label_data = []

    self.__prev_row = None
    self.__prev_col = None
    self.__prev_label_row = None
    self.__date_format = str((_('lab_grid_date_format::%Y\n%b %d')).lstrip('lab_grid_date_format::'))

    self.__init_ui()
    self.__register_events()

  def __init_ui(self):
    self.CreateGrid(0, 1)
    self.EnableEditing(0)
    self.EnableDragGridSize(1)
    self.SetMinSize(wx.DefaultSize)

    # row labels
    self.SetRowLabelSize(wx.grid.GRID_AUTOSIZE) # starting with 2.8.8
    self.SetRowLabelAlignment(horiz = wx.ALIGN_LEFT, vert = wx.ALIGN_CENTRE)
    font = self.GetLabelFont()
    font.SetWeight(wx.FONTWEIGHT_LIGHT)
    self.SetLabelFont(font)

    # add link to left upper corner
    url = u'http://www.laborlexikon.de'

    self.__WIN_corner = self.GetGridCornerLabelWindow() # a wx.Window instance

    LNK_lab = wx.lib.hyperlink.HyperLinkCtrl (
      self.__WIN_corner,
      -1,
      label = _('Tests'),
      style = wx.HL_DEFAULT_STYLE # wx.TE_READONLY|wx.TE_CENTRE| wx.NO_BORDER |
    )
    LNK_lab.SetURL(url)
    LNK_lab.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_BACKGROUND))

    SZR_inner = wx.BoxSizer(wx.HORIZONTAL)
    SZR_inner.Add((20, 20), 1, wx.EXPAND, 0) # spacer
    SZR_inner.Add(LNK_lab, 0, wx.ALIGN_CENTER_VERTICAL, 0) #wx.ALIGN_CENTER wx.EXPAND
    SZR_inner.Add((20, 20), 1, wx.EXPAND, 0) # spacer

    SZR_corner = wx.BoxSizer(wx.VERTICAL)
    SZR_corner.Add((20, 20), 1, wx.EXPAND, 0) # spacer
    SZR_corner.AddWindow(SZR_inner, 0, wx.EXPAND) # inner sizer with centered hyperlink
    SZR_corner.Add((20, 20), 1, wx.EXPAND, 0) # spacer

    self.__WIN_corner.SetSizer(SZR_corner)
    SZR_corner.Fit(self.__WIN_corner)

#---------------------------

I also attach the wxGlade generated code that is used
to populate the panel representing the notebook page.

Thanks a lot,
Karsten
--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

Karsten Hilbert wrote:

Can anyone see anything odd with the parenting or other layout
related things in the attached screenshot ?

The problem being that the grid showing the measurements does
not properly fit itself into the panel it is shown on:

- it bleeds into the sizer/widgets below it
- it doesn't effect a vertical scrollbar despite being "too large" vertically
- it doesn't sufficiently expand horizontally to fully fit the columns
   (the last column is slightly clipped which probably makes it show
    a horizontal scrollbar)
- it does not expand into the available horizontal space

Here are relevant parts of the grid class that's used:

Please make a runnable, small as possible, sample application that
demonstrates the problem, and let us know the platform and wx version.
http://wiki.wxpython.org/MakingSampleApps

···

--
Robin Dunn
Software Craftsman

>Can anyone see anything odd with the parenting or other layout
>related things in the attached screenshot ?
>
>The problem being that the grid showing the measurements does
>not properly fit itself into the panel it is shown on:
>
>- it bleeds into the sizer/widgets below it
>- it doesn't effect a vertical scrollbar despite being "too large" vertically
>- it doesn't sufficiently expand horizontally to fully fit the columns
> (the last column is slightly clipped which probably makes it show
> a horizontal scrollbar)
>- it does not expand into the available horizontal space
>
>Here are relevant parts of the grid class that's used:

and let us know the platform and wx version.

Debian Testing / wxPython 2.8.12

Please make a runnable, small as possible, sample application that
demonstrates the problem,

In other words the answer to

Can anyone see anything odd with the parenting or other layout
related things in the attached screenshot ?

is: No ?

Karsten

···

On Fri, Dec 27, 2013 at 05:29:55PM -0800, Robin Dunn wrote:
--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

Actually no. The “make a small sample” is the polite “No” answer to the unanswered question: “Do any of you have
the patience or inclination to do a line-by-line code review of a possibly nonworking snippet of my code?”

Watching it run and clicking through tests and using inspectors/debuggers is the shortest route to the answer you are looking for.

Nobody wants to run through your entire application either, even if you were inclined to send it to them.

And there’s a good chance, by creating a micro-app that has only the pieces in question, you can find
the answer yourself. It has worked that way in the past for others.

I see you used the WIT - a great tool! You do know you can dynamically adjust the sizes and other attributes of any
object using the PyCrust frame at the bottom. e.g. select the object, then in PyCrust type:

obj.SetSize(obj.GetSize()+(50,50))

to slightly increase width and height of an object (like a frame). (I just learned this recently. Maybe it’ll help)

And I apologize if you knew all this already.

···

On Sunday, December 29, 2013 7:41:29 AM UTC-5, Karsten Hilbert wrote:

On Fri, Dec 27, 2013 at 05:29:55PM -0800, Robin Dunn wrote:

Please make a runnable, small as possible, sample application that

demonstrates the problem,

In other words the answer to

Can anyone see anything odd with the parenting or other layout

related things in the attached screenshot ?

is: No ?