From 8cce8dc98b25a8d184dc6f24dbef9e7112a3220b Mon Sep 17 00:00:00 2001 From: NamPDT Date: Mon, 17 Aug 2026 14:59:42 +0900 Subject: [PATCH] =?UTF-8?q?fix(co4e):=20section=20actions=20are=20text=20a?= =?UTF-8?q?gain,=20and=20"+=20M=E1=BB=9Bi"=20says=20it=20did=20something?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * "+ Mới" / "Quản lý skill…" were full buttons, ~40px tall each — the loudest thing in a 230px sidebar, and three rows of height spent on them. The wireframe writes these as small accent text beside the heading; they are now 17px. * "+ Mới" looked broken. It was not: it replaces the canvas with a fresh empty flow, verified by loading a saved 3-node flow and pressing it (3 nodes → 0). But pressing it while the canvas ALREADY held an empty untitled flow produced an identical empty untitled flow — right, and invisible. It now focuses and selects the name field, and says "Flow mới — đặt tên rồi kéo agent vào canvas" in the status bar, so the press always has a visible result. Co-Authored-By: Claude Opus 5 (1M context) --- i18n.py | 4 ++++ theme.py | 10 ++++++++++ ui/co4e_tab.py | 18 +++++++++++++++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/i18n.py b/i18n.py index f04bf4f..0425cff 100644 --- a/i18n.py +++ b/i18n.py @@ -2666,6 +2666,10 @@ STRINGS: Dict[str, Dict[str, str]] = { "en": "Show every flow run", "ja": "すべてのフロー実行を表示", "vi": "Xem toàn bộ lần chạy flow"}, "co4e.back_to_flow": {"en": "Back to flow", "ja": "フローに戻る", "vi": "Về flow"}, + "co4e.new_flow_ready": { + "en": "New flow — type a name, then drag agents onto the canvas", + "ja": "新しいフロー — 名前を入力し、エージェントをキャンバスへ", + "vi": "Flow mới — đặt tên rồi kéo agent vào canvas"}, "co4e.tt_back_to_flow": { "en": "Back to the flow editor", "ja": "フローエディタに戻る", "vi": "Quay lại màn dựng flow"}, diff --git a/theme.py b/theme.py index a7131f6..e4441c8 100644 --- a/theme.py +++ b/theme.py @@ -430,6 +430,16 @@ QTabBar#viewTabs::tab:hover { background: $hover; color: $text; } QTabBar#viewTabs::tab:selected { background: $active; color: $text; font-weight: 600; } /* Co4E sidebar section headings — same quiet caps as the rail's RECENTS, so "which list am I looking at" is answered on screen, not in a tooltip. */ +/* The action beside a Co4E section heading ("+ Mới", "Quản lý skill…"). The + wireframe writes these as small accent text; as full buttons they were the + loudest thing in the sidebar and each cost a row of height. */ +QPushButton#co4eSectionAction { + background: transparent; border: none; color: $accent; + font-size: 11px; font-weight: 600; padding: 1px 4px; + border-radius: ${radius_sm}px; qproperty-iconSize: 11px 11px; +} +QPushButton#co4eSectionAction:hover { background: $hover; color: $accent; } +QPushButton#co4eSectionAction:pressed { background: $active; } QPushButton#co4eSectionHdr { color: $text_faint; font-size: 11px; font-weight: 700; letter-spacing: 0.5px; background: transparent; border: none; text-align: left; padding: 2px 0; diff --git a/ui/co4e_tab.py b/ui/co4e_tab.py index 2b6c142..b829b89 100644 --- a/ui/co4e_tab.py +++ b/ui/co4e_tab.py @@ -515,6 +515,9 @@ class Co4ETab(QWidget): self.wf_new_btn = QPushButton(tr("co4e.new")) self.wf_new_btn.setIcon(icon("plus")) self.wf_new_btn.setToolTip(tr("co4e.tt_new_wf")) + self.wf_new_btn.setObjectName("co4eSectionAction") + self.wf_new_btn.setFlat(True) + self.wf_new_btn.setCursor(Qt.PointingHandCursor) self.wf_new_btn.clicked.connect(self._new_workflow) wf_body = QWidget(); wl = QVBoxLayout(wf_body) wl.setContentsMargins(0, 0, 0, 0); wl.setSpacing(4) @@ -545,6 +548,9 @@ class Co4ETab(QWidget): # --- AGENTS ------------------------------------------------------ self.ag_new_btn = QPushButton(tr("co4e.new")); self.ag_new_btn.setIcon(icon("plus")) self.ag_new_btn.setToolTip(tr("co4e.tt_new_agent")) + self.ag_new_btn.setObjectName("co4eSectionAction") + self.ag_new_btn.setFlat(True) + self.ag_new_btn.setCursor(Qt.PointingHandCursor) self.ag_new_btn.clicked.connect(self._new_agent) ag_body = QWidget(); al = QVBoxLayout(ag_body) al.setContentsMargins(0, 0, 0, 0); al.setSpacing(4) @@ -563,6 +569,9 @@ class Co4ETab(QWidget): # --- SKILLS ------------------------------------------------------ self.sk_manage_btn = QPushButton(tr("co4e.manage_skills")) self.sk_manage_btn.setToolTip(tr("co4e.tt_manage_skills")) + self.sk_manage_btn.setObjectName("co4eSectionAction") + self.sk_manage_btn.setFlat(True) + self.sk_manage_btn.setCursor(Qt.PointingHandCursor) self.sk_manage_btn.clicked.connect(self._manage_skills) sk_body = QWidget(); sl = QVBoxLayout(sk_body) sl.setContentsMargins(0, 0, 0, 0); sl.setSpacing(4) @@ -1199,7 +1208,14 @@ class Co4ETab(QWidget): self._refresh_usage_total() # show THIS flow's token/cost total def _new_workflow(self) -> None: - self._open_flow(co4e.new_workflow(tr("co4e.untitled"))) # opens a new tab + self._open_flow(co4e.new_workflow(tr("co4e.untitled"))) + # Pressing this while the canvas already holds an empty untitled flow + # produced an identical empty untitled flow — correct, and completely + # invisible, so the button read as broken. Say what happened and put the + # cursor where the next thing to do is: naming it. + self.name_edit.setFocus() + self.name_edit.selectAll() + self.status_message.emit(tr("co4e.new_flow_ready")) def _selected_wf(self) -> Optional[co4e.Workflow]: """Materialise the selected saved-flow row into a Workflow."""