usage

usage 0.29.18

工具與目錄
在這頁

新功能 2 項

01

面板視窗不再忽高忽低

從選單列打開面板(popover,浮在其他視窗上的小視窗)時,視窗先跳一下又在兩個高度間來回閃動的問題修好了。它原本像服飾店先按尺寸表猜衣服大小,網頁排好版後再量一次實際尺寸;量到的尺寸本該存下來,供下次優先採用,卻被程式誤認為不是可讀的對照資料而丟掉,於是每次又退回舊的預估值。現在讀寫都接受 Mapping(能用鍵查值的對照資料),已量到的高度會留下來;只有不能回報尺寸的錯誤面板,才繼續使用預估值。測試也改用不是一般 dict 的對照資料,確保這個判斷不會再退回舊路。

官方原文

**The panel window oscillated between two heights.** Opening it snapped the window once, and it kept flicking back and forth afterwards. A panel's height has two sources: popover_dimensions() estimates it in Python from a registered base plus per-card adjustments, and the page measures itself for real once it has been laid out and reports the number back. The measurement is meant to win — it is saved to NSUserDefaults and read back by resolve_panel_size() on the next pass. It never was. NSUserDefaults.objectForKey_() hands PyObjC an Objective-C __NSDictionaryI, and isinstance(value, dict) on that is False, so the guard rejected the saved {classic: 974} every single time and fell back to the 1004 estimate. The write path had the same guard and therefore discarded every other panel's saved height whenever one was stored. What made this hard to see is that saving worked while loading did not: defaults read com.lollapalooza.usage showed the correct 974 sitting on disk the whole time, so the data looked healthy from the outside. The 30-point gap between the two values happens to equal status_wrap_extra_height, which is a coincidence worth ignoring — the estimate being wrong is not what caused the loop; the measurement being rejected is. Both guards now accept collections.abc.Mapping. The estimate is still used, but only for panels that can never report a measurement — ErrorPanelView has no JavaScript bridge, so waiting for one would leave it at the wrong size forever. The regression test substitutes a MappingProxyType, which like NSDictionary is a Mapping that is not a dict; a test double built from a plain dict passes whether or not the bug is present.

02

日韓語介面不再有空白標籤

日文與韓文介面先前各有 63 個標籤看起來像憑空消失,現在已補上翻譯。檢查原本只核對 489 個文字鍵是否都存在,像倉庫清點到每個紙箱卻沒打開看裡面有沒有東西;因此 loading、no_data、session_title、col_time 與 model_breakdown 雖有鍵名,畫面仍只留下空白。新檢查會拒絕空字串,也會比對 placeholder(顯示時才填入資料的位置)是否和英文一致;少掉或改名都可能在顯示時出錯。帶格式的標記、格式寫法與指令名稱則維持英文,不會被誤譯。

官方原文

**The Japanese and Korean locales shipped sixty-three blank labels each.** Flagged one version earlier and fixed here. Both locales carried all 489 keys, so test_every_language_has_the_same_keys compared key sets, found them identical, and passed — while loading, no_data, session_title, col_time and model_breakdown rendered as empty space for anyone running the app in either language. A present-but-empty value is invisible to a parity check by construction, which is the same blind spot that let fifty-two Simplified Chinese strings sit in the Traditional Chinese locale until last version. Two assertions now close it: no translated value may be blank, and every value's {placeholder} set must match English exactly. The second guards a failure the first cannot see — a translation that drops or renames a placeholder does not look wrong in the file, it raises at format time in front of the user. Rich markup ([dim]), format specs ({m:02d}) and command names were left in English.