je-editor 0.0.104__py3-none-any.whl → 0.0.228__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- je_editor/__init__.py +26 -21
- je_editor/__main__.py +1 -1
- je_editor/code_scan/ruff_thread.py +58 -0
- je_editor/code_scan/watchdog_implement.py +56 -0
- je_editor/code_scan/watchdog_thread.py +78 -0
- je_editor/git_client/commit_graph.py +77 -0
- je_editor/git_client/git_action.py +175 -0
- je_editor/git_client/git_cli.py +66 -0
- je_editor/pyside_ui/browser/browser_download_window.py +75 -0
- je_editor/pyside_ui/browser/browser_serach_lineedit.py +51 -0
- je_editor/pyside_ui/browser/browser_view.py +87 -0
- je_editor/pyside_ui/browser/browser_widget.py +103 -0
- je_editor/pyside_ui/browser/main_browser_widget.py +85 -0
- je_editor/pyside_ui/code/auto_save/auto_save_manager.py +60 -0
- je_editor/pyside_ui/code/auto_save/auto_save_thread.py +59 -0
- je_editor/pyside_ui/code/code_format/pep8_format.py +130 -0
- je_editor/pyside_ui/code/code_process/code_exec.py +267 -0
- je_editor/pyside_ui/code/plaintext_code_edit/code_edit_plaintext.py +412 -0
- je_editor/pyside_ui/code/running_process_manager.py +48 -0
- je_editor/pyside_ui/code/shell_process/shell_exec.py +236 -0
- je_editor/pyside_ui/code/syntax/python_syntax.py +99 -0
- je_editor/pyside_ui/code/syntax/syntax_setting.py +95 -0
- je_editor/pyside_ui/code/textedit_code_result/code_record.py +75 -0
- je_editor/pyside_ui/code/variable_inspector/inspector_gui.py +172 -0
- je_editor/pyside_ui/dialog/ai_dialog/set_ai_dialog.py +71 -0
- je_editor/pyside_ui/dialog/file_dialog/create_file_dialog.py +68 -0
- je_editor/pyside_ui/dialog/file_dialog/open_file_dialog.py +111 -0
- je_editor/pyside_ui/dialog/file_dialog/save_file_dialog.py +67 -0
- je_editor/pyside_ui/dialog/search_ui/search_error_box.py +49 -0
- je_editor/pyside_ui/dialog/search_ui/search_text_box.py +49 -0
- je_editor/pyside_ui/git_ui/code_diff_compare/code_diff_viewer_widget.py +90 -0
- je_editor/pyside_ui/git_ui/code_diff_compare/line_number_code_viewer.py +141 -0
- je_editor/pyside_ui/git_ui/code_diff_compare/multi_file_diff_viewer.py +88 -0
- je_editor/pyside_ui/git_ui/code_diff_compare/side_by_side_diff_widget.py +284 -0
- je_editor/pyside_ui/git_ui/git_client/commit_table.py +65 -0
- je_editor/pyside_ui/git_ui/git_client/git_branch_tree_widget.py +156 -0
- je_editor/pyside_ui/git_ui/git_client/git_client_gui.py +799 -0
- je_editor/pyside_ui/git_ui/git_client/graph_view.py +218 -0
- je_editor/pyside_ui/main_ui/ai_widget/ai_config.py +34 -0
- je_editor/pyside_ui/main_ui/ai_widget/ask_thread.py +36 -0
- je_editor/pyside_ui/main_ui/ai_widget/chat_ui.py +147 -0
- je_editor/pyside_ui/main_ui/ai_widget/langchain_interface.py +84 -0
- je_editor/pyside_ui/main_ui/console_widget/console_gui.py +162 -0
- je_editor/pyside_ui/main_ui/console_widget/qprocess_adapter.py +84 -0
- je_editor/pyside_ui/main_ui/dock/__init__.py +0 -0
- je_editor/pyside_ui/main_ui/dock/destroy_dock.py +50 -0
- je_editor/pyside_ui/main_ui/editor/__init__.py +0 -0
- je_editor/pyside_ui/main_ui/editor/editor_widget.py +301 -0
- je_editor/pyside_ui/main_ui/editor/editor_widget_dock.py +70 -0
- je_editor/pyside_ui/main_ui/editor/process_input.py +101 -0
- je_editor/pyside_ui/main_ui/ipython_widget/__init__.py +0 -0
- je_editor/pyside_ui/main_ui/ipython_widget/rich_jupyter.py +78 -0
- je_editor/pyside_ui/main_ui/main_editor.py +369 -0
- je_editor/pyside_ui/main_ui/menu/__init__.py +0 -0
- je_editor/pyside_ui/main_ui/menu/check_style_menu/__init__.py +0 -0
- je_editor/pyside_ui/main_ui/menu/check_style_menu/build_check_style_menu.py +104 -0
- je_editor/pyside_ui/main_ui/menu/dock_menu/__init__.py +0 -0
- je_editor/pyside_ui/main_ui/menu/dock_menu/build_dock_menu.py +208 -0
- je_editor/pyside_ui/main_ui/menu/file_menu/__init__.py +0 -0
- je_editor/pyside_ui/main_ui/menu/file_menu/build_file_menu.py +186 -0
- je_editor/pyside_ui/main_ui/menu/help_menu/__init__.py +0 -0
- je_editor/pyside_ui/main_ui/menu/help_menu/build_help_menu.py +100 -0
- je_editor/pyside_ui/main_ui/menu/language_menu/__init__.py +0 -0
- je_editor/pyside_ui/main_ui/menu/language_menu/build_language_server.py +89 -0
- je_editor/pyside_ui/main_ui/menu/python_env_menu/__init__.py +0 -0
- je_editor/pyside_ui/main_ui/menu/python_env_menu/build_venv_menu.py +238 -0
- je_editor/pyside_ui/main_ui/menu/run_menu/__init__.py +0 -0
- je_editor/pyside_ui/main_ui/menu/run_menu/build_run_menu.py +160 -0
- je_editor/pyside_ui/main_ui/menu/run_menu/under_run_menu/__init__.py +0 -0
- je_editor/pyside_ui/main_ui/menu/run_menu/under_run_menu/build_debug_menu.py +109 -0
- je_editor/pyside_ui/main_ui/menu/run_menu/under_run_menu/build_program_menu.py +101 -0
- je_editor/pyside_ui/main_ui/menu/run_menu/under_run_menu/build_shell_menu.py +98 -0
- je_editor/pyside_ui/main_ui/menu/run_menu/under_run_menu/utils.py +41 -0
- je_editor/pyside_ui/main_ui/menu/set_menu_bar.py +63 -0
- je_editor/pyside_ui/main_ui/menu/style_menu/__init__.py +0 -0
- je_editor/pyside_ui/main_ui/menu/style_menu/build_style_menu.py +73 -0
- je_editor/pyside_ui/main_ui/menu/tab_menu/__init__.py +0 -0
- je_editor/pyside_ui/main_ui/menu/tab_menu/build_tab_menu.py +275 -0
- je_editor/pyside_ui/main_ui/menu/text_menu/__init__.py +0 -0
- je_editor/pyside_ui/main_ui/menu/text_menu/build_text_menu.py +135 -0
- je_editor/pyside_ui/main_ui/save_settings/__init__.py +0 -0
- je_editor/pyside_ui/main_ui/save_settings/setting_utils.py +33 -0
- je_editor/pyside_ui/main_ui/save_settings/user_color_setting_file.py +103 -0
- je_editor/pyside_ui/main_ui/save_settings/user_setting_file.py +58 -0
- je_editor/pyside_ui/main_ui/system_tray/__init__.py +0 -0
- je_editor/pyside_ui/main_ui/system_tray/extend_system_tray.py +90 -0
- je_editor/start_editor.py +32 -8
- je_editor/utils/encodings/python_encodings.py +100 -97
- je_editor/utils/exception/exception_tags.py +11 -11
- je_editor/utils/file/open/open_file.py +38 -22
- je_editor/utils/file/save/save_file.py +40 -16
- je_editor/utils/json/json_file.py +36 -15
- je_editor/utils/json_format/json_process.py +38 -2
- je_editor/utils/logging/__init__.py +0 -0
- je_editor/utils/logging/loggin_instance.py +57 -0
- je_editor/utils/multi_language/__init__.py +0 -0
- je_editor/utils/multi_language/english.py +221 -0
- je_editor/utils/multi_language/multi_language_wrapper.py +54 -0
- je_editor/utils/multi_language/traditional_chinese.py +214 -0
- je_editor/utils/redirect_manager/redirect_manager_class.py +67 -25
- je_editor/utils/venv_check/__init__.py +0 -0
- je_editor/utils/venv_check/check_venv.py +51 -0
- je_editor-0.0.228.dist-info/METADATA +99 -0
- je_editor-0.0.228.dist-info/RECORD +140 -0
- {je_editor-0.0.104.dist-info → je_editor-0.0.228.dist-info}/WHEEL +1 -1
- {je_editor-0.0.104.dist-info → je_editor-0.0.228.dist-info/licenses}/LICENSE +1 -1
- je_editor/pyside_ui/auto_save/auto_save_thread.py +0 -34
- je_editor/pyside_ui/code_editor/code_edit_plaintext.py +0 -143
- je_editor/pyside_ui/code_process/code_exec.py +0 -190
- je_editor/pyside_ui/code_result/code_record.py +0 -39
- je_editor/pyside_ui/colors/global_color.py +0 -4
- je_editor/pyside_ui/file_dialog/open_file_dialog.py +0 -27
- je_editor/pyside_ui/file_dialog/save_file_dialog.py +0 -24
- je_editor/pyside_ui/main_ui/editor_main_ui/main_editor.py +0 -183
- je_editor/pyside_ui/main_ui_setting/ui_setting.py +0 -36
- je_editor/pyside_ui/menu/menu_bar/check_style_menu/build_check_style_menu.py +0 -44
- je_editor/pyside_ui/menu/menu_bar/file_menu/build_file_menu.py +0 -30
- je_editor/pyside_ui/menu/menu_bar/help_menu/build_help_menu.py +0 -39
- je_editor/pyside_ui/menu/menu_bar/run_menu/build_run_menu.py +0 -102
- je_editor/pyside_ui/menu/menu_bar/set_menu_bar.py +0 -24
- je_editor/pyside_ui/menu/menu_bar/venv_menu/build_venv_menu.py +0 -74
- je_editor/pyside_ui/search_ui/search_error_box.py +0 -20
- je_editor/pyside_ui/search_ui/search_text_box.py +0 -20
- je_editor/pyside_ui/shell_process/shell_exec.py +0 -157
- je_editor/pyside_ui/syntax/python_syntax.py +0 -99
- je_editor/pyside_ui/treeview/project_treeview/set_project_treeview.py +0 -47
- je_editor/pyside_ui/user_setting/user_setting_file.py +0 -23
- je_editor-0.0.104.dist-info/METADATA +0 -84
- je_editor-0.0.104.dist-info/RECORD +0 -69
- /je_editor/{pyside_ui/auto_save → code_scan}/__init__.py +0 -0
- /je_editor/{pyside_ui/code_editor → git_client}/__init__.py +0 -0
- /je_editor/pyside_ui/{code_process → browser}/__init__.py +0 -0
- /je_editor/pyside_ui/{code_result → code}/__init__.py +0 -0
- /je_editor/pyside_ui/{colors → code/auto_save}/__init__.py +0 -0
- /je_editor/pyside_ui/{file_dialog → code/code_format}/__init__.py +0 -0
- /je_editor/pyside_ui/{main_ui/editor_main_ui → code/code_process}/__init__.py +0 -0
- /je_editor/pyside_ui/{main_ui_setting → code/plaintext_code_edit}/__init__.py +0 -0
- /je_editor/pyside_ui/{menu → code/shell_process}/__init__.py +0 -0
- /je_editor/pyside_ui/{menu/menu_bar → code/syntax}/__init__.py +0 -0
- /je_editor/pyside_ui/{menu/menu_bar/check_style_menu → code/textedit_code_result}/__init__.py +0 -0
- /je_editor/pyside_ui/{menu/menu_bar/file_menu → code/variable_inspector}/__init__.py +0 -0
- /je_editor/pyside_ui/{menu/menu_bar/help_menu → dialog}/__init__.py +0 -0
- /je_editor/pyside_ui/{menu/menu_bar/run_menu → dialog/ai_dialog}/__init__.py +0 -0
- /je_editor/pyside_ui/{menu/menu_bar/venv_menu → dialog/file_dialog}/__init__.py +0 -0
- /je_editor/pyside_ui/{search_ui → dialog/search_ui}/__init__.py +0 -0
- /je_editor/pyside_ui/{shell_process → git_ui}/__init__.py +0 -0
- /je_editor/pyside_ui/{syntax → git_ui/code_diff_compare}/__init__.py +0 -0
- /je_editor/pyside_ui/{treeview → git_ui/git_client}/__init__.py +0 -0
- /je_editor/pyside_ui/{treeview/project_treeview → main_ui/ai_widget}/__init__.py +0 -0
- /je_editor/pyside_ui/{user_setting → main_ui/console_widget}/__init__.py +0 -0
- {je_editor-0.0.104.dist-info → je_editor-0.0.228.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
from PySide6.QtCore import QTimer, QFileSystemWatcher, Qt
|
|
5
|
+
from PySide6.QtGui import QAction
|
|
6
|
+
from PySide6.QtWidgets import (
|
|
7
|
+
QFileDialog, QToolBar, QMessageBox, QStatusBar,
|
|
8
|
+
QSplitter, QWidget, QVBoxLayout
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
from je_editor.git_client.commit_graph import CommitGraph
|
|
12
|
+
from je_editor.git_client.git_cli import GitCLI
|
|
13
|
+
from je_editor.pyside_ui.git_ui.git_client.commit_table import CommitTable
|
|
14
|
+
from je_editor.pyside_ui.git_ui.git_client.graph_view import CommitGraphView
|
|
15
|
+
from je_editor.utils.multi_language.multi_language_wrapper import language_wrapper
|
|
16
|
+
|
|
17
|
+
logging.basicConfig(level=logging.INFO)
|
|
18
|
+
log = logging.getLogger(__name__)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class GitTreeViewGUI(QWidget):
|
|
22
|
+
"""
|
|
23
|
+
GitTreeViewGUI: Git 提交歷史圖形化檢視器
|
|
24
|
+
GitTreeViewGUI: A graphical viewer for Git commit history
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
def __init__(self):
|
|
28
|
+
super().__init__()
|
|
29
|
+
self.language_wrapper_get = language_wrapper.language_word_dict.get
|
|
30
|
+
self.setWindowTitle(self.language_wrapper_get("git_graph_title"))
|
|
31
|
+
|
|
32
|
+
# === 主版面配置 / Main layout ===
|
|
33
|
+
git_treeview_main_layout = QVBoxLayout(self)
|
|
34
|
+
git_treeview_main_layout.setContentsMargins(0, 0, 0, 0)
|
|
35
|
+
git_treeview_main_layout.setSpacing(0)
|
|
36
|
+
|
|
37
|
+
# === 工具列 / Toolbar ===
|
|
38
|
+
git_treeview_toolbar = QToolBar()
|
|
39
|
+
|
|
40
|
+
# 開啟 Git 專案動作 / Action to open Git repo
|
|
41
|
+
open_repo_action = QAction(self.language_wrapper_get("git_graph_toolbar_open"), self)
|
|
42
|
+
open_repo_action.triggered.connect(self.open_repo)
|
|
43
|
+
git_treeview_toolbar.addAction(open_repo_action)
|
|
44
|
+
|
|
45
|
+
# 刷新圖表動作 / Action to refresh graph
|
|
46
|
+
act_refresh = QAction(self.language_wrapper_get("git_graph_toolbar_refresh"), self)
|
|
47
|
+
act_refresh.triggered.connect(self.refresh_graph)
|
|
48
|
+
git_treeview_toolbar.addAction(act_refresh)
|
|
49
|
+
|
|
50
|
+
git_treeview_main_layout.addWidget(git_treeview_toolbar)
|
|
51
|
+
|
|
52
|
+
# === 分割器 (左:圖形檢視 / 右:提交表格) ===
|
|
53
|
+
splitter = QSplitter(Qt.Orientation.Horizontal)
|
|
54
|
+
self.graph_view = CommitGraphView() # 提交圖形檢視器 / commit graph view
|
|
55
|
+
self.commit_table = CommitTable() # 提交表格 / commit table
|
|
56
|
+
splitter.addWidget(self.graph_view)
|
|
57
|
+
splitter.addWidget(self.commit_table)
|
|
58
|
+
splitter.setSizes([600, 400]) # 左右比例 / left-right ratio
|
|
59
|
+
git_treeview_main_layout.addWidget(splitter, 1) # stretch=1 表示可伸縮
|
|
60
|
+
|
|
61
|
+
# === 狀態列 / Status bar ===
|
|
62
|
+
self.status = QStatusBar()
|
|
63
|
+
git_treeview_main_layout.addWidget(self.status)
|
|
64
|
+
|
|
65
|
+
# === Git 相關屬性 ===
|
|
66
|
+
self.repo_path = None
|
|
67
|
+
self.git = None
|
|
68
|
+
|
|
69
|
+
# === 檔案監控器 / File system watcher ===
|
|
70
|
+
self.watcher = QFileSystemWatcher()
|
|
71
|
+
self.watcher.directoryChanged.connect(self._on_git_changed)
|
|
72
|
+
self.watcher.fileChanged.connect(self._on_git_changed)
|
|
73
|
+
|
|
74
|
+
# === 定時器 (延遲刷新) / Timer for delayed refresh ===
|
|
75
|
+
self.refresh_timer = QTimer()
|
|
76
|
+
self.refresh_timer.setSingleShot(True)
|
|
77
|
+
self.refresh_timer.timeout.connect(self.refresh_graph)
|
|
78
|
+
|
|
79
|
+
# === 表格選擇事件 / Table selection event ===
|
|
80
|
+
self.commit_table.selectionModel().selectionChanged.connect(self._on_table_selection)
|
|
81
|
+
|
|
82
|
+
def _on_table_selection(self, selected, _):
|
|
83
|
+
"""
|
|
84
|
+
當使用者在提交表格中選擇某一列時,讓圖形檢視器聚焦到該行
|
|
85
|
+
When user selects a row in commit table, focus graph view on that row
|
|
86
|
+
"""
|
|
87
|
+
if not selected.indexes():
|
|
88
|
+
return
|
|
89
|
+
row = selected.indexes()[0].row()
|
|
90
|
+
self.graph_view.focus_row(row)
|
|
91
|
+
|
|
92
|
+
def open_repo(self):
|
|
93
|
+
"""
|
|
94
|
+
開啟 Git 專案並初始化圖形檢視
|
|
95
|
+
Open a Git repository and set up the graph view
|
|
96
|
+
"""
|
|
97
|
+
path = QFileDialog.getExistingDirectory(self, self.language_wrapper_get("git_graph_menu_open_repo"))
|
|
98
|
+
if not path:
|
|
99
|
+
return
|
|
100
|
+
repo_path = Path(path)
|
|
101
|
+
git = GitCLI(repo_path)
|
|
102
|
+
if not git.is_git_repo():
|
|
103
|
+
# 若不是 Git 專案,顯示警告
|
|
104
|
+
# Show warning if not a Git repo
|
|
105
|
+
QMessageBox.warning(self, self.language_wrapper_get("git_graph_title"),
|
|
106
|
+
self.language_wrapper_get("git_graph_error_not_git"))
|
|
107
|
+
return
|
|
108
|
+
self.repo_path = repo_path
|
|
109
|
+
self.git = git
|
|
110
|
+
self._setup_watcher()
|
|
111
|
+
self.refresh_graph()
|
|
112
|
+
|
|
113
|
+
def _setup_watcher(self):
|
|
114
|
+
"""
|
|
115
|
+
設定檔案監控,監控 .git 目錄與相關檔案
|
|
116
|
+
Setup file watcher to monitor .git directory and related files
|
|
117
|
+
"""
|
|
118
|
+
self.watcher.removePaths(self.watcher.files())
|
|
119
|
+
self.watcher.removePaths(self.watcher.directories())
|
|
120
|
+
if not self.repo_path:
|
|
121
|
+
return
|
|
122
|
+
git_dir = self.repo_path / ".git_client" # ⚠️ 這裡應該是 ".git",可能是自訂路徑
|
|
123
|
+
if git_dir.exists():
|
|
124
|
+
self.watcher.addPath(str(git_dir))
|
|
125
|
+
for f in ["HEAD", "packed-refs"]:
|
|
126
|
+
fp = git_dir / f
|
|
127
|
+
if fp.exists():
|
|
128
|
+
self.watcher.addPath(str(fp))
|
|
129
|
+
refs_dir = git_dir / "refs"
|
|
130
|
+
if refs_dir.exists():
|
|
131
|
+
self.watcher.addPath(str(refs_dir))
|
|
132
|
+
|
|
133
|
+
def _on_git_changed(self):
|
|
134
|
+
"""
|
|
135
|
+
當 Git 目錄變更時,啟動延遲刷新
|
|
136
|
+
When Git directory changes, start delayed refresh
|
|
137
|
+
"""
|
|
138
|
+
self.refresh_timer.start(500)
|
|
139
|
+
|
|
140
|
+
def refresh_graph(self):
|
|
141
|
+
"""
|
|
142
|
+
刷新 Git 提交圖與提交表格
|
|
143
|
+
Refresh Git commit graph and commit table
|
|
144
|
+
"""
|
|
145
|
+
if not self.git:
|
|
146
|
+
return
|
|
147
|
+
try:
|
|
148
|
+
refs = self.git.get_all_refs() # 取得所有 refs
|
|
149
|
+
commits = self.git.get_commits(max_count=500) # 取得最近 500 筆提交
|
|
150
|
+
graph = CommitGraph()
|
|
151
|
+
graph.build(commits, refs) # 建立提交圖
|
|
152
|
+
self.graph_view.set_graph(graph) # 更新圖形檢視
|
|
153
|
+
self.commit_table.set_commits(commits) # 更新提交表格
|
|
154
|
+
except Exception as e:
|
|
155
|
+
QMessageBox.critical(self, self.language_wrapper_get("git_graph_title"),
|
|
156
|
+
f"{self.language_wrapper_get('git_graph_error_exec_failed')}\n{e}")
|