From 5692908b7b06fb2ab88ac4ed4290d9b6f38e109e Mon Sep 17 00:00:00 2001 From: cnmcdee Date: Tue, 1 Dec 2026 02:44:56 +0000 Subject: [PATCH] Phase 2 fix: calendar week numbers + tree expander - Calendar: show-week-numbers now actually draws the ISO week numbers (44-49 for Nov 2026) in the left column; the column width was reserved but the numbers were never painted. - TreeView: the expander triangle is only drawn on rows that have children (next row starts with path + "/"); leaf rows like "Other" no longer get a spurious triangle. --- lightgui/xframe/core.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lightgui/xframe/core.py b/lightgui/xframe/core.py index 830e744..f0a45a7 100644 --- a/lightgui/xframe/core.py +++ b/lightgui/xframe/core.py @@ -1496,8 +1496,9 @@ class ListSelWidget(Widget): cr.rectangle(1, y, self.width - 2, rh) cr.fill() x = 6 + depth * indent - if _prop_bool(self, "show-buttons", True) and depth == 0 \ - and len(rows) > 1: + has_children = (i + 1 < len(rows) + and rows[i + 1].startswith(path + "/")) + if _prop_bool(self, "show-buttons", True) and has_children: _triangle(cr, x + 4, y + rh / 2, 8, "down" if i == 0 else "right") x += 12 @@ -1809,6 +1810,12 @@ class ContainerWidget(Widget): y += 16 row_h = max(14, (self.height - y - 2) / 6.0) for row in range(6): + if show_week: + from datetime import timedelta as _td + monday = first + _td(days=row * 7 - start_col) + _wtext(cr, self, str(monday.isocalendar()[1]), + 14, y + row * row_h + row_h / 2 + 4, size=10, + align="center", rgb=(0.5, 0.5, 0.5)) for col in range(7): day = row * 7 + col - start_col + 1 cx = x0 + col * col_w