Compare commits

...
1 Commits
Author SHA1 Message Date
noahandClaude Opus 4.8 b343746718 GUI round 10 (batch 2): consistent zebra on custom columns + neutral KPIs dim with focus
R10.1 (zebra consistency): wxGTK does not paint a custom renderer's cell
background, so the per-row zebra colour set via GetAttrByRow appeared on the
native columns but not on the SegmentRenderer columns (Hashrate, Chip temp,
Firmware, ...), making the striping look inconsistent. SegmentRenderer::Render
now paints the row's GetAttr() background itself (skipping selected rows, which
the control already highlights) so every column stripes identically.

R10.2 (focus dimming): the Total-miners and Est-power KPI cards and the plain
segments in combined cells forced an explicit foreground colour, so they did
not dim when the window lost focus like the rest of the dashboard. mk_card and
repaint_theme now leave ColorKind::Neutral cards on the default text colour, and
SegmentRenderer draws an uncoloured segment with the DC's current text
foreground (falling back to wxSYS_COLOUR_WINDOWTEXT) instead of a hardcoded
system colour.

The widgets_bridge.cpp edit is mirrored into the wx-rs patch queue
(patches/0003-widget-bridge-cpp.patch) per ADR 0003.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y8h447BPyJR4fioYZvQ9bh
2026-09-18 15:44:48 -06:00
3 changed files with 47 additions and 9 deletions
+10 -2
View File
@@ -469,7 +469,12 @@ pub fn build(frame: Widget) -> App {
let value = Widget::static_text(card, "0");
value.set_font_size(19);
value.set_bold();
value.set_fg(vc.0, vc.1, vc.2);
// Neutral cards (Total, Est. power) keep the default text colour so they
// dim with the rest of the dashboard when the window loses focus; only
// the semantically-coloured cards force a foreground (round-10 #2).
if !matches!(kind, ColorKind::Neutral) {
value.set_fg(vc.0, vc.1, vc.2);
}
value.set_bg(pal.card_bg.0, pal.card_bg.1, pal.card_bg.2);
let lbl = Widget::static_text(card, label);
lbl.set_font_size(9);
@@ -875,7 +880,10 @@ impl App {
let vc = kind_color(&self.pal, *kind);
card.set_bg(self.pal.card_bg.0, self.pal.card_bg.1, self.pal.card_bg.2);
value.set_bg(self.pal.card_bg.0, self.pal.card_bg.1, self.pal.card_bg.2);
value.set_fg(vc.0, vc.1, vc.2);
// Neutral cards keep the default (dimming) text colour -- see mk_card.
if !matches!(kind, ColorKind::Neutral) {
value.set_fg(vc.0, vc.1, vc.2);
}
caption.set_bg(self.pal.card_bg.0, self.pal.card_bg.1, self.pal.card_bg.2);
caption.set_fg(self.pal.label.0, self.pal.label.1, self.pal.label.2);
}
+19 -4
View File
@@ -1,6 +1,6 @@
--- a/cpp_src/widgets_bridge.cpp
+++ b/cpp_src/widgets_bridge.cpp
@@ -0,0 +1,1133 @@
@@ -0,0 +1,1148 @@
+// widgets_bridge.cpp — alkane-toolkit extension to wx-rs
+// Adds the widget/event surface the toolkit UI needs on top of the upstream
+// render-callback bridge (which is kept untouched).
@@ -168,10 +168,25 @@
+
+ bool Render(wxRect cell, wxDC* dc, int state) override {
+ bool selected = (state & wxDATAVIEW_CELL_SELECTED) != 0;
+ // wxGTK does NOT paint a custom renderer's cell background, so the per-row
+ // (zebra) background set via GetAttrByRow shows on the native columns but
+ // not here -- the zebra looked inconsistent across columns. Paint it here so
+ // every column stripes the same (skip when the row is selected: the control
+ // already drew the selection highlight).
+ if (!selected && GetAttr().HasBackgroundColour()) {
+ dc->SetBrush(wxBrush(GetAttr().GetBackgroundColour()));
+ dc->SetPen(*wxTRANSPARENT_PEN);
+ dc->DrawRectangle(cell);
+ }
+ wxColour highlight = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
+ wxColour plain = GetAttr().HasColour()
+ ? GetAttr().GetColour()
+ : wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
+ // For an uncoloured (default) segment, follow the DC's current text
+ // foreground rather than a hardcoded wxSYS_COLOUR_WINDOWTEXT, so these
+ // segments dim with the rest of the table when the window is backdropped.
+ wxColour plain = GetAttr().HasColour() ? GetAttr().GetColour()
+ : dc->GetTextForeground();
+ if (!plain.IsOk()) {
+ plain = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
+ }
+ wxCoord x = cell.x;
+ for (const ColorSegment& seg : ParseColorSegments(m_value)) {
+ if (seg.text.IsEmpty()) continue;
@@ -165,10 +165,25 @@ class SegmentRenderer : public wxDataViewCustomRenderer {
bool Render(wxRect cell, wxDC* dc, int state) override {
bool selected = (state & wxDATAVIEW_CELL_SELECTED) != 0;
// wxGTK does NOT paint a custom renderer's cell background, so the per-row
// (zebra) background set via GetAttrByRow shows on the native columns but
// not here -- the zebra looked inconsistent across columns. Paint it here so
// every column stripes the same (skip when the row is selected: the control
// already drew the selection highlight).
if (!selected && GetAttr().HasBackgroundColour()) {
dc->SetBrush(wxBrush(GetAttr().GetBackgroundColour()));
dc->SetPen(*wxTRANSPARENT_PEN);
dc->DrawRectangle(cell);
}
wxColour highlight = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
wxColour plain = GetAttr().HasColour()
? GetAttr().GetColour()
: wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
// For an uncoloured (default) segment, follow the DC's current text
// foreground rather than a hardcoded wxSYS_COLOUR_WINDOWTEXT, so these
// segments dim with the rest of the table when the window is backdropped.
wxColour plain = GetAttr().HasColour() ? GetAttr().GetColour()
: dc->GetTextForeground();
if (!plain.IsOk()) {
plain = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
}
wxCoord x = cell.x;
for (const ColorSegment& seg : ParseColorSegments(m_value)) {
if (seg.text.IsEmpty()) continue;