From f028640215053623eeb018a111103e560c8ac363 Mon Sep 17 00:00:00 2001 From: jgehw Date: Mon, 15 Oct 2018 17:46:09 +0200 Subject: [PATCH] fix optical grid appearance - fixed optical appearance of row labels w.r.t. simple 3D effect - fixed helpers for determining size (becomes important if you subclass a label renderer spanning multiple rows or columns) --- wx/lib/mixins/gridlabelrenderer.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/wx/lib/mixins/gridlabelrenderer.py b/wx/lib/mixins/gridlabelrenderer.py index 1b3e90e6..0c20959b 100644 --- a/wx/lib/mixins/gridlabelrenderer.py +++ b/wx/lib/mixins/gridlabelrenderer.py @@ -156,7 +156,7 @@ class GridWithLabelRenderersMixin(object): # for now we will have to calculate them ourselves. def _getColLeftRight(self, col): c = 0 - left = 0 + left = -1 while c < col: left += self.GetColSize(c) c += 1 @@ -165,11 +165,11 @@ class GridWithLabelRenderersMixin(object): def _getRowTopBottom(self, row): r = 0 - top = 0 + top = -1 while r < row: top += self.GetRowSize(r) r += 1 - bottom = top + self.GetRowSize(row) - 1 + bottom = top + self.GetRowSize(row) return top, bottom @@ -203,8 +203,12 @@ class GridLabelRenderer(object): dc.DrawLine(left, top, left, bottom) dc.DrawLine(left, bottom, right, bottom) dc.SetPen(wx.WHITE_PEN) - dc.DrawLine(left+1, top, left+1, bottom) - dc.DrawLine(left+1, top, right, top) + if top == 0: + dc.DrawLine(left + 1, top, left + 1, bottom) + dc.DrawLine(left + 1, top, right, top) + else: + dc.DrawLine(left + 1, top + 1, left + 1, bottom) + dc.DrawLine(left + 1, top + 1, right - 1, top + 1) def DrawText(self, grid, dc, rect, text, hAlign, vAlign):