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:
@@ -290,9 +290,9 @@ class AiEditPipeline:
|
||||
self.pending = None
|
||||
self._owner.show_confirm_row(False)
|
||||
if p.get("image_gens"):
|
||||
from PySide6.QtWidgets import QMessageBox
|
||||
if QMessageBox.question(self._owner, tr("folder.ai_image_confirm_title"),
|
||||
tr("folder.ai_image_confirm_gen")) != QMessageBox.Yes:
|
||||
from ...ui.dialog_buttons import confirm
|
||||
if not confirm(self._owner, tr("folder.ai_image_confirm_title"),
|
||||
tr("folder.ai_image_confirm_gen")):
|
||||
self._owner.status_message.emit(tr("folder.ai_image_declined"))
|
||||
return
|
||||
self._generate_then_finalize(p)
|
||||
|
||||
@@ -34,6 +34,9 @@ class FolderTab(QWidget):
|
||||
super().__init__()
|
||||
self.ctx = ctx
|
||||
self._root = str(ctx.config.cowork_output_dir())
|
||||
# Goc ma project dang chon ap xuong, de phan biet "doi project" voi
|
||||
# "chi la refresh" — xem set_project_root().
|
||||
self._project_root = ""
|
||||
|
||||
root_layout = QVBoxLayout(self)
|
||||
split = QSplitter(Qt.Horizontal)
|
||||
@@ -82,6 +85,10 @@ class FolderTab(QWidget):
|
||||
self.terminal.expanded.connect(lambda: self.terminal.set_cwd(self._root))
|
||||
root_layout.addWidget(self.terminal)
|
||||
|
||||
# ``root_changed`` truoc day KHONG co ai lang nghe: nguoi dung tu chon
|
||||
# thu muc trong cay thi chi cai cay doi goc, con khung xem va terminal o
|
||||
# lai thu muc cu.
|
||||
self.tree.root_changed.connect(self._on_user_picked_root)
|
||||
self.tree.file_selected.connect(self.preview.open_file)
|
||||
self.preview.status_message.connect(self.status_message.emit)
|
||||
self.ai_panel.status_message.connect(self.status_message.emit)
|
||||
@@ -105,6 +112,29 @@ class FolderTab(QWidget):
|
||||
self.preview.set_root(path)
|
||||
self.terminal.set_cwd(path)
|
||||
|
||||
def _on_user_picked_root(self, path: str) -> None:
|
||||
"""Người dùng tự chọn thư mục trong cây: lan sang khung xem và terminal."""
|
||||
self._root = path
|
||||
self.preview.set_root(path)
|
||||
self.terminal.set_cwd(path)
|
||||
|
||||
def set_project_root(self, path: str) -> None:
|
||||
"""Áp thư mục gốc theo project đang chọn.
|
||||
|
||||
Bỏ qua nếu project KHÔNG đổi. ``WorkspaceTab.refresh()`` — và qua đó
|
||||
``_load_current`` — chạy lại mỗi lần người dùng vào lại màn Workspace
|
||||
(``_goto`` gọi nó), nên gọi ``set_root`` vô điều kiện sẽ kéo thư mục về
|
||||
workspace của project và xoá mất lựa chọn tay: chọn folder khác, chuyển
|
||||
tab rồi quay lại là mất.
|
||||
|
||||
Đổi sang project khác thì vẫn re-root — thư mục của màn này thuộc về
|
||||
project, chỉ có lần refresh trong CÙNG một project là không được đụng.
|
||||
"""
|
||||
if path == self._project_root:
|
||||
return
|
||||
self._project_root = path
|
||||
self.set_root(path)
|
||||
|
||||
def _toggle_ai_panel(self) -> None:
|
||||
"""Gập/mở panel AI-Edit; mở ra thì báo cho panel biết để nó nạp model lần đầu."""
|
||||
show = self.ai_btn.isChecked()
|
||||
|
||||
@@ -276,10 +276,9 @@ class OfficeDocumentRenderer:
|
||||
from cowork_local.core import pptx_edit
|
||||
o = self._owner
|
||||
if not skip_confirm and pptx_edit.image_change_requested(content):
|
||||
from PySide6.QtWidgets import QMessageBox
|
||||
ok = QMessageBox.question(o, tr("folder.ai_image_confirm_title"),
|
||||
tr("folder.ai_image_confirm"))
|
||||
if ok != QMessageBox.Yes:
|
||||
from cowork_local.ui.dialog_buttons import confirm
|
||||
if not confirm(o, tr("folder.ai_image_confirm_title"),
|
||||
tr("folder.ai_image_confirm")):
|
||||
o.status_message.emit(tr("folder.ai_image_declined"))
|
||||
return False
|
||||
pptx_edit.apply_text_to_pptx(o.current_file, content)
|
||||
|
||||
Reference in New Issue
Block a user