知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.
Swift androidlinuxlive-captionsmacosmeeting-notesmenubar-appsimultaneous-interpretationspeech-recognitionsubtitlesswiftswiftuitranslationwindows
feat(linux): fixed words are underlined, the notes window asks Is this fix right? without taking focus, Edit line… works in the meeting record, and Settings has a Word list
wquguruaa1563a3a572
diff --git a/README.en.md b/README.en.mdindex c954746..4bd7fb0 100644--- a/README.en.md+++ b/README.en.md@@ -153,7 +153,7 @@ Requires **Windows 10 2004** or later. Download the Windows installer (x64 for m### Linux-Requires the **Ubuntu 22.04 or 24.04 desktop** (x86_64 or arm64). Download `Cicada-<version>-Linux.tar.gz` and run `tar xzf Cicada-<version>-Linux.tar.gz && cicada-linux/install.sh` in a terminal; Cicada appears in the app menu. Interpreting makes its own "Cicada Microphone", with no driver to install. Linux can't keep a window out of screen sharing, so the notes window always says it is visible when you share. Saving meeting audio needs an AAC encoder, which Ubuntu doesn't ship by default: with third-party media formats installed (e.g. `ubuntu-restricted-extras`), Settings › General › Save meeting audio turns on and each meeting plays back in Meetings, from any line's time; without them the switch is greyed out and everything else works as usual.+Requires the **Ubuntu 22.04 or 24.04 desktop** (x86_64 or arm64). Download `Cicada-<version>-Linux.tar.gz` and run `tar xzf Cicada-<version>-Linux.tar.gz && cicada-linux/install.sh` in a terminal; Cicada appears in the app menu. Interpreting makes its own "Cicada Microphone", with no driver to install. Linux can't keep a window out of screen sharing, so the notes window always says it is visible when you share. Saving meeting audio needs an AAC encoder, which Ubuntu doesn't ship by default: with third-party media formats installed (e.g. `ubuntu-restricted-extras`), Settings › General › Save meeting audio turns on and each meeting plays back in Meetings, from any line's time; without them the switch is greyed out and everything else works as usual. Misheard names and terms are fixed live here too (needs an AI service). Linux hears and translates in one request, so Settings › Word list › Fix misheard words live costs one more text request per sentence; fixed words are underlined, and Edit line… works in Meetings.### Androiddiff --git a/README.ja.md b/README.ja.mdindex 15b28c2..a0688cb 100644--- a/README.ja.md+++ b/README.ja.md@@ -155,7 +155,7 @@ ZenMux、OpenAI、または OpenAI 互換の任意のサービス(たとえば### Linux-**Ubuntu 22.04 または 24.04 のデスクトップ**(x86_64 または arm64)が必要です。`Cicada-<version>-Linux.tar.gz` をダウンロードし、ターミナルで `tar xzf Cicada-<version>-Linux.tar.gz && cicada-linux/install.sh` を実行すると、アプリのメニューに Cicada が表示されます。通訳では独自の「Cicada Microphone」を作るので、ドライバーのインストールは不要です。Linux ではウィンドウを画面共有から隠せないため、共有中はメモのウィンドウに相手から見えている旨が常に表示されます。会議の録音には AAC エンコーダーが必要ですが、Ubuntu には標準で入っていません。サードパーティのメディア形式(`ubuntu-restricted-extras` など)を入れると「設定 › 一般 › 会議の音声を保存」をオンにでき、録音は会議記録で再生でき、各行の時刻からも再生できます。入れていない場合はこのスイッチが灰色になり、ほかの機能はそのまま使えます。+**Ubuntu 22.04 または 24.04 のデスクトップ**(x86_64 または arm64)が必要です。`Cicada-<version>-Linux.tar.gz` をダウンロードし、ターミナルで `tar xzf Cicada-<version>-Linux.tar.gz && cicada-linux/install.sh` を実行すると、アプリのメニューに Cicada が表示されます。通訳では独自の「Cicada Microphone」を作るので、ドライバーのインストールは不要です。Linux ではウィンドウを画面共有から隠せないため、共有中はメモのウィンドウに相手から見えている旨が常に表示されます。会議の録音には AAC エンコーダーが必要ですが、Ubuntu には標準で入っていません。サードパーティのメディア形式(`ubuntu-restricted-extras` など)を入れると「設定 › 一般 › 会議の音声を保存」をオンにでき、録音は会議記録で再生でき、各行の時刻からも再生できます。入れていない場合はこのスイッチが灰色になり、ほかの機能はそのまま使えます。聞き間違えた人名や用語もその場で直ります(AI サービスが必要)。Linux では認識と翻訳が 1 回で済むため、「設定 › 単語リスト › 会議中に聞き間違いを直す」をオンにすると 1 文ごとにテキストのリクエストが 1 回増えます。直した語には下線が付き、会議記録でも「この行を修正…」が使えます。### Androiddiff --git a/README.ko.md b/README.ko.mdindex 575483f..1063147 100644--- a/README.ko.md+++ b/README.ko.md@@ -153,7 +153,7 @@ Windows, Linux, Android 버전은 클라우드에서 음성을 인식합니다.### Linux-**Ubuntu 22.04 또는 24.04 데스크톱**(x86_64 또는 arm64)이 필요합니다. `Cicada-<version>-Linux.tar.gz`를 내려받고 터미널에서 `tar xzf Cicada-<version>-Linux.tar.gz && cicada-linux/install.sh`를 실행하면 앱 메뉴에 Cicada가 나타납니다. 동시통역은 별도 드라이버 설치 없이 자체적으로 "Cicada 마이크"를 만듭니다. Linux에서는 화면 공유 시 특정 창을 숨길 수 없으므로, 회의록 창에 화면 공유 시 보인다는 안내가 항상 표시됩니다. 회의 녹음에는 AAC 인코더가 필요한데 Ubuntu에는 기본으로 없습니다. 서드파티 미디어 형식(예: `ubuntu-restricted-extras`)을 설치하면 "설정 › 일반 › 회의 녹음 저장"을 켤 수 있고, 녹음은 회의 기록에서 각 문장의 시간부터 다시 들을 수 있습니다. 설치하지 않으면 이 스위치는 회색으로 표시되며 다른 기능은 그대로 쓸 수 있습니다.+**Ubuntu 22.04 또는 24.04 데스크톱**(x86_64 또는 arm64)이 필요합니다. `Cicada-<version>-Linux.tar.gz`를 내려받고 터미널에서 `tar xzf Cicada-<version>-Linux.tar.gz && cicada-linux/install.sh`를 실행하면 앱 메뉴에 Cicada가 나타납니다. 동시통역은 별도 드라이버 설치 없이 자체적으로 "Cicada 마이크"를 만듭니다. Linux에서는 화면 공유 시 특정 창을 숨길 수 없으므로, 회의록 창에 화면 공유 시 보인다는 안내가 항상 표시됩니다. 회의 녹음에는 AAC 인코더가 필요한데 Ubuntu에는 기본으로 없습니다. 서드파티 미디어 형식(예: `ubuntu-restricted-extras`)을 설치하면 "설정 › 일반 › 회의 녹음 저장"을 켤 수 있고, 녹음은 회의 기록에서 각 문장의 시간부터 다시 들을 수 있습니다. 설치하지 않으면 이 스위치는 회색으로 표시되며 다른 기능은 그대로 쓸 수 있습니다. 잘못 들은 인명과 용어도 그 자리에서 고칩니다(AI 서비스 필요). Linux에서는 인식과 번역이 한 번에 끝나므로 설정 › 단어 목록 › 회의 중 잘못 들은 단어 고치기를 켜면 문장마다 텍스트 요청이 한 번 더 갑니다. 고친 단어에는 밑줄이 그어지고, 회의 기록에서도 "이 줄 고치기…"를 쓸 수 있습니다.### Androiddiff --git a/README.md b/README.mdindex a547fb4..601a0da 100644--- a/README.md+++ b/README.md@@ -142,7 +142,7 @@ Intel 版 Mac 以及 Windows、Linux 和 Android 版在云端识别:说话的### Linux-需要 Ubuntu 22.04 或 24.04 桌面版(x86_64 或 arm64)。下载 `Cicada-<版本>-Linux.tar.gz`,在终端里运行 `tar xzf Cicada-<版本>-Linux.tar.gz && cicada-linux/install.sh`,知了会出现在应用菜单里。同声传译会自己建一个“知了 麦克风”,不用装驱动。Linux 没法让窗口避开屏幕共享,纪要窗会一直标着“共享屏幕时此窗口可见”。会议录音要用 AAC 编码器,Ubuntu 默认没有:装了第三方媒体格式(比如 `ubuntu-restricted-extras`)后,“设置 › 通用 › 保存会议录音”才能打开,录音可以在会议记录里回放,点一句的时间就从那里放;没装时这个开关是灰的,其他功能照常。+需要 Ubuntu 22.04 或 24.04 桌面版(x86_64 或 arm64)。下载 `Cicada-<版本>-Linux.tar.gz`,在终端里运行 `tar xzf Cicada-<版本>-Linux.tar.gz && cicada-linux/install.sh`,知了会出现在应用菜单里。同声传译会自己建一个“知了 麦克风”,不用装驱动。Linux 没法让窗口避开屏幕共享,纪要窗会一直标着“共享屏幕时此窗口可见”。会议录音要用 AAC 编码器,Ubuntu 默认没有:装了第三方媒体格式(比如 `ubuntu-restricted-extras`)后,“设置 › 通用 › 保存会议录音”才能打开,录音可以在会议记录里回放,点一句的时间就从那里放;没装时这个开关是灰的,其他功能照常。听错的人名和术语也会当场改(需要 AI 服务):Linux 上识别和翻译本来一次完成,所以打开“设置 › 词表 › 会中改正听错的词”后每句会多发一次文字请求;改过的词带下划线,会议记录里也能“改这句…”。### Androiddiff --git a/linux/README.md b/linux/README.mdindex 2bef3dd..1c0f9bc 100644--- a/linux/README.md+++ b/linux/README.md@@ -55,7 +55,7 @@ linux/vm/vmctl.sh shot shot.png # 截屏(QEMU,不受 Waylandlinux/scripts/build.sh && linux/vm/push.sh # 把 build/cicada-linux 和测试工具放进虚拟机的 ~/cicada-linux```-在虚拟机里 `~/cicada-linux/bin/cicada --dev` 启动开发版(记录在 `~/.local/share/cicada-dev`,日志在 `~/.local/state/cicada-dev/debug.log`),再用 `scripts/cicadactl` 驱动它:`state`、`start`、`stop`、`feed <wav>`、`sample`、`view notes|subtitles`、`show records|notes|settings|onboarding`、`windows`、`quit`;结束会议用 `calls zoom=Zoom|none|real`(假装会议软件在通话)、`realcalls`、`endtimes <没人说话秒数> <倒计时> <挂断宽限>|off`、`endkeep`;纪要窗用 `notes-tab notes|transcript`、`notes-search <词>`、`notes-wide on|off`、`notes-end ask|keep|end`(结束前的确认)、`notes-status failed|invalidKey|rateLimited|idle`(看出错横幅);记录用 `rename <id> [标题]`(不给标题即恢复自动标题)、`delete <id>`;还有 `onboarding-step <0-4>`、`settings-scroll <0-1>`;AI 服务检查用 `ai-check`(现在查一次)、`ai-check-sim <原因|lowBalance|off>`(每次检查都按这个原因结束,截各状态的图)、`ask settings|fix|close`(回答开始听时的对话框)、`settings-ai`、`tray-menu`(顶栏菜单的各项);只有你能修的问题(key、余额、模型、地址)在顶栏图标上加橙点,纪要窗收起时每场会议发一次通知(连不上的话持续 2 分钟后才发),`hide notes` 收起纪要窗、`problem-wait <秒>|off` 缩短这 2 分钟、`state` 的 `aiProblem` 看结果。保存会议录音用 `codecs`(这台电脑有没有 AAC 编码器 / 解码器)、`play [秒]`、`pause`、`rate`、`playstate`(播放到哪、亮着哪一句)、`settings-general`;Ubuntu 默认没有 AAC 编码器,测录音要先在虚拟机里 `sudo apt install gstreamer1.0-libav`,测完再删掉,看默认的灰开关。`scripts/smoke.sh` 一步跑完:开窗口、放一段声音、确认 monitor 听到了。+在虚拟机里 `~/cicada-linux/bin/cicada --dev` 启动开发版(记录在 `~/.local/share/cicada-dev`,日志在 `~/.local/state/cicada-dev/debug.log`),再用 `scripts/cicadactl` 驱动它:`state`、`start`、`stop`、`feed <wav>`、`sample`、`view notes|subtitles`、`show records|notes|settings|onboarding`、`windows`、`quit`;结束会议用 `calls zoom=Zoom|none|real`(假装会议软件在通话)、`realcalls`、`endtimes <没人说话秒数> <倒计时> <挂断宽限>|off`、`endkeep`;纪要窗用 `notes-tab notes|transcript`、`notes-search <词>`、`notes-wide on|off`、`notes-end ask|keep|end`(结束前的确认)、`notes-status failed|invalidKey|rateLimited|idle`(看出错横幅);记录用 `rename <id> [标题]`(不给标题即恢复自动标题)、`delete <id>`;还有 `onboarding-step <0-4>`、`settings-scroll <0-1>`;AI 服务检查用 `ai-check`(现在查一次)、`ai-check-sim <原因|lowBalance|off>`(每次检查都按这个原因结束,截各状态的图)、`ask settings|fix|close`(回答开始听时的对话框)、`settings-ai`、`tray-menu`(顶栏菜单的各项);只有你能修的问题(key、余额、模型、地址)在顶栏图标上加橙点,纪要窗收起时每场会议发一次通知(连不上的话持续 2 分钟后才发),`hide notes` 收起纪要窗、`problem-wait <秒>|off` 缩短这 2 分钟、`state` 的 `aiProblem` 看结果。保存会议录音用 `codecs`(这台电脑有没有 AAC 编码器 / 解码器)、`play [秒]`、`pause`、`rate`、`playstate`(播放到哪、亮着哪一句)、`settings-general`;Ubuntu 默认没有 AAC 编码器,测录音要先在虚拟机里 `sudo apt install gstreamer1.0-libav`,测完再删掉,看默认的灰开关。改正听错的词:`start` 后用 `heard <一句话>`(不用声音,当作听到的一整句,走真实的翻译 + 改词请求),`fix-state` 看每句的改法,`fix-answer yes|no`、`fix-later`、`fix-revert <句子 id>`、`fix-edit <句子 id>=<改后>[|one][|keep0]`、`fix-undo`,`fix-editor <句子 id>=<改后>` 在会议记录里打开“改这句…”,`vocab-add Morpho=莫拉`、`vocab-state`、`word-list [import <文字>|edit <词>|heard <词>=<听成>|delete <词>]` 看设置里的词表。`scripts/smoke.sh` 一步跑完:开窗口、放一段声音、确认 monitor 听到了。焦点:`bin/focus_test.sh` 开一个最大化的“会议 app”(`focus_probe.py`),用 `click.py`(uinput,真实指针)点纪要窗和“字幕”链接,再在 Mac 上 `linux/vm/vmctl.sh type ok`;`/tmp/focus-probe.log` 里不能出现 `active=False`,最后一行应是 `text=…ok`。xdotool 只到 XWayland,测不了这个。diff --git a/linux/cicada/app/debug.py b/linux/cicada/app/debug.pyindex 0810640..faa7e53 100644--- a/linux/cicada/app/debug.py+++ b/linux/cicada/app/debug.py@@ -411,7 +411,7 @@ def command(app, line: str) -> dict:app.show_onboarding()app.onboarding.go(int(arg))return {"ok": True, "step": app.onboarding.step if app.onboarding is not None else "done"}- if cmd.startswith(("fix", "vocab")) or cmd in ("heard", "ask-names", "resettle"):+ if cmd.startswith(("fix", "vocab")) or cmd in ("heard", "ask-names", "resettle", "word-list"):return _fixes(app, cmd, arg)if cmd == "quit":app.quit()@@ -438,7 +438,9 @@ def _fixes(app, cmd: str, arg: str) -> dict:meeting being listened to: the record, the fixing request, the notes window all follow) |fix-state [<id>] | fix-answer yes|no [<id>] | fix-later [<id>] | fix-undo | fix-revert <line> [<id>] |fix-edit <line>=<text>[|one][|keep0][|@<id>] | vocab-add Morpho=莫拉、莫法[|…] | vocab-remove <word> |- vocab-state | resettle <line>=<text> (the line heard again as <text>, then translated and fixed+ vocab-state | fix-editor <line>=<text> (改这句… open in the records window) |+ word-list [import <text>|edit <word>|delete <word>] (设置 › 词表 on screen) |+ resettle <line>=<text> (the line heard again as <text>, then translated and fixedagain with the lines after it in view)"""words = arg.split()fx = app.fixes@@ -506,6 +508,43 @@ def _fixes(app, cmd: str, arg: str) -> dict:if cmd == "fix-undo":fx.undo()return {"ok": True}+ if cmd == "fix-editor":+ # 改这句… open on a line of the record shown, with <text> typed in (the VM can't type Chinese).+ line_id, _, text = arg.partition("=")+ w = app.records_window+ if w is None or not w.get_visible():+ return {"ok": False, "error": "records window not shown"}+ w.edit_line(line_id, text or None)+ return {"ok": True}+ if cmd == "word-list":+ # 设置 › 词表 on screen: `word-list` scrolls to it; `word-list import <text>` opens 粘贴导入 with+ # <text> pasted ("|" for new lines); `word-list edit <word>` opens its spelling.+ app.show_settings()+ sw = app.settings_window+ wl = sw.word_list+ kind, _, rest = arg.partition(" ")+ if kind == "import":+ wl._import()+ wl.dialog_view.get_buffer().set_text(rest.replace("|", "\n"))+ elif kind == "edit":+ wl._edit(rest)+ elif kind == "heard": # word-list heard <word>=<form>: typed into its 加一个容易听错的词+ word, _, form = rest.partition("=")+ t = next((t for t in app.vocabulary.snapshot() if t.word == word), None)+ if t is not None:+ wl._add_heard(t, form)+ elif kind == "delete":+ t = next((t for t in app.vocabulary.snapshot() if t.word == rest), None)+ if t is not None:+ wl._remove(t)++ def scroll():+ pos = sw.word_list_group.translate_coordinates(sw.scroll.get_child().get_child(), 0, 0)+ if pos:+ sw.scroll.get_vadjustment().set_value(max(0, pos[-1] - 12))+ return False+ GLib.timeout_add(200, scroll)+ return {"ok": True}if cmd == "fix-revert":sid = sid_at(1)line = app.store.line(sid, words[0]) if words else Nonediff --git a/linux/cicada/app/main.py b/linux/cicada/app/main.pyindex 894a41e..744d42a 100644--- a/linux/cicada/app/main.py+++ b/linux/cicada/app/main.py@@ -261,6 +261,7 @@ class Controller:self.tray.update()if self.settings_window is not None:self.settings_window.refresh_version()+ self.settings_window.word_list.refresh()self.check_problem()return FalseGLib.idle_add(run)diff --git a/linux/cicada/app/notes_window.py b/linux/cicada/app/notes_window.pyindex a18dcd1..d9b416d 100644--- a/linux/cicada/app/notes_window.py+++ b/linux/cicada/app/notes_window.py@@ -11,11 +11,11 @@ from __future__ import annotationsfrom datetime import datetime, timezone-from gi.repository import Gdk, GLib, Gtk+from gi.repository import Gdk, GLib, Gtk, Pangofrom ..core import notes as notesmodfrom ..core import problem-from ..core import roommic, speakers+from ..core import live_fixes, roommic, speakersfrom ..core.strings import L, LFfrom ..core.support import Log, clockfrom . import ui, x11@@ -199,6 +199,12 @@ class NotesWindow(Gtk.Window):self.lang_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=8)self.lang_wrap = ui.pad(self.lang_box, 0, 12, 8, 12)outer.pack_start(self.lang_wrap, False, False, 0)+ # 改正听错的词: 这样改对吗? above both tabs (the window opens on 纪要, where a card in the+ # transcript would never be seen), and the last decision with 撤销.+ self.fix_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=8)+ self.fix_wrap = ui.pad(self.fix_box, 0, 12, 8, 12)+ self.fix_wrap.set_no_show_all(True)+ outer.pack_start(self.fix_wrap, False, False, 0)self.columns = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0, homogeneous=True)self.scroll = Gtk.ScrolledWindow()self.scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)@@ -268,6 +274,7 @@ class NotesWindow(Gtk.Window):self._layout()self._fill_ending()self._fill_languages()+ self._fill_fix()adj = self.scroll.get_vadjustment()keep = adj.get_value()self._fill_body()@@ -480,7 +487,10 @@ class NotesWindow(Gtk.Window):topics = [(t.start, t.title) for t in self.app.notes.notes.topics]self._places = roommic.heard_both(lines) # 电脑和会议室: each of their lines says wherekey = (self._places, len(lines), lines[-1].id if lines else None, (lines[-1].dst or "") if lines else "", tuple(terms), current,- tuple(sorted(nums.items())), tuple(sorted(names.items())), pending, tuple(topics))+ tuple(sorted(nums.items())), tuple(sorted(names.items())), pending, tuple(topics),+ # 改正听错的词: any line's fixes changing (a fix in, 改回, 对) redraws it.+ tuple((l.id, tuple((f.from_, f.to, f.ask, f.off, f.user) for f in l.fixes)) for l in lines if l.fixes))+ self._newest = lines[-1].id if lines and self.app.listen.listening else Noneself._fill_search_tools()if key == self._transcript_key and not scroll:return@@ -548,9 +558,88 @@ class NotesWindow(Gtk.Window):top.pack_start(ui.text(clock(l.t), 11, "tertiary", wrap=False, ellipsize=False), False, False, 0)row.pack_start(top, False, False, 0)if l.dst and l.dst != l.shown:- row.pack_start(ui.marked(l.shown, terms, 12, "secondary", current, lang=l.srcLang), False, False, 0)- row.pack_start(ui.marked(l.dst or l.shown, terms, 13, "ink", current, lang=l.dstLang if l.dst else l.srcLang), False, False, 0)- return row+ row.pack_start(ui.fixed(l, 12, "secondary", terms, current), False, False, 0)+ row.pack_start(ui.marked(l.dst, terms, 13, "ink", current, lang=l.dstLang), False, False, 0)+ else:+ row.pack_start(ui.fixed(l, 13, "ink", terms, current), False, False, 0)+ applied = [(l.id, f) for f in l.fixes or [] if f.applied]+ if not applied:+ return row+ # 改正听错的词: pointing at the line shows what each fixed word was heard as, with 改回. The newest+ # line shows it open too: hover in a window that never takes focus is not to be counted on.+ sid = self._session().id++ def revert(line_id, fix):+ self.app.fixes.revert(fix, line_id, sid)+ words = ui.gap(ui.fixed_words(applied, revert), 2)+ row.pack_start(words, False, False, 0)+ if l.id == getattr(self, "_newest", None):+ return row+ words.set_no_show_all(True)+ for c in words.get_children(): # ready, so show() alone reveals them+ c.show_all()+ hover = Gtk.EventBox()+ hover.add_events(Gdk.EventMask.ENTER_NOTIFY_MASK | Gdk.EventMask.LEAVE_NOTIFY_MASK)+ hover.add(row)+ hover.connect("enter-notify-event", lambda *_: words.show() or False)++ def left(_w, event):+ if event.detail != Gdk.NotifyType.INFERIOR:+ words.hide()+ return False+ hover.connect("leave-notify-event", left)+ return hover++ # 改正听错的词++ def _fill_fix(self) -> None:+ """这样改对吗?: a name sound can't check, asked about once, clicks only (the window never takes+ focus). 对 fixes every line waiting on it and adds it to 词表; × asks again after the meeting.+ The Mac hides it while the window is shown to the other side; Linux can't keep the window out+ of a share (the footer says so), so it is always shown. Then the last decision, with 撤销."""+ session = self._session()+ fx = self.app.fixes+ a = fx.asking(session.id) if session is not None else None+ toast = fx.toast_text()+ key = (session.id if session else None, a[1].from_ if a else None, a[1].to if a else None, a[3] if a else 0,+ a[0].id if a else None, toast, fx.can_undo)+ if key == getattr(self, "_fix_key", None):+ return+ self._fix_key = key+ ui.clear(self.fix_box)+ if a is not None:+ self.fix_box.pack_start(self._fix_card(session.id, *a), False, False, 0)+ if toast:+ self.fix_box.pack_start(ui.fix_toast(fx, toast), False, False, 0)+ # Gone once its time is up.+ GLib.timeout_add(int(1000 * (live_fixes.TOAST_SECONDS + 0.2)), lambda: self.refresh() and False)+ self.fix_wrap.set_visible(a is not None or bool(toast))+ for c in self.fix_box.get_children(): # show_all() stops at a no_show_all box+ c.show_all()++ def _fix_card(self, sid, line, fix, _position, of) -> Gtk.Widget:+ from ..core.correction import core+ cf, ct = core(fix.from_, fix.to)+ fx = self.app.fixes+ head = ui.hbox(8)+ head.pack_start(ui.text(L("这样改对吗?"), 13, "ink", bold=True, wrap=False, ellipsize=False), False, False, 0)+ head.pack_start(ui.text(L("确认后整场一起改,以后也这样改"), 12, "tertiary", wrap=False), True, True, 0)+ if of > 1:+ head.pack_end(ui.text("1 / %d" % of, 12, "tertiary", wrap=False, ellipsize=False), False, False, 0)+ what = Gtk.Label()+ what.set_xalign(0)+ what.set_markup('<span size="%d">%s <span foreground="#6B7080">→</span> <b>%s</b></span>'+ % (14 * 768, ui.esc(cf), ui.esc(ct)))+ ui.classes(what, "ink")+ where = ui.text("%s · %s" % (clock(line.t), line.src), 11, "tertiary", wrap=False, lang=line.srcLang)+ left = ui.vbox(2, what, where)+ row = ui.hbox(8)+ row.pack_start(left, True, True, 0)+ row.pack_start(ui.soft_button(L("对"), lambda: fx.answer(fix, True, sid), dark=True), False, False, 0)+ row.pack_start(ui.soft_button(L("不对"), lambda: fx.answer(fix, False, sid)), False, False, 0)+ row.pack_start(ui.icon_button("window-close-symbolic", L("稍后再看"), lambda: fx.later(fix, sid), px=11, focus=False),+ False, False, 0)+ return ui.panel(ui.pad(ui.vbox(8, head, row), 10, 12), "fixcard")# Ending by itself@@ -780,8 +869,11 @@ class NotesWindow(Gtk.Window):box.pack_start(ui.text(speakers.label(n, speakers.names(session)), 11, "spk%d" % ((n - 1) % 4 + 1),bold=True, wrap=False), False, False, 0)if line.dst and line.dst != line.shown:- box.pack_start(ui.text(line.shown, 13 if self.subtitles else 12, "secondary",- wrap=not self.subtitles, width_chars=60, lang=line.srcLang), False, False, 0)+ src = ui.fixed(line, 13 if self.subtitles else 12, "secondary")+ if self.subtitles:+ src.set_line_wrap(False)+ src.set_ellipsize(Pango.EllipsizeMode.END)+ box.pack_start(src, False, False, 0)box.pack_start(ui.text(line.dst or line.shown, big, "ink", bold=True, width_chars=60 if self.subtitles else 30,lang=line.dstLang if line.dst else line.srcLang), False, False, 0)if not self.subtitles and (listen.pending > 0 or kind == "busy"):diff --git a/linux/cicada/app/records_window.py b/linux/cicada/app/records_window.pyindex 63d4135..62d0ae1 100644--- a/linux/cicada/app/records_window.py+++ b/linux/cicada/app/records_window.py@@ -42,6 +42,10 @@ class RecordsWindow(Gtk.Window):self._player_sid = Noneself._dragging = Falseself._hl_row = None # the transcript row at the playhead+ # 改这句…: the line being rewritten and what its editor opens with; the last fix toast shown.+ self._editing = None+ self._edit_start = ""+ self._fix_toast = Nonebar = Gtk.HeaderBar()bar.set_show_close_button(True)@@ -344,6 +348,7 @@ class RecordsWindow(Gtk.Window):self._queued = Falseif self.get_visible():self.fill()+ self.fix_toast()return FalseGLib.idle_add(run)@@ -775,6 +780,7 @@ class RecordsWindow(Gtk.Window):self.transcript.reorder_child(row, i + 1) # after the headerrow.show_all()self._rows[i] = (k, row)+ self._fill_fix_banner(s)self._more_rows()# The recording (保存会议录音)@@ -1047,7 +1053,10 @@ class RecordsWindow(Gtk.Window):has_dst = any(l.dst and l.dst != l.shown for l in s.lines)if has_dst:head.pack_end(ui.segmented([("both", L("双语")), ("dst", L("只看译文"))], self.mode, mode), False, False, 0)- col.pack_start(head, False, False, 0)+ # The review banner rides with the header, so the rows keep their places among col's children.+ self.fix_banner = ui.vbox(0)+ self._banner_key = None+ col.pack_start(ui.vbox(0, head, self.fix_banner), False, False, 0)self.transcript = colself._both = s.sourceFile is None and any(l.speaker == "me" for l in s.lines)self._nums, self._vnums, self._shown = self._speakers(s)@@ -1058,6 +1067,8 @@ class RecordsWindow(Gtk.Window):col.pack_start(self._people(s), False, False, 0)self._rows = []self._loader = None+ self._editing = None+ self._fill_fix_banner(s)self._more_rows(first=True)return col@@ -1078,7 +1089,8 @@ class RecordsWindow(Gtk.Window):roommic.heard_both(s.lines))def _row_key(self, l, start):- return (l.id, l.shown, l.dst, l.voice, start)+ fixes = tuple((f.from_, f.to, f.ask, f.off, f.user) for f in l.fixes or [])+ return (l.id, l.shown, l.dst, l.voice, start, fixes, self._editing == l.id)def _who(self, l):"""The label at a change of speaker, and its colour class."""@@ -1265,16 +1277,217 @@ class RecordsWindow(Gtk.Window):label = ui.hbox(6, label, ui.place_tag(l))texts.pack_start(label, False, False, 0)translated = l.dst and l.dst != l.shown- texts.pack_start(ui.text(l.dst if translated else l.shown, 13, "ink", selectable=True, width_chars=46,- lang=l.dstLang if translated else l.srcLang), False, False, 0)- if translated and self.mode == "both":- texts.pack_start(ui.text(l.shown, 12, "tertiary", selectable=True, width_chars=46, lang=l.srcLang), False, False, 0)+ if self._editing == l.id:+ texts.pack_start(self._line_editor(l), False, False, 0)+ else:+ if translated:+ texts.pack_start(ui.text(l.dst, 13, "ink", selectable=True, width_chars=46, lang=l.dstLang), False, False, 0)+ if not translated or self.mode == "both":+ src = ui.fixed(l, 12 if translated else 13, "tertiary" if translated else "ink")+ src.set_selectable(True)+ src.set_max_width_chars(46)+ texts.pack_start(src, False, False, 0)+ # Pointing at a line: what its fixed words were heard as, 改回, and 改这句….+ tools = ui.hbox(8)+ applied = [(l.id, f) for f in l.fixes or [] if f.applied]+ if applied:+ tools.pack_start(ui.fixed_words(applied, lambda i, f: self.app.fixes.revert(f, i, self._sid)), False, False, 0)+ edit = Gtk.Button(label=L("改这句…"))+ ui.classes(edit, "fixlink")+ edit.set_valign(Gtk.Align.CENTER)+ edit.connect("clicked", lambda *_: self.edit_line(l.id))+ tools.pack_start(edit, False, False, 0)+ tools.set_no_show_all(True)+ for c in tools.get_children():+ c.show_all()+ texts.pack_start(ui.gap(tools, 2), False, False, 0)row.pack_start(texts, True, True, 0)ui.pad(row, 9, 0, 9, 0)panel = ui.panel(row, "transcript-row")panel.time_label = t+ if self._editing != l.id:+ panel.add_events(Gdk.EventMask.ENTER_NOTIFY_MASK | Gdk.EventMask.LEAVE_NOTIFY_MASK | Gdk.EventMask.BUTTON_PRESS_MASK)+ panel.connect("enter-notify-event", lambda *_: tools.show() or False)++ def left(_w, event):+ if event.detail != Gdk.NotifyType.INFERIOR:+ tools.hide()+ return False+ panel.connect("leave-notify-event", left)+ panel.connect("button-press-event", lambda _w, e: self._line_menu(e, l.id))return self._row_key(l, start), panel+ # 改正听错的词: 改这句…, the review banner, the toast++ def _line_menu(self, event, line_id) -> bool:+ """Right-click on a line: 改这句…."""+ if event.button != 3:+ return False+ menu = Gtk.Menu()+ item = Gtk.MenuItem(label=L("改这句…"))+ item.connect("activate", lambda *_: self.edit_line(line_id))+ menu.append(item)+ menu.show_all()+ menu.attach_to_widget(self, None)+ menu.popup_at_pointer(event)+ return True++ def edit_line(self, line_id, start: str | None = None) -> None:+ """Opens 改这句… on a line, with the line as shown (or `start`, the banner's suggestion)."""+ l = self.app.store.line(self._sid, line_id)+ if l is None:+ return+ before = self._editing+ self._editing, self._edit_start = line_id, start if start is not None else l.shown+ if before is not None and before != line_id:+ self._rebuild_row(before) # one editor at a time+ self._rebuild_row(line_id)++ def _rebuild_row(self, line_id) -> None:+ s = self.app.store.get(self._sid)+ if s is None:+ return+ starts = self._starts(s.lines)+ for i, l in enumerate(s.lines[:len(self._rows)]):+ if l.id == line_id:+ old = self._rows[i][1]+ k, row = self._row(l, l.id in starts)+ parent = old.get_parent()+ pos = parent.get_children().index(old)+ parent.remove(old)+ old.destroy()+ parent.pack_start(row, False, False, 0)+ parent.reorder_child(row, pos)+ row.show_all()+ self._rows[i] = (k, row)+ if self._editing == line_id:+ GLib.idle_add(lambda: self._reveal(row) and False)+ return++ def _line_editor(self, l) -> Gtk.Widget:+ """改这句…: the line as shown, to rewrite (the Mac's LineEditor). What changed becomes the user's+ own fix, on every line heard the same way or only this one, and with 记进词表 the word list's."""+ fx, sid = self.app.fixes, self._sid+ box = ui.vbox(8)+ entry = Gtk.Entry()+ entry.set_text(self._edit_start)+ entry.set_placeholder_text(L("改这句"))+ ui.classes(entry, "fixedit")+ box.pack_start(entry, False, False, 0)+ options = ui.vbox(6)+ box.pack_start(options, False, False, 0)+ state = {"everywhere": True, "keep": True}++ def close():+ self._editing = None+ self._rebuild_row(l.id)++ def apply():+ same = fx.same_heard(l.id, sid, entry.get_text())+ if same is None:+ close()+ return+ every = state["everywhere"] if same[1] > 1 else True+ self._editing = None+ fx.edit(l.id, sid, entry.get_text(), everywhere=every, remember=state["keep"] and every)+ self._rebuild_row(l.id)++ def update(*_):+ ui.clear(options)+ same = fx.same_heard(l.id, sid, entry.get_text())+ if same is not None:+ heard, n = same+ options.pack_start(ui.hbox(6, ui.text(L("听成"), 12, "tertiary", wrap=False, ellipsize=False),+ ui.text(heard, 12, "ink", wrap=False)), False, False, 0)+ keep = Gtk.CheckButton(label=L("记进词表,以后自动改"))+ keep.set_active(state["keep"])+ keep.connect("toggled", lambda b: state.__setitem__("keep", b.get_active()))+ if n > 1:+ all_ = Gtk.RadioButton.new_with_label(None, LF("整场听成 %@ 的 %lld 处都改", heard, n))+ one = Gtk.RadioButton.new_with_label_from_widget(all_, L("只改这一处"))+ (all_ if state["everywhere"] else one).set_active(True)++ def scope(b):+ state["everywhere"] = all_.get_active()+ keep.set_sensitive(state["everywhere"])+ all_.connect("toggled", scope)+ keep.set_sensitive(state["everywhere"])+ options.pack_start(all_, False, False, 0)+ options.pack_start(one, False, False, 0)+ options.pack_start(keep, False, False, 0)+ options.show_all()+ entry.connect("changed", update)+ entry.connect("activate", lambda *_: apply())++ def key(_w, event):+ if event.keyval == Gdk.KEY_Escape:+ close()+ return True+ return False+ entry.connect("key-press-event", key)+ update()+ foot = ui.hbox(8)+ foot.pack_start(ui.text(L("回车 改成 · esc 取消"), 11, "tertiary", wrap=False), True, True, 0)+ foot.pack_end(ui.soft_button(L("改成"), apply, dark=True), False, False, 0)+ foot.pack_end(ui.soft_button(L("取消"), close), False, False, 0)+ box.pack_start(foot, False, False, 0)+ def focus():+ entry.grab_focus()+ entry.set_position(-1) # the caret at the end, not the whole line selected+ return False+ GLib.idle_add(focus)+ return box++ def _fill_fix_banner(self, s) -> None:+ """Above a finished meeting's transcript (the Mac's FixReviewBanner): how many words were fixed,+ and the ones waiting for the user, one at a time (对 / 不对 / 改成…)."""+ box = getattr(self, "fix_banner", None)+ if box is None:+ return+ live = self.app.listen.listening and self.app.listen.session_id == s.id+ fx = self.app.fixes+ waiting = [] if live else fx.pending(s.id)+ fixed = sum(1 for l in s.lines for f in l.fixes or [] if f.applied)+ key = (s.id, live, fixed, len(waiting), (waiting[0][0].id, waiting[0][1].from_, waiting[0][1].to) if waiting else None)+ if key == getattr(self, "_banner_key", None):+ return+ self._banner_key = key+ ui.clear(box)+ if waiting:+ from ..core.correction import core+ line, fix = waiting[0]+ cf, ct = core(fix.from_, fix.to)+ left = ui.vbox(2)+ left.pack_start(ui.text(LF("改了 %lld 处听错的词,%lld 处等你确认", fixed, len(waiting)), 13, "ink", bold=True, width_chars=40),+ False, False, 0)+ what = Gtk.Label()+ what.set_xalign(0)+ what.set_markup('<span size="%d">%s → %s?<span foreground="#6B7080"> · %s</span></span>'+ % (12 * 768, ui.esc(cf), ui.esc(ct), ui.esc(clock(line.t))))+ ui.classes(what, "secondary")+ left.pack_start(what, False, False, 0)+ row = ui.hbox(10)+ row.pack_start(left, True, True, 0)+ row.pack_start(ui.soft_button(L("对"), lambda: fx.answer(fix, True, s.id), dark=True), False, False, 0)+ row.pack_start(ui.soft_button(L("不对"), lambda: fx.answer(fix, False, s.id)), False, False, 0)+ # 改成…: the editor on that line, to write what was really said.+ row.pack_start(ui.soft_button(L("改成…"), lambda: self.edit_line(line.id)), False, False, 0)+ for b in row.get_children()[1:]:+ b.set_valign(Gtk.Align.CENTER)+ box.pack_start(ui.gap(ui.panel(ui.pad(row, 10, 14), "fixbanner"), 10), False, False, 0)+ elif fixed:+ box.pack_start(ui.gap(ui.text(LF("改了 %lld 处听错的词", fixed), 12, "tertiary", wrap=False), 6), False, False, 0)+ box.show_all()++ def fix_toast(self) -> None:+ """The last fix decision, with 撤销, as this window's toast (once per decision)."""+ fx = self.app.fixes+ text = fx.toast_text()+ if text is None or fx.toast is self._fix_toast:+ return+ self._fix_toast = fx.toast+ self.toasts.show(text, L("撤销") if fx.can_undo else None, fx.undo, seconds=6)+def _starts(self, lines) -> set:"""Lines whose speaker label shows: a change of speaker, or in 电脑和会议室 of place too."""starts = speakers.run_starts(lines, self._nums)diff --git a/linux/cicada/app/settings_window.py b/linux/cicada/app/settings_window.pyindex fe1a8b1..1727902 100644--- a/linux/cicada/app/settings_window.py+++ b/linux/cicada/app/settings_window.py@@ -186,6 +186,12 @@ class SettingsWindow(Gtk.Window):page.pack_start(self._group(L("语言"), ui.boxed([ui.prow(L("翻译成"), combos[0]), ui.prow(L("纪要语言"), combos[1], L("实时纪要和完整版同一种语言")), ui_row])),False, False, 0)+ # 词表 (改正听错的词), after 语言 as on the Mac.+ from .word_list import WordList+ self.word_list = WordList(app, self._group)+ self.word_list_group = self.word_list.widget+ page.pack_start(self.word_list_group, False, False, 0)+# While listeningswitch = Gtk.Switch()switch.set_active(autostart_enabled())@@ -966,6 +972,10 @@ class SettingsWindow(Gtk.Window):else L("换一个模型后可用") if reason == aicheck.NO_MODEL else later)))rows.append((L("翻译"),) + ((uses, "ok", L("整句用它;不行时换 Google")) if text_on else("Google", "off", L("先用 Google 翻译") if ling.has_key else L("没有 key 时照常可用"))))+ # 改正听错的词: on Linux one more text request per sentence (Ming already translated it).+ fix_on = text_on and self.app.settings.fixMisheard+ rows.append((L("改正听错的词"), uses if fix_on else L("已关") if text_on else off, "ok" if fix_on else "off",+ L("每句多发一次文字请求") if fix_on else L("在“词表”里打开") if text_on else later))if ling.speaks and hear_on:# 同传 hears me with the hear model first, then speaks with the voice model.if ling.last_voice is not None:diff --git a/linux/cicada/app/ui.py b/linux/cicada/app/ui.pyindex 6de87c9..f728c94 100644--- a/linux/cicada/app/ui.py+++ b/linux/cicada/app/ui.py@@ -259,6 +259,23 @@ button.pillkeep label { color: #15171C; }.toast label { color: #F2F3F5; }.toast button { background-image: none; background-color: rgba(255,255,255,0.12); color: #FFFFFF; border: none; box-shadow: none; border-radius: 6px; padding: 1px 10px; }.toast button label { color: #FFFFFF; }+.toast button.undo { background-color: transparent; padding: 1px 6px; }+.toast button.undo label { color: #FFB59C; font-weight: 700; }++/* Fixing misheard words: a fixed word's chip, the confirm card, the review banner. */+.fixchip { background-color: #F2F3F5; border-radius: 6px; }+.panel.dark .fixchip { background-color: #2A2C32; }+button.fixlink { background: none; border: none; box-shadow: none; padding: 0; min-height: 0; color: #B33A14; font-size: 11px; font-weight: 500; }+button.fixlink label { color: #B33A14; }+.fixcard { background-color: #FFFFFF; border: 1px solid rgba(0,0,0,0.08); border-radius: 10px; box-shadow: 0 4px 10px rgba(0,0,0,0.08); }+.panel.dark .fixcard { background-color: #22242A; border-color: #3A3C43; }+.fixbanner { background-color: #FEF6F2; border: 1px solid #FBE0D5; border-radius: 12px; }+button.softbtn { background-image: none; background-color: #ECEDF0; border: none; box-shadow: none; border-radius: 7px; padding: 4px 14px; color: #5A5F6B; }+button.softbtn:hover { background-color: #E2E4E8; }+.fixeditor { border: 1px solid #15171C; border-radius: 8px; background-color: #FFFFFF; }+.fixeditor text { background-color: #FFFFFF; color: #15171C; }+.heardchip { background-color: #F2F3F5; border-radius: 5px; }+.dashed { border: 1px dashed #CDD0D6; border-radius: 9px; }.notes-window { background-color: transparent; }.panel .speakbox { background-color: #FDEEE8; border-radius: 12px; }@@ -501,6 +518,82 @@ def marked(s: str, terms: list, size: int = 13, cls: str = "ink", current: boolreturn l+def fixed(line, size: int = 13, cls: str = "ink", terms: list = (), current: bool = False, lang: str | None = None) -> Gtk.Label:+ """A line as shown (改正听错的词): each fixed word underlined in grey (the Mac's dotted underline;+ Pango has no dotted one), a word waiting for the user on a pale wash. While searching, the search+ marks instead."""+ from ..core.correction import apply+ if terms or not line.fixes:+ return marked(line.shown, list(terms), size, cls, current, lang=lang or line.srcLang)+ s, marks = apply(line.fixes, line.src)+ asks = []+ for f in line.fixes:+ if f.ask is True:+ i = s.find(f.from_)+ if i >= 0:+ asks.append((i, i + len(f.from_)))+ spans = sorted([(a, b, ' underline="single" underline_color="#9EA2AC"') for a, b in marks]+ + [(a, b, ' background="#FBE0D5"') for a, b in asks])+ out, at = [], 0+ for a, b, attr in spans:+ if a < at:+ continue+ out.append(esc(s[at:a]))+ out.append("<span%s>%s</span>" % (attr, esc(s[a:b])))+ at = b+ out.append(esc(s[at:]))+ l = text(s, size, cls, lang=lang or line.srcLang)+ size_, lang_, bold = l.cicada_format+ l.set_markup('<span size="%d" lang="%s"%s>%s</span>' % (round(size_ * 768), lang_, ' weight="bold"' if bold else "", "".join(out)))+ return l+++def fixed_words(items, on_revert) -> Gtk.Widget:+ """Under a line: each fixed word, what it was heard as, and 改回. `items`: [(line id, fix)]."""+ from ..core.correction import core+ w = Wrap(6)+ for line_id, f in items:+ cf, ct = core(f.from_, f.to)+ row = hbox(6)+ lab = Gtk.Label()+ lab.set_markup('<span size="%d"><span foreground="#6B7080">%s</span> %s <span foreground="#6B7080">→</span> %s</span>'+ % (11 * 768, esc(L("听成")), esc(cf), esc(ct)))+ classes(lab, "ink")+ row.pack_start(lab, False, False, 0)+ b = Gtk.Button(label=L("改回"))+ classes(b, "fixlink")+ b.set_can_focus(False) # the notes window never takes focus+ b.connect("clicked", lambda *_a, i=line_id, f=f: on_revert(i, f))+ row.pack_start(b, False, False, 0)+ w.add(panel(pad(row, 3, 8), "fixchip"))+ return w+++def soft_button(label: str, on_click, dark: bool = False) -> Gtk.Button:+ """The Mac's SoftButton: dark for the answer, soft grey for the rest. Never takes focus."""+ b = Gtk.Button(label=label)+ classes(b, "darkbtn" if dark else "softbtn")+ b.set_can_focus(False)+ b.connect("clicked", lambda *_: on_click())+ return b+++def fix_toast(fixes, message: str) -> Gtk.Widget:+ """The last fix decision said back (the Mac's FixToast): dark, with 撤销 while there is something+ to undo. Shown in place, not as an overlay: the notes window lays out top to bottom."""+ row = hbox(14)+ row.pack_start(text(message, 13, "", wrap=False), True, True, 0)+ if fixes.can_undo:+ b = Gtk.Button(label=L("撤销"))+ classes(b, "undo")+ b.set_can_focus(False)+ b.connect("clicked", lambda *_: fixes.undo())+ row.pack_start(b, False, False, 0)+ box = panel(pad(row, 5, 6, 5, 14), "toast")+ box.set_halign(Gtk.Align.CENTER)+ return box++def helper(s: str) -> Gtk.Label:return text(s, 11, "tertiary")diff --git a/linux/cicada/app/word_list.py b/linux/cicada/app/word_list.pynew file mode 100644index 0000000..0aaaf17--- /dev/null+++ b/linux/cicada/app/word_list.py@@ -0,0 +1,300 @@+"""设置 › 词表 (the Mac's WordListSettings.swift): the switches for 改正听错的词, and the word list itself+(core/vocabulary.py): each word, what it has been heard as, where it came from and how often it fixed+a line. Everything is edited in place; changes count from the next sentence on."""+from __future__ import annotations++from gi.repository import Gdk, GLib, Gtk++from ..core import vocabulary as vocab+from ..core.strings import L, LF+from . import ui+++class WordList:+ def __init__(self, app, group):+ self.app = app+ self.group = group # SettingsWindow._group+ self.query = ""+ self.deleted = None # (term, index): shown in its place with 撤销 for a few seconds+ self._deleted_at = 0+ self.editing = None # the word whose spelling is being changed+ self.conflict = None # (word, heard, owner): a heard form typed that another word has+ self.typing = {} # word → text typed into its 加一个容易听错的词 (kept through a refresh)+ self._key = None+ self.box = ui.vbox(14)+ self.refresh()++ @property+ def widget(self) -> Gtk.Widget:+ return self.group(L("词表"), self.box)++ def refresh(self) -> None:+ app = self.app+ terms = app.vocabulary.snapshot()+ ling = app.ling+ key = (tuple((t.word, tuple(t.heard), t.source, t.fixes) for t in terms), self.query, ling.usable,+ app.settings.fixMisheard, app.settings.askNames, self.deleted and self.deleted[0].word, self.editing,+ self.conflict, ling.provider.name)+ if key == self._key:+ return+ self._key = key+ ui.clear(self.box)+ self.box.pack_start(self._switches(), False, False, 0)+ self.box.pack_start(self._head(terms), False, False, 0)+ if not terms and self.deleted is None:+ self.box.pack_start(ui.text(L("还没有词。把常用的人名、产品名贴进来,会中就照这些写法改"), 12, "tertiary", width_chars=60),+ False, False, 0)+ else:+ rows = []+ if self.deleted is not None:+ d = self.deleted[0]+ row = ui.hbox(10)+ lab = Gtk.Label()+ lab.set_markup('<span size="%d">%s <b>%s</b></span>' % (13 * 768, ui.esc(L("已删除")), ui.esc(d.word)))+ ui.classes(lab, "secondary")+ row.pack_start(lab, False, False, 0)+ row.pack_end(ui.classes(ui.link(L("撤销"), self._undo_delete), "fixlink"), False, False, 0)+ rows.append(ui.panel(ui.pad(row, 6, 14), "prow"))+ rows += [self._row(t) for t in self._shown(terms)]+ self.box.pack_start(ui.boxed(rows), False, False, 0)+ self.box.pack_start(ui.text(LF("最多 %lld 个,满了优先用最近的。只存在这台电脑上", vocab.LIMIT), 11, "tertiary", width_chars=60),+ False, False, 0)+ self.box.show_all()++ # The switches++ def _switches(self) -> Gtk.Widget:+ app, s = self.app, self.app.settings+ ling = app.ling+ if ling.usable:+ fix = Gtk.Switch()+ fix.set_active(s.fixMisheard)+ fix.connect("notify::active", lambda w, _p: self._set("fixMisheard", w.get_active()))+ first = ui.prow(L("会中改正听错的词"), fix, LF("走 %@,只发文字", ling.provider.name))+ else:+ go = ui.link(L("去设置"), lambda: app.show_settings(ai=True))+ ui.classes(go, "fixlink")+ first = ui.prow(L("会中改正听错的词"), go, L("接上 AI 服务后才会改"))+ ask = Gtk.Switch()+ ask.set_active(s.askNames)+ ask.set_sensitive(s.fixMisheard and ling.usable)+ ask.connect("notify::active", lambda w, _p: self._set("askNames", w.get_active()))+ return ui.boxed([first, ui.prow(L("没见过的名字和专称先问我"), ask, L("关掉就只改词表里的词和同音错字"))])++ def _set(self, name: str, on: bool) -> None:+ setattr(self.app.settings, name, on)+ self.app.settings.save()+ GLib.idle_add(lambda: self.refresh() and False)++ # The list++ def _head(self, terms) -> Gtk.Widget:+ head = ui.hbox(10)+ head.pack_start(ui.text(L("词"), 13, "secondary", bold=True, wrap=False, ellipsize=False), False, False, 0)+ if terms:+ head.pack_start(ui.text(str(len(terms)), 12, "tertiary", wrap=False, ellipsize=False), False, False, 0)+ head.pack_end(ui.soft_button(L("粘贴导入…"), self._import, dark=True), False, False, 0)+ if len(terms) > 12:+ search = Gtk.SearchEntry()+ search.set_placeholder_text(L("搜索词表"))+ search.set_text(self.query)+ search.set_size_request(160, -1)++ def typed(e):+ self.query = e.get_text()+ GLib.idle_add(lambda: self.refresh() and False)+ search.connect("search-changed", typed)+ head.pack_end(search, False, False, 0)+ return ui.gap(head, 4)++ def _shown(self, terms) -> list:+ """Most recently useful first, then the rest newest first."""+ from datetime import datetime, timezone+ oldest = datetime.min.replace(tzinfo=timezone.utc)+ ordered = sorted(reversed(terms), key=lambda t: t.used or oldest, reverse=True)+ q = vocab.key(self.query)+ if not q:+ return ordered+ return [t for t in ordered if q in vocab.key(t.word) or any(q in vocab.key(h) for h in t.heard)]++ def _row(self, t) -> Gtk.Widget:+ voc = self.app.vocabulary+ row = ui.hbox(12)+ if self.editing == t.word:+ entry = Gtk.Entry()+ entry.set_text(t.word)+ entry.set_size_request(140, -1)++ def done(*_):+ if self.editing == t.word:+ self.editing = None+ voc.rename(t.word, entry.get_text())+ GLib.idle_add(lambda: self.refresh() and False)+ return False++ def key(_w, event):+ if event.keyval == Gdk.KEY_Escape:+ self.editing = None+ GLib.idle_add(lambda: self.refresh() and False)+ return True+ return False+ entry.connect("activate", done)+ entry.connect("focus-out-event", done)+ entry.connect("key-press-event", key)+ GLib.idle_add(lambda: entry.grab_focus() and False)+ row.pack_start(entry, False, False, 0)+ else:+ b = Gtk.Button()+ lab = ui.text(t.word, 13, "ink", bold=True, wrap=False)+ lab.set_size_request(140, -1)+ b.add(lab)+ ui.classes(b, "quietbtn")+ b.set_tooltip_text(L("点一下改写法"))+ b.connect("clicked", lambda *_: self._edit(t.word))+ row.pack_start(b, False, False, 0)+ forms = ui.Wrap(4)+ for h in t.heard:+ chip = ui.hbox(3, ui.text(h, 11, "secondary", wrap=False, ellipsize=False))+ x = ui.icon_button("window-close-symbolic", L("删掉这个听错的词"),+ lambda h=h: voc.forget(h, t.word), px=8)+ x.set_size_request(16, 16)+ chip.pack_start(x, False, False, 0)+ forms.add(ui.panel(ui.pad(chip, 1, 2, 1, 6), "heardchip"))+ add = Gtk.Entry()+ add.set_placeholder_text(L("加一个容易听错的词"))+ add.set_width_chars(18)+ add.set_text(self.typing.get(t.word, ""))+ add.connect("changed", lambda e: self.typing.__setitem__(t.word, e.get_text()))+ add.connect("activate", lambda e: self._add_heard(t, e.get_text()))+ forms.add(add)+ row.pack_start(forms, True, True, 0)+ live = t.source == "live"+ row.pack_start(ui.text(L("会中确认") if live else L("你加的"), 11, "accent" if live else "tertiary", wrap=False, ellipsize=False),+ False, False, 0)+ row.pack_start(ui.text(LF("改过 %lld 次", t.fixes) if t.fixes else L("还没用上"), 11, "tertiary", wrap=False, ellipsize=False),+ False, False, 0)+ row.pack_start(ui.icon_button("user-trash-symbolic", L("从词表里删掉"), lambda: self._remove(t), px=12), False, False, 0)+ out = ui.vbox(6, row)+ if self.conflict is not None and self.conflict[0] == t.word:+ _w, heard, owner = self.conflict+ c = ui.hbox(10)+ c.pack_start(ui.text(LF("“%@”已经记在 %@ 下", heard, owner), 12, "ink", width_chars=30), True, True, 0)++ def move():+ voc.forget(heard, owner)+ voc.confirm(heard, t.word, t.source)+ self.conflict = None++ def both():+ voc.confirm(heard, t.word, t.source)+ self.conflict = None+ c.pack_end(ui.soft_button(L("两个都留"), both), False, False, 0)+ c.pack_end(ui.soft_button(LF("改给 %@", t.word), move, dark=True), False, False, 0)+ out.pack_start(c, False, False, 0)+ return ui.panel(ui.pad(out, 6, 14), "prow")++ def _edit(self, word) -> None:+ self.editing = word+ self.refresh()++ def _add_heard(self, t, text: str) -> None:+ h = text.strip()+ self.typing.pop(t.word, None)+ if not h or len(h) > 40:+ self.refresh()+ return+ owners = self.app.vocabulary.owners(h, t.word)+ if owners:+ self.conflict = (t.word, h, owners[0])+ self.refresh()+ else:+ self.app.vocabulary.confirm(h, t.word, t.source)++ def _remove(self, t) -> None:+ terms = self.app.vocabulary.snapshot()+ index = next((i for i, x in enumerate(terms) if x.word == t.word), 0)+ self.app.vocabulary.remove(t.word)+ self.deleted = (t, index)+ self._deleted_at += 1+ at = self._deleted_at++ def expire():+ if self._deleted_at == at:+ self.deleted = None+ self.refresh()+ return False+ GLib.timeout_add_seconds(8, expire)+ self.refresh()++ def _undo_delete(self) -> None:+ if self.deleted is not None:+ term, index = self.deleted+ self.deleted = None+ self.app.vocabulary.insert(term, index)+ self.refresh()++ # 粘贴导入++ def _import(self) -> None:+ """Many words at once, one per line, heard forms after "=". The counts follow what is pasted,+ and the button says how many go in."""+ voc = self.app.vocabulary+ top = self.box.get_toplevel()+ d = Gtk.Dialog(transient_for=top if isinstance(top, Gtk.Window) else None, modal=True)+ d.set_title(L("粘贴导入"))+ d.set_default_size(420, -1)+ area = d.get_content_area()+ body = ui.vbox(12)+ ui.pad(body, 20)+ body.pack_start(ui.text(L("粘贴导入"), 15, "heading", bold=True, wrap=False), False, False, 0)+ body.pack_start(ui.text(L("一行一个。常被听错的词,写在 = 后面"), 12, "secondary"), False, False, 0)+ view = Gtk.TextView()+ view.set_wrap_mode(Gtk.WrapMode.WORD_CHAR)+ view.set_left_margin(6)+ view.set_top_margin(4)+ sc = Gtk.ScrolledWindow()+ sc.set_size_request(-1, 180)+ sc.add(view)+ body.pack_start(ui.panel(sc, "boxed"), False, False, 0)+ hint = ui.text("Uniswap V3 · Morpho = 莫拉、莫法 · 巡检", 11, "tertiary", wrap=False)+ body.pack_start(hint, False, False, 0)+ counts = ui.text("", 12, "secondary")+ skipped = ui.text("", 11, "accent")+ body.pack_start(counts, False, False, 0)+ body.pack_start(skipped, False, False, 0)+ buttons = ui.hbox(8)+ cancel = ui.soft_button(L("取消"), lambda: d.destroy())+ go = ui.soft_button(LF("导入 %lld 个", 0), lambda: None, dark=True)+ buttons.pack_end(go, False, False, 0)+ buttons.pack_end(cancel, False, False, 0)+ body.pack_start(buttons, False, False, 0)+ area.pack_start(body, True, True, 0)+ buf = view.get_buffer()+ state = {"done": False}++ def text():+ return buf.get_text(buf.get_start_iter(), buf.get_end_iter(), False)++ def changed(*_):+ if state["done"]:+ return+ p = voc.preview(text())+ ui.retext(counts, LF("新增 %lld · 补充听成 %lld · 跳过 %lld", p.added, p.updated, len(p.skipped)) if text().strip() else "")+ go.set_label(LF("导入 %lld 个", p.added + p.updated))+ go.set_sensitive(p.added + p.updated > 0)+ buf.connect("changed", changed)++ def run_import(*_):+ r = voc.import_text(text())+ state["done"] = True+ buf.set_text("")+ ui.retext(counts, LF("新增 %lld · 补充听成 %lld · 跳过 %lld", r.added, r.updated, len(r.skipped)))+ ui.retext(skipped, LF("第 %@ 行没加进去:超过 40 个字", "、".join(str(n) for n in r.skipped)) if r.skipped else "")+ go.hide()+ cancel.set_label(L("完成"))+ go.connect("clicked", run_import)+ changed()+ d.show_all()+ view.grab_focus()+ self.dialog = d+ self.dialog_view = viewdiff --git a/linux/scripts/cicadactl b/linux/scripts/cicadactlindex c6e663c..62e7e8c 100755--- a/linux/scripts/cicadactl+++ b/linux/scripts/cicadactl@@ -5,6 +5,9 @@calls <program=name,…>|none|real | realcalls | endtimes <silence> <countdown> <grace>|off | endkeepnotes-tab notes|transcript | notes-search <text> | notes-wide on|off | onboarding-step <n> | settings-scroll <0-1>codecs | play [<seconds>] | pause | rate | playstate | settings-general (保存会议录音 and its player)+ fixes on|off | heard <text> | fix-state | fix-answer yes|no | fix-later | fix-revert <line> | fix-undo+ fix-edit <line>=<text>[|one][|keep0] | fix-editor <line>=<text> | vocab-add <word>=<heard>[|…] | vocab-state+ word-list [import <text>|edit <word>|heard <word>=<form>|delete <word>] (改正听错的词, debug.py › _fixes)Run it inside the Linux session (linux/vm/vmctl.sh ssh does that for the test VM)."""import osimport socketdiff --git a/linux/strings/en.lproj/Linux.strings b/linux/strings/en.lproj/Linux.stringsindex 59b4101..beeda34 100644--- a/linux/strings/en.lproj/Linux.strings+++ b/linux/strings/en.lproj/Linux.strings@@ -205,3 +205,6 @@"这台电脑缺少 AAC 编码器,装上“第三方媒体格式”后可用" = "This computer has no AAC encoder. Available once third-party media formats are installed";/* The mic row under the notes window header (notes_window.py › _fill_source): the Mac's says Mac. */"关着 · 只听电脑声音" = "Off · computer audio only";+/* 改正听错的词: Linux-only wording (a computer, not a Mac; one more text request per line) */+"最多 %lld 个,满了优先用最近的。只存在这台电脑上" = "Up to %lld, recent ones first. Stored only on this computer";+"每句多发一次文字请求" = "One more text request per sentence";diff --git a/linux/strings/ja.lproj/Linux.strings b/linux/strings/ja.lproj/Linux.stringsindex af5904a..50822a4 100644--- a/linux/strings/ja.lproj/Linux.strings+++ b/linux/strings/ja.lproj/Linux.strings@@ -205,3 +205,6 @@"这台电脑缺少 AAC 编码器,装上“第三方媒体格式”后可用" = "このコンピュータには AAC エンコーダーがありません。サードパーティのメディア形式を入れると使えます";/* The mic row under the notes window header (notes_window.py › _fill_source): the Mac's says Mac. */"关着 · 只听电脑声音" = "オフ · パソコンの音だけ";+/* 改正听错的词 */+"最多 %lld 个,满了优先用最近的。只存在这台电脑上" = "最大 %lld 個、最近使ったものを優先。このコンピュータにだけ保存";+"每句多发一次文字请求" = "1 文ごとにテキストのリクエストが 1 回増えます";diff --git a/linux/strings/ko.lproj/Linux.strings b/linux/strings/ko.lproj/Linux.stringsindex 0b8b26c..cfb8e39 100644--- a/linux/strings/ko.lproj/Linux.strings+++ b/linux/strings/ko.lproj/Linux.strings@@ -205,3 +205,6 @@"这台电脑缺少 AAC 编码器,装上“第三方媒体格式”后可用" = "이 컴퓨터에는 AAC 인코더가 없음. 서드파티 미디어 형식을 설치하면 사용 가능";/* The mic row under the notes window header (notes_window.py › _fill_source): the Mac's says Mac. */"关着 · 只听电脑声音" = "꺼짐 · 컴퓨터 소리만";+/* 改正听错的词 */+"最多 %lld 个,满了优先用最近的。只存在这台电脑上" = "최대 %lld개, 최근 것을 우선. 이 컴퓨터에만 저장";+"每句多发一次文字请求" = "문장마다 텍스트 요청이 한 번 더 감";diff --git a/site/changelog.json b/site/changelog.jsonindex ae758ba..cea8fb5 100644--- a/site/changelog.json+++ b/site/changelog.json@@ -133,6 +133,14 @@],"title": "开会时听错的人名和术语,字幕和纪要里当场就改对(需要 AI 服务)。","text": "每句话说完,知了把这句和你的词表一起发给 AI 服务,翻译时顺带找出听错的词:读音相近的错字(质压 → 质押)直接改,没见过的名字(莫拉 → Morpho)先问一次。词表里确认过的听错形式不用问 AI 服务也会改。Linux 版的识别和翻译本来一次就出来,打开这个功能后每句会多发一次文字请求。"+ },+ {+ "kind": "new",+ "platforms": [+ "linux"+ ],+ "title": "改过的词带下划线,纪要窗口里问一次“这样改对吗?”,会议记录里能自己“改这句…”,设置里多了“词表”。",+ "text": "纪要窗口的“这样改对吗?”只用点,不抢输入焦点,× 留到会后再问;指着一句能看到原来听成什么,点“改回”恢复。会议记录里右键或指着一句选“改这句…”,整场同样听错的地方一起改并记进词表;会后顶部会逐个问还没确认的改法。每次改动都能撤销。词表可以一次粘贴导入、就地改写法和听错的形式,删掉的词能撤销。Linux 没法让纪要窗口避开屏幕共享,所以“这样改对吗?”在共享屏幕时也会显示。"}]},