From 7e5d7edf870af587ef403776b24a1406aecc5698 Mon Sep 17 00:00:00 2001 From: Reverb <129622142+reverb256@users.noreply.github.com> Date: Wed, 4 Nov 2026 22:17:01 -0500 Subject: [PATCH 1/2] =?UTF-8?q?fix(weather):=20grow=20panel=20so=20long=20?= =?UTF-8?q?language=20labels=20do=20not=20overlap=20=C2=B0C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In languages with long weather stats labels (e.g. Russian ОЩУЩАЕТСЯ), the hero's left temperature block and right stats column collide inside the fixed 480px panel. Track the width the hero needs, size the panel to at least that (still capped by fittedContentWidth for narrow screens), and elide long location names. Fixes #17630 --- shell/plugins/panels/weather/Panel.qml | 17 ++++++++++++++++- test/shell.d/weather-test.sh | 13 +++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/shell/plugins/panels/weather/Panel.qml b/shell/plugins/panels/weather/Panel.qml index 0daf3795430a..3bbf45cbdd23 100644 --- a/shell/plugins/panels/weather/Panel.qml +++ b/shell/plugins/panels/weather/Panel.qml @@ -72,6 +72,9 @@ Panel { // Parsed wttr.in j1 response. Kept on failure so stale data stays visible. property var report: null + // Width the hero row needs so the temperature and the stats column never + // overlap (labels are much wider in some languages, e.g. Russian). + property real heroNeededWidth: 0 property var dailyForecastReport: null // Configured location, read from the weather.json state file (owned by @@ -545,7 +548,7 @@ Panel { // popup follows wherever the widget is placed. centerOnBar: false focusTarget: panel.loadedContent - contentWidth: panel.fittedContentWidth(Style.space(480)) + contentWidth: panel.fittedContentWidth(Math.max(Style.space(480), root.heroNeededWidth + panel.padding * 2 + Style.space(4))) contentHeight: panel.fittedContentHeight(panel.loadedContentHeight) content: PanelKeyCatcher { @@ -577,6 +580,13 @@ Panel { width: parent.width height: Math.max(heroLeft.height, heroRight.height) + // left margin + temperature block + gap + stats column + right margin + Binding { + target: root + property: "heroNeededWidth" + value: Style.space(16) + heroLeft.implicitWidth + Style.space(24) + heroRight.width + Style.space(20) + } + Row { id: heroLeft anchors.left: parent.left @@ -636,6 +646,7 @@ Panel { spacing: Style.space(12) Row { + id: locationRow visible: !root.editingLocation && root.reportLocation !== "" spacing: Style.space(6) @@ -647,6 +658,7 @@ Panel { } Text { + id: locationPin text: "" // nf-fa-map_marker color: Qt.darker(root.bar.foreground, 1.4) font.family: root.bar.fontFamily @@ -656,6 +668,9 @@ Panel { Text { textFormat: Text.PlainText text: (root.reportLocation || "").toUpperCase() + // Long place names are elided instead of spilling past the panel. + width: Math.min(implicitWidth, heroRight.width - locationPin.width - locationRow.spacing) + elide: Text.ElideRight color: Qt.darker(root.bar.foreground, 1.4) font.family: root.bar.fontFamily font.pixelSize: Style.font.body diff --git a/test/shell.d/weather-test.sh b/test/shell.d/weather-test.sh index bcc292d55671..d60ee44246b4 100644 --- a/test/shell.d/weather-test.sh +++ b/test/shell.d/weather-test.sh @@ -161,3 +161,16 @@ chmod +x "$test_tmp/bin/curl" [[ $(PATH="$test_tmp/bin:$PATH" weather_location) == "Amsterdam" ]] || fail "weather location names the place geo.omarchy.org detected" [[ $(cat "$test_tmp/curl-urls") == "https://geo.omarchy.org/" ]] || fail "weather location asks only geo.omarchy.org" "$(cat "$test_tmp/curl-urls")" pass "weather location names the place geo.omarchy.org detected when none is stored" + +# Layout wiring for #17630: long-language stats must widen the panel (or +# elide the location), not collide with the temperature unit. Keep this +# compatible with a later narrow-screen scale (#11238 / #6991): fittedContentWidth +# still caps to the available card width. +panel_qml="$ROOT/shell/plugins/panels/weather/Panel.qml" +grep -q 'property real heroNeededWidth' "$panel_qml" || fail "weather panel tracks the hero width it needs" +grep -q 'Math.max(Style.space(480), root.heroNeededWidth' "$panel_qml" || fail "weather panel grows past 480 when the hero needs it" +grep -q 'elide: Text.ElideRight' "$panel_qml" || fail "weather location elides instead of spilling past the panel" +# The hero halves stay opposite-anchored (narrow-screen scale can still shrink +# them later); the Binding is what keeps them from overlapping today. +grep -q 'heroLeft.implicitWidth' "$panel_qml" || fail "weather heroNeededWidth Binding reads heroLeft.implicitWidth" +pass "weather panel grows for long language labels and elides the location (#17630)" From 376e6780148fd657f6dee418f72cd56670cc5b75 Mon Sep 17 00:00:00 2001 From: Reverb <129622142+reverb256@users.noreply.github.com> Date: Mon, 9 Nov 2026 22:49:23 +0000 Subject: [PATCH 2/2] test(weather): check the hero row by width instead of source text The #17630 checks grepped Panel.qml, so they stayed green if the binding stopped updating. Size the row in Model.js and assert that long stat labels clear the temperature while short ones stay at 480. Co-authored-by: Reverb --- shell/plugins/panels/weather/Model.js | 26 ++++++++++- shell/plugins/panels/weather/Panel.qml | 6 +-- test/shell.d/weather-test.sh | 60 ++++++++++++++++++++------ 3 files changed, 75 insertions(+), 17 deletions(-) diff --git a/shell/plugins/panels/weather/Model.js b/shell/plugins/panels/weather/Model.js index 4b66dfafaa6d..c16fb72904dc 100644 --- a/shell/plugins/panels/weather/Model.js +++ b/shell/plugins/panels/weather/Model.js @@ -267,6 +267,27 @@ function iconForOpenMeteoCode(code, night) { return iconForCode(119, night) } +// Width of the hero row so the temperature block and the stats column do not +// meet: left margin, temperature, the gap between the halves, the stats +// column, right margin. Labels such as Russian ОЩУЩАЕТСЯ are much wider than +// FEELS, and at the 480px floor they land on top of the °C. +function heroNeededWidth(leftMargin, temperatureWidth, gap, statsWidth, rightMargin) { + return leftMargin + temperatureWidth + gap + statsWidth + rightMargin +} + +// Card content width before KeyboardPanel.fittedContentWidth caps it to the +// screen. Short labels stay at the floor; longer ones grow the card by the +// hero width plus the card's own chrome. +function heroContentWidth(baseWidth, neededWidth, chrome) { + return Math.max(baseWidth, neededWidth + chrome) +} + +// Place name drawn inside the stats column. A name wider than the column +// elides; a shorter one keeps its own width. +function locationLabelWidth(textWidth, columnWidth, pinWidth, spacing) { + return Math.min(textWidth, columnWidth - pinWidth - spacing) +} + function iconForCode(code, night) { var c = parseInt(String(code || "0"), 10) switch (c) { @@ -312,6 +333,9 @@ if (typeof module !== "undefined") { bareTempForDay: bareTempForDay, dayIcon: dayIcon, iconForOpenMeteoCode: iconForOpenMeteoCode, - iconForCode: iconForCode + iconForCode: iconForCode, + heroNeededWidth: heroNeededWidth, + heroContentWidth: heroContentWidth, + locationLabelWidth: locationLabelWidth } } diff --git a/shell/plugins/panels/weather/Panel.qml b/shell/plugins/panels/weather/Panel.qml index 3bbf45cbdd23..b86c76c85305 100644 --- a/shell/plugins/panels/weather/Panel.qml +++ b/shell/plugins/panels/weather/Panel.qml @@ -548,7 +548,7 @@ Panel { // popup follows wherever the widget is placed. centerOnBar: false focusTarget: panel.loadedContent - contentWidth: panel.fittedContentWidth(Math.max(Style.space(480), root.heroNeededWidth + panel.padding * 2 + Style.space(4))) + contentWidth: panel.fittedContentWidth(Model.heroContentWidth(Style.space(480), root.heroNeededWidth, panel.padding * 2 + Style.space(4))) contentHeight: panel.fittedContentHeight(panel.loadedContentHeight) content: PanelKeyCatcher { @@ -584,7 +584,7 @@ Panel { Binding { target: root property: "heroNeededWidth" - value: Style.space(16) + heroLeft.implicitWidth + Style.space(24) + heroRight.width + Style.space(20) + value: Model.heroNeededWidth(Style.space(16), heroLeft.implicitWidth, Style.space(24), heroRight.width, Style.space(20)) } Row { @@ -669,7 +669,7 @@ Panel { textFormat: Text.PlainText text: (root.reportLocation || "").toUpperCase() // Long place names are elided instead of spilling past the panel. - width: Math.min(implicitWidth, heroRight.width - locationPin.width - locationRow.spacing) + width: Model.locationLabelWidth(implicitWidth, heroRight.width, locationPin.width, locationRow.spacing) elide: Text.ElideRight color: Qt.darker(root.bar.foreground, 1.4) font.family: root.bar.fontFamily diff --git a/test/shell.d/weather-test.sh b/test/shell.d/weather-test.sh index d60ee44246b4..377631bf6420 100644 --- a/test/shell.d/weather-test.sh +++ b/test/shell.d/weather-test.sh @@ -121,6 +121,53 @@ assertEqual( weather.iconForCode(389, false), 'weather picks hourly forecast icon nearest noon' ) + +// #17630: the °C and the stats column share one row. These widths stand in +// for the measured halves (a hero temperature, and stat labels as wide as +// Russian ОЩУЩАЕТСЯ / ВЕТЕР / ВЛАЖНОСТЬ). The card opens up so the halves +// and the gap still fit; short labels stay on the 480px floor. The screen +// cap stays in KeyboardPanel.fittedContentWidth, which this width feeds. +function heroOverlaps(contentWidth, spec) { + const inner = contentWidth - spec.chrome + const temperatureRight = spec.leftMargin + spec.temperatureWidth + const statsLeft = inner - spec.rightMargin - spec.statsWidth + return temperatureRight + spec.gap > statsLeft +} + +const longStats = { + baseWidth: 480, + chrome: 32, + leftMargin: 16, + temperatureWidth: 200, + gap: 24, + statsWidth: 360, + rightMargin: 20 +} +const longWidth = weather.heroContentWidth( + longStats.baseWidth, + weather.heroNeededWidth(longStats.leftMargin, longStats.temperatureWidth, longStats.gap, longStats.statsWidth, longStats.rightMargin), + longStats.chrome +) +assert(!heroOverlaps(longWidth, longStats), 'long language stats stay clear of the temperature unit') +assert(longWidth > longStats.baseWidth, 'long language stats widen the weather panel past 480') + +const shortStats = Object.assign({}, longStats, { statsWidth: 120 }) +const shortWidth = weather.heroContentWidth( + shortStats.baseWidth, + weather.heroNeededWidth(shortStats.leftMargin, shortStats.temperatureWidth, shortStats.gap, shortStats.statsWidth, shortStats.rightMargin), + shortStats.chrome +) +assert(!heroOverlaps(shortWidth, shortStats), 'short language stats stay clear of the temperature unit') +assertEqual(shortWidth, shortStats.baseWidth, 'short language stats keep the 480px weather panel') + +const statsColumn = 360 +const pinWidth = 14 +const locationSpacing = 6 +const locationRoom = statsColumn - pinWidth - locationSpacing +const longLocation = weather.locationLabelWidth(900, statsColumn, pinWidth, locationSpacing) +assert(longLocation <= locationRoom, 'long location names elide inside the stats column') +assert(longLocation > 0, 'an elided location name still shows') +assertEqual(weather.locationLabelWidth(40, statsColumn, pinWidth, locationSpacing), 40, 'short location names keep their own width') JS test_tmp=$(mktemp -d) @@ -161,16 +208,3 @@ chmod +x "$test_tmp/bin/curl" [[ $(PATH="$test_tmp/bin:$PATH" weather_location) == "Amsterdam" ]] || fail "weather location names the place geo.omarchy.org detected" [[ $(cat "$test_tmp/curl-urls") == "https://geo.omarchy.org/" ]] || fail "weather location asks only geo.omarchy.org" "$(cat "$test_tmp/curl-urls")" pass "weather location names the place geo.omarchy.org detected when none is stored" - -# Layout wiring for #17630: long-language stats must widen the panel (or -# elide the location), not collide with the temperature unit. Keep this -# compatible with a later narrow-screen scale (#11238 / #6991): fittedContentWidth -# still caps to the available card width. -panel_qml="$ROOT/shell/plugins/panels/weather/Panel.qml" -grep -q 'property real heroNeededWidth' "$panel_qml" || fail "weather panel tracks the hero width it needs" -grep -q 'Math.max(Style.space(480), root.heroNeededWidth' "$panel_qml" || fail "weather panel grows past 480 when the hero needs it" -grep -q 'elide: Text.ElideRight' "$panel_qml" || fail "weather location elides instead of spilling past the panel" -# The hero halves stay opposite-anchored (narrow-screen scale can still shrink -# them later); the Binding is what keeps them from overlapping today. -grep -q 'heroLeft.implicitWidth' "$panel_qml" || fail "weather heroNeededWidth Binding reads heroLeft.implicitWidth" -pass "weather panel grows for long language labels and elides the location (#17630)"