fix(co4e): section actions are text again, and "+ Mới" says it did something

* "+ 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) <noreply@anthropic.com>
This commit is contained in:
NamPDT
2026-08-17 14:59:42 +09:00
co-authored by Claude Opus 5
parent f15557483f
commit 8cce8dc98b
3 changed files with 31 additions and 1 deletions
+17 -1
View File
@@ -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."""