fix các bug theo yêu cầu https://fptsoftware362-my.sharepoint.com/❌/g/personal/nampdt_fpt_com/IQAHBJ4A9xqDTLgvt2bhukJEAdRB5LRz2hbJpTivvIiBSYM?wdExp=TEAMS-TREATMENT&web=1&isSPOFile=1&ovuser=f01e930a-b52e-42b1-b70f-a8882b5d043b%2CAnhTNM1%40fpt.com&clickparams=eyJBcHBOYW1lIjoiVGVhbXMtRGVza3RvcCIsIkFwcFZlcnNpb24iOiI0OS8yNjA4MTMxOTMxNyIsIkhhc0ZlZGVyYXRlZFVzZXIiOmZhbHNlfQ%3D%3D --------- Co-authored-by: Duy Le Huu <duylh19@fpt.com> Reviewed-on: #10 Co-authored-by: Anh Tran Nguyen Minh <anhtnm1@fpt.com>
This commit was merged in pull request #10.
This commit is contained in:
+12
-1
@@ -23,7 +23,7 @@ from PySide6.QtWidgets import (
|
||||
QWidget,
|
||||
)
|
||||
|
||||
from ..i18n import tr
|
||||
from ..i18n import on_language_changed, tr
|
||||
|
||||
|
||||
class RoutingToggle(QWidget):
|
||||
@@ -71,6 +71,11 @@ class RoutingToggle(QWidget):
|
||||
self._label.setObjectName("hint")
|
||||
self._combo = QComboBox()
|
||||
self._combo.setToolTip(tr("routing.toggle_tooltip"))
|
||||
# Mode names differ in length per language ("Thủ công" is wider than
|
||||
# "手動"), and a combo only re-measures itself under this policy — without
|
||||
# it the width stays frozen at the language the widget was built in and
|
||||
# the longer translation is cut off.
|
||||
self._combo.setSizeAdjustPolicy(QComboBox.AdjustToContents)
|
||||
# (data value, i18n key) — data is the persisted mode string. Order is
|
||||
# least-to-most autonomous, with Fallback (R03-T03) last because it is
|
||||
# the "only when something breaks" mode rather than a stronger Auto.
|
||||
@@ -88,6 +93,11 @@ class RoutingToggle(QWidget):
|
||||
self._combo.currentIndexChanged.connect(self._on_changed)
|
||||
lay.addWidget(self._label)
|
||||
lay.addWidget(self._combo)
|
||||
# Registered HERE, not by the four surfaces that embed this widget
|
||||
# (Cowork, Co4E, AI-Edit): every one of them had forgotten to, so the
|
||||
# control stayed frozen in the language it was built in. Owning it here
|
||||
# means no future embedder can forget either.
|
||||
on_language_changed(self.retranslate)
|
||||
|
||||
def current_mode(self) -> str:
|
||||
"""Chế độ định tuyến đang chọn; 'off' nếu chưa đặt."""
|
||||
@@ -149,6 +159,7 @@ class AutoRunToggle(QWidget):
|
||||
self.refresh()
|
||||
self._chk.toggled.connect(self._on_toggled)
|
||||
lay.addWidget(self._chk)
|
||||
on_language_changed(self.retranslate) # same reason as RoutingToggle
|
||||
|
||||
def refresh(self) -> None:
|
||||
"""Đọc lại trạng thái tự chạy của project đang mở lên ô đánh dấu."""
|
||||
|
||||
Reference in New Issue
Block a user