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,221 @@
|
|
|
1
|
+
english_word_dict = {
|
|
2
|
+
# Main
|
|
3
|
+
"application_name": "JEditor",
|
|
4
|
+
# Tab
|
|
5
|
+
"tab_name_editor": "Editor",
|
|
6
|
+
"tab_name_web_browser": "Web Browser",
|
|
7
|
+
"tab_name_frontengine": "FrontEngine",
|
|
8
|
+
# Browser
|
|
9
|
+
"browser_download_detail": "Download Detail",
|
|
10
|
+
"browser_find_text": "Find Text",
|
|
11
|
+
"browser_find_text_input": "Input a text to find",
|
|
12
|
+
"browser_back_button": "Back",
|
|
13
|
+
"browser_forward_button": "Forward",
|
|
14
|
+
"browser_reload_button": "Reload",
|
|
15
|
+
"browser_search_button": "Search",
|
|
16
|
+
# Dialog
|
|
17
|
+
"create_file_dialog_pushbutton": "Create File",
|
|
18
|
+
"input_file_name_dialog_pushbutton": "Please enter right file name",
|
|
19
|
+
"search_next_dialog_pushbutton": "Search next",
|
|
20
|
+
"search_back_dialog_pushbutton": "Search back",
|
|
21
|
+
"search_box_dialog_title": "Search Text",
|
|
22
|
+
"add_ai_model_title": "Please fill in AI model information",
|
|
23
|
+
"add_ai_model_pushbutton": "Add AI Model",
|
|
24
|
+
# Editor
|
|
25
|
+
"editor_code_result": "Code result",
|
|
26
|
+
"editor_format_check": "Format checker",
|
|
27
|
+
# Check Code Style Menu
|
|
28
|
+
"check_code_style_menu_label": "Check Code Style",
|
|
29
|
+
"yapf_reformat_label": "yapf",
|
|
30
|
+
"python_format_checker": "Python format check",
|
|
31
|
+
"reformat_json_label": "Reformat JSON",
|
|
32
|
+
"python_format_checker_only_support_python_message": "Only support python file",
|
|
33
|
+
# Dock Menu
|
|
34
|
+
"dock_menu_label": "Dock",
|
|
35
|
+
"dock_browser_label": "New Dock Browser",
|
|
36
|
+
"dock_stackoverflow_label": "New Dock Stackoverflow",
|
|
37
|
+
"dock_editor_label": "New Dock Editor",
|
|
38
|
+
"dock_frontengine_label": "New Dock FrontEngine",
|
|
39
|
+
"dock_ipython_label": "New Ipython(Jupyter)",
|
|
40
|
+
"dock_editor_title": "Editor",
|
|
41
|
+
"dock_frontengine_title": "FrontEngine",
|
|
42
|
+
"dock_browser_title": "Browser",
|
|
43
|
+
"dock_ipython_title": "IPython",
|
|
44
|
+
# File Menu
|
|
45
|
+
"file_menu_label": "File",
|
|
46
|
+
"file_menu_new_file_label": "New File",
|
|
47
|
+
"file_menu_open_file_label": "Open File",
|
|
48
|
+
"file_menu_open_folder_label": "Open Folder",
|
|
49
|
+
"file_menu_save_file_label": "Save File",
|
|
50
|
+
"file_menu_encoding_label": "Encodings",
|
|
51
|
+
"file_menu_font_label": "Font",
|
|
52
|
+
"file_menu_font_size_label": "Font Size",
|
|
53
|
+
# Help Menu
|
|
54
|
+
"help_menu_label": "Help",
|
|
55
|
+
"help_menu_open_github_label": "GitHub",
|
|
56
|
+
"help_menu_open_doc_label": "Doc",
|
|
57
|
+
"help_menu_open_about_label": "About",
|
|
58
|
+
# Python Env Menu
|
|
59
|
+
"python_env_menu_label": "Python Env",
|
|
60
|
+
"python_env_menu_create_venv_label": "Create venv",
|
|
61
|
+
"python_env_menu_pip_upgrade_label": "pip upgrade package",
|
|
62
|
+
"python_env_menu_pip_label": "pip package",
|
|
63
|
+
"python_env_menu_choose_interpreter_label": "Choose python interpreter",
|
|
64
|
+
"python_env_menu_creating_venv_message": "Creating venv please waiting for shell exit code.",
|
|
65
|
+
"python_env_menu_venv_exists": "venv already exists.",
|
|
66
|
+
"python_env_menu_please_create_venv": "Please create venv first.",
|
|
67
|
+
"python_env_menu_install_package_messagebox_title": "Install Package",
|
|
68
|
+
"python_env_menu_install_package_messagebox_label": "What Package you want to install",
|
|
69
|
+
"python_env_menu_install_or_update_package_messagebox_label": "What Package you want to install or update",
|
|
70
|
+
# Run Menu
|
|
71
|
+
"run_menu_label": "Run",
|
|
72
|
+
"run_menu_run_program_label": "Run Program",
|
|
73
|
+
"run_menu_run_debugger": "Run Debugger",
|
|
74
|
+
"run_menu_run_on_shell_label": "Run On Shell",
|
|
75
|
+
"run_menu_clear_result_label": "Clean Result",
|
|
76
|
+
"run_menu_stop_all_program_label": "Stop All Program",
|
|
77
|
+
"run_menu_stop_program_label": "Stop current program",
|
|
78
|
+
"run_menu_run_help_label": "Run Help",
|
|
79
|
+
"run_menu_shell_help_label": "Shell Help",
|
|
80
|
+
"please_stop_current_running_shell": "Please stop current running shell first.",
|
|
81
|
+
"please_stop_current_running_program": "Please stop current running program first.",
|
|
82
|
+
"run_menu_run_help_tip": """
|
|
83
|
+
If you are unable to run a Python program, please make sure you are have python interpreter,
|
|
84
|
+
And if python conflict please choose another interpreter.
|
|
85
|
+
""",
|
|
86
|
+
"run_menu_shell_run_tip": """
|
|
87
|
+
When executing a shell command, if you encounter a decoding error,
|
|
88
|
+
please make sure that the current encoding is consistent with the default encoding of the system shell.
|
|
89
|
+
""",
|
|
90
|
+
# Debugger and menu
|
|
91
|
+
"editor_debugger_input_title_label": "Debugger",
|
|
92
|
+
"show_debugger_input": "Show debugger input",
|
|
93
|
+
# Shell and menu
|
|
94
|
+
"editor_shell_input_title_label": "Shell",
|
|
95
|
+
"show_shell_input": "Show shell input",
|
|
96
|
+
# Program and menu
|
|
97
|
+
"show_program_input": "Show program input",
|
|
98
|
+
"process_input_send_command": "send command",
|
|
99
|
+
# Style Menu
|
|
100
|
+
"style_menu_label": "UI Style",
|
|
101
|
+
# Tab Menu
|
|
102
|
+
"tab_menu_label": "Tab",
|
|
103
|
+
"tab_menu_add_editor_label": "Add Editor Tab",
|
|
104
|
+
"tab_menu_add_frontengine_label": "Add FrontEngine Tab",
|
|
105
|
+
"tab_menu_add_web_label": "Add Web Browser Tab",
|
|
106
|
+
"tab_menu_add_stackoverflow_label": "Add Stackoverflow Tab",
|
|
107
|
+
"tab_menu_editor_tab_name": "Editor",
|
|
108
|
+
"tab_menu_frontengine_tab_name": "FrontEngine",
|
|
109
|
+
"tab_menu_web_tab_name": "WEB Browser",
|
|
110
|
+
"tab_menu_stackoverflow_tab_name": "Stackoverflow",
|
|
111
|
+
"tab_menu_ipython_tab_name": "IPython(Jupyter)",
|
|
112
|
+
"tab_menu_chat_ui_tab_name": "ChatUI",
|
|
113
|
+
"tab_menu_git_client_tab_name": "Git Client",
|
|
114
|
+
"tab_menu_git_branch_tree_view_tab_name": "Git BranchTreeViewer",
|
|
115
|
+
"tab_menu_variable_inspector_tab_name": "Variable Inspector",
|
|
116
|
+
"tab_menu_console_widget_tab_name": "Console Widget",
|
|
117
|
+
"tab_code_diff_viewer_tab_name": "Code Diff Viewer",
|
|
118
|
+
# Text Menu
|
|
119
|
+
"text_menu_label": "Text",
|
|
120
|
+
"text_menu_label_font": "Font",
|
|
121
|
+
"text_menu_label_font_size": "Font Size",
|
|
122
|
+
# System tray
|
|
123
|
+
"system_tray_hide": "Hide",
|
|
124
|
+
"system_tray_maximized": "Maximized",
|
|
125
|
+
"system_tray_normal": "Normal",
|
|
126
|
+
"system_tray_close": "Close",
|
|
127
|
+
# Language Menu
|
|
128
|
+
"language_menu_label": "Language",
|
|
129
|
+
"language_menu_bar_english": "English",
|
|
130
|
+
"language_menu_bar_traditional_chinese": "Traditional Chinese",
|
|
131
|
+
"language_menu_bar_please_restart_messagebox": "Please restart",
|
|
132
|
+
# Qtconsole
|
|
133
|
+
"please_install_qtcontsole_label": "Please python -m pip install qtconsole first.",
|
|
134
|
+
# Chat UI
|
|
135
|
+
"font_size": "Font Size",
|
|
136
|
+
"set_ai_model_waring_title": "Can not set AI Model",
|
|
137
|
+
"set_ai_model_waring_text": "Please check [ai_base_url, ai_api_key, chat_model]",
|
|
138
|
+
"call_ai_model_error_title": "Can't connect to AI Model",
|
|
139
|
+
"call_ai_model_error_text": "Please check [ai_base_url, ai_api_key, chat_model]",
|
|
140
|
+
"chat_ui_dock_label": "Chat UI",
|
|
141
|
+
"chat_ui_set_ai_button": "Set AI setting",
|
|
142
|
+
"chat_ui_load_ai_button": "Load AI setting",
|
|
143
|
+
"chat_ui_call_ai_model_button": "Send prompt",
|
|
144
|
+
"base_url_label": "AI server URL",
|
|
145
|
+
"api_key_label": "AI server API Key",
|
|
146
|
+
"ai_model_label": "AI Model",
|
|
147
|
+
"load_ai_messagebox_title": "Load complete",
|
|
148
|
+
"load_ai_messagebox_text": "Load complete",
|
|
149
|
+
# gitGUI
|
|
150
|
+
"label_repo_initial": "Repo: -",
|
|
151
|
+
"btn_open_repo": "Open Repo",
|
|
152
|
+
"btn_switch_branch": "Switch",
|
|
153
|
+
"btn_pull": "Pull",
|
|
154
|
+
"btn_push": "Push",
|
|
155
|
+
"btn_clone_remote": "Clone Remote Repo",
|
|
156
|
+
"label_remote": "Remote:",
|
|
157
|
+
"label_branch": "Branch:",
|
|
158
|
+
"placeholder_commit_message": "Commit message...",
|
|
159
|
+
"btn_stage_all": "Stage All",
|
|
160
|
+
"btn_commit": "Commit",
|
|
161
|
+
"label_message": "Message:",
|
|
162
|
+
"dialog_choose_repo": "Choose Git Repo",
|
|
163
|
+
"err_open_repo": "Failed to open repository",
|
|
164
|
+
"default_remote": "origin",
|
|
165
|
+
"err_load_branches": "Failed to load branches",
|
|
166
|
+
"err_load_commits": "Failed to load commits",
|
|
167
|
+
"err_checkout": "Checkout Failure",
|
|
168
|
+
"info_checkout_title": "Checkout",
|
|
169
|
+
"info_checkout_msg": "Already check out to {branch}",
|
|
170
|
+
"err_read_diff": "Failed to read diff",
|
|
171
|
+
"err_stage": "Stage failed",
|
|
172
|
+
"info_stage_title": "Stage",
|
|
173
|
+
"info_stage_msg": "Executed git add -A",
|
|
174
|
+
"err_commit": "Commit failed",
|
|
175
|
+
"info_commit_title": "Commit",
|
|
176
|
+
"info_commit_msg": "Commit created",
|
|
177
|
+
"err_pull": "Pull failed",
|
|
178
|
+
"info_pull_title": "Pull",
|
|
179
|
+
"err_push": "Push failed",
|
|
180
|
+
"info_push_title": "Push",
|
|
181
|
+
"dialog_clone_title": "Clone Remote Repo",
|
|
182
|
+
"dialog_clone_prompt": "Enter Git repository URL:",
|
|
183
|
+
"dialog_select_folder": "Select Local Folder",
|
|
184
|
+
"info_clone_success_title": "Clone Successful",
|
|
185
|
+
"info_clone_success_msg": "Repository cloned to:\\n{repo_path}",
|
|
186
|
+
"err_clone_failed_title": "Clone Failed",
|
|
187
|
+
# Git graph
|
|
188
|
+
"git_graph_title": "Git Branch Viewer",
|
|
189
|
+
"git_graph_menu_file": "File",
|
|
190
|
+
"git_graph_menu_open_repo": "Open Repository...",
|
|
191
|
+
"git_graph_menu_refresh": "Refresh",
|
|
192
|
+
"git_graph_menu_exit": "Exit",
|
|
193
|
+
"git_graph_status_loading": "Loading repository...",
|
|
194
|
+
"git_graph_status_ready": "Ready",
|
|
195
|
+
"git_graph_status_repo_set": "Repository: {path}",
|
|
196
|
+
"git_graph_error_not_git": "Selected path is not a Git repository.",
|
|
197
|
+
"git_graph_error_exec_failed": "Git command failed.",
|
|
198
|
+
"git_graph_tooltip_commit": "Commit: {short}\nAuthor: {author}\nDate: {date}\nMessage: {msg}",
|
|
199
|
+
"git_graph_toolbar_open": "Open",
|
|
200
|
+
"git_graph_toolbar_refresh": "Refresh",
|
|
201
|
+
# Variable inspector
|
|
202
|
+
"variable_inspector_title": "Variable Inspector",
|
|
203
|
+
"variable_inspector_search": "Search Variables:",
|
|
204
|
+
"variable_inspector_var_name": "Variable Name",
|
|
205
|
+
"variable_inspector_var_type": "Type",
|
|
206
|
+
"variable_inspector_var_value": "Value",
|
|
207
|
+
# Dynamic Console
|
|
208
|
+
"dynamic_console_title": "Dynamic Console",
|
|
209
|
+
"dynamic_console_run": "Run",
|
|
210
|
+
"dynamic_console_stop": "Stop",
|
|
211
|
+
"dynamic_console_clear": "Clear",
|
|
212
|
+
"dynamic_console_cwd": "CWD",
|
|
213
|
+
"dynamic_console_shell": "Shell",
|
|
214
|
+
"dynamic_console_prompt": "❯ ",
|
|
215
|
+
"dynamic_console_running": "[running]",
|
|
216
|
+
"dynamic_console_ready": "[ready]",
|
|
217
|
+
"dynamic_console_process_running": "Process is running; stop it first",
|
|
218
|
+
"dynamic_console_done": "[done] exit={code}, status={status}",
|
|
219
|
+
"dynamic_console_system_prefix": "[system] ",
|
|
220
|
+
# Code diff viewer
|
|
221
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
from je_editor.utils.logging.loggin_instance import jeditor_logger
|
|
2
|
+
from je_editor.utils.multi_language.english import english_word_dict
|
|
3
|
+
from je_editor.utils.multi_language.traditional_chinese import traditional_chinese_word_dict
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class LanguageWrapper(object):
|
|
7
|
+
"""
|
|
8
|
+
功能說明 (Function Description):
|
|
9
|
+
- 提供一個語言包裝器,用來管理目前使用的語言與對應的字典。
|
|
10
|
+
- A language wrapper to manage the current language and its corresponding dictionary.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
def __init__(self):
|
|
14
|
+
# 初始化時記錄日誌
|
|
15
|
+
# Log initialization
|
|
16
|
+
jeditor_logger.info("Init LanguageWrapper")
|
|
17
|
+
|
|
18
|
+
# 預設語言為 English
|
|
19
|
+
# Default language is English
|
|
20
|
+
self.language: str = "English"
|
|
21
|
+
|
|
22
|
+
# 可選語言字典對照表
|
|
23
|
+
# Mapping of available languages to their word dictionaries
|
|
24
|
+
self.choose_language_dict = {
|
|
25
|
+
"English": english_word_dict,
|
|
26
|
+
"Traditional_Chinese": traditional_chinese_word_dict
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
# 根據目前語言選擇對應字典
|
|
30
|
+
# Select the dictionary based on current language
|
|
31
|
+
self.language_word_dict: dict = self.choose_language_dict.get(self.language)
|
|
32
|
+
|
|
33
|
+
def reset_language(self, language) -> None:
|
|
34
|
+
"""
|
|
35
|
+
重設語言 (Reset the language)
|
|
36
|
+
:param language: "English" 或 "Traditional_Chinese"
|
|
37
|
+
"""
|
|
38
|
+
jeditor_logger.info(f"LanguageWrapper reset_language language: {language}")
|
|
39
|
+
|
|
40
|
+
# 檢查輸入是否為支援的語言
|
|
41
|
+
# Check if the input language is supported
|
|
42
|
+
if language in [
|
|
43
|
+
"English",
|
|
44
|
+
"Traditional_Chinese"
|
|
45
|
+
]:
|
|
46
|
+
# 更新語言與對應字典
|
|
47
|
+
# Update language and corresponding dictionary
|
|
48
|
+
self.language = language
|
|
49
|
+
self.language_word_dict = self.choose_language_dict.get(self.language)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
# 建立一個全域的 LanguageWrapper 實例
|
|
53
|
+
# Create a global instance of LanguageWrapper
|
|
54
|
+
language_wrapper = LanguageWrapper()
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
traditional_chinese_word_dict = {
|
|
2
|
+
# Main
|
|
3
|
+
"application_name": "JEditor",
|
|
4
|
+
# Tab
|
|
5
|
+
"tab_name_editor": "編輯器",
|
|
6
|
+
"tab_name_web_browser": "網頁瀏覽器",
|
|
7
|
+
"tab_name_frontengine": "前景引擎",
|
|
8
|
+
# Browser
|
|
9
|
+
"browser_download_detail": "下載資訊",
|
|
10
|
+
"browser_find_text": "搜尋文字",
|
|
11
|
+
"browser_find_text_input": "輸入要尋找的文字",
|
|
12
|
+
"browser_back_button": "上一頁",
|
|
13
|
+
"browser_forward_button": "下一頁",
|
|
14
|
+
"browser_reload_button": "重新載入",
|
|
15
|
+
"browser_search_button": "搜尋",
|
|
16
|
+
# Dialog
|
|
17
|
+
"create_file_dialog_pushbutton": "建立檔案",
|
|
18
|
+
"input_file_name_dialog_pushbutton": "請輸入正確格式的檔案名稱",
|
|
19
|
+
"search_next_dialog_pushbutton": "搜尋下一個",
|
|
20
|
+
"search_back_dialog_pushbutton": "搜尋上一個",
|
|
21
|
+
"search_box_dialog_title": "搜尋文字",
|
|
22
|
+
"add_ai_model_title": "請填寫 AI 模型資訊",
|
|
23
|
+
"add_ai_model_pushbutton": "新增 AI 模型",
|
|
24
|
+
# Editor
|
|
25
|
+
"editor_code_result": "程式運行結果",
|
|
26
|
+
"editor_format_check": "程式格式檢查",
|
|
27
|
+
# Check Code Style Menu
|
|
28
|
+
"check_code_style_menu_label": "程式碼格式檢查器",
|
|
29
|
+
"yapf_reformat_label": "yapf",
|
|
30
|
+
"python_format_checker": "Python 格式檢查",
|
|
31
|
+
"python_format_checker_only_support_python_message": "只支援 Python 檔案",
|
|
32
|
+
"reformat_json_label": "重新格式化 JSON",
|
|
33
|
+
# Dock Menu
|
|
34
|
+
"dock_menu_label": "區域",
|
|
35
|
+
"dock_browser_label": "新瀏覽器區域",
|
|
36
|
+
"dock_stackoverflow_label": "新 Stackoverflow 區域",
|
|
37
|
+
"dock_editor_label": "新編輯器區域",
|
|
38
|
+
"dock_frontengine_label": "新前景引擎區域",
|
|
39
|
+
"dock_ipython_label": "New Ipython(Jupyter)",
|
|
40
|
+
"dock_editor_title": "編輯器",
|
|
41
|
+
"dock_frontengine_title": "前景引擎",
|
|
42
|
+
"dock_browser_title": "瀏覽器",
|
|
43
|
+
"dock_ipython_title": "IPython(Jupyter)",
|
|
44
|
+
# File Menu
|
|
45
|
+
"file_menu_label": "檔案",
|
|
46
|
+
"file_menu_new_file_label": "新檔案",
|
|
47
|
+
"file_menu_open_file_label": "開啟檔案",
|
|
48
|
+
"file_menu_open_folder_label": "開啟資料夾",
|
|
49
|
+
"file_menu_save_file_label": "儲存檔案",
|
|
50
|
+
"file_menu_encoding_label": "編碼",
|
|
51
|
+
"file_menu_font_label": "字體",
|
|
52
|
+
"file_menu_font_size_label": "字體大小",
|
|
53
|
+
# Help Menu
|
|
54
|
+
"help_menu_label": "幫助",
|
|
55
|
+
"help_menu_open_github_label": "GitHub",
|
|
56
|
+
"help_menu_open_doc_label": "文件",
|
|
57
|
+
"help_menu_open_about_label": "關於",
|
|
58
|
+
# Python Env Menu
|
|
59
|
+
"python_env_menu_label": "Python 環境",
|
|
60
|
+
"python_env_menu_create_venv_label": "建立 venv 虛擬環境",
|
|
61
|
+
"python_env_menu_pip_upgrade_label": "升級與安裝套件",
|
|
62
|
+
"python_env_menu_pip_label": "安裝套件",
|
|
63
|
+
"python_env_menu_choose_interpreter_label": "選擇 Python 直譯器",
|
|
64
|
+
"python_env_menu_creating_venv_message": "建立虛擬環境中, 請等待 Shell exit code",
|
|
65
|
+
"python_env_menu_venv_exists": "虛擬環境已經存在",
|
|
66
|
+
"python_env_menu_please_create_venv": "請先建立虛擬環境",
|
|
67
|
+
"python_env_menu_install_package_messagebox_title": "安裝套件",
|
|
68
|
+
"python_env_menu_install_package_messagebox_label": "想安裝甚麼套件?",
|
|
69
|
+
"python_env_menu_install_or_update_package_messagebox_label": "想安裝或升級甚麼套件",
|
|
70
|
+
# Run Menu
|
|
71
|
+
"run_menu_label": "運行",
|
|
72
|
+
"run_menu_run_program_label": "運行程式",
|
|
73
|
+
"run_menu_run_debugger": "運行除錯器",
|
|
74
|
+
"run_menu_run_on_shell_label": "在終端運行",
|
|
75
|
+
"run_menu_clear_result_label": "清除結果",
|
|
76
|
+
"run_menu_stop_all_program_label": "關閉所有程式",
|
|
77
|
+
"run_menu_stop_program_label": "關閉當前程式",
|
|
78
|
+
"run_menu_run_help_label": "運行幫助",
|
|
79
|
+
"run_menu_shell_help_label": "終端運行幫助",
|
|
80
|
+
"please_stop_current_running_shell": "請先關閉目前正在運行的終端",
|
|
81
|
+
"please_stop_current_running_program": "請先關閉目前正在運行的程式",
|
|
82
|
+
"run_menu_run_help_tip": "如果不能運行程式, 請檢查是否有 Python 直譯器,如有 Python 衝突請選擇其他直譯器.",
|
|
83
|
+
"run_menu_shell_run_tip": "如果有亂碼等問題請重新選擇編碼至與系統 Shell 編碼相同",
|
|
84
|
+
# Debugger
|
|
85
|
+
"editor_debugger_input_title_label": "除錯器",
|
|
86
|
+
"show_debugger_input": "開啟除錯輸入",
|
|
87
|
+
# Shell and menu
|
|
88
|
+
"editor_shell_input_title_label": "Shell",
|
|
89
|
+
"show_shell_input": "開啟 Shell 輸入",
|
|
90
|
+
# Program and menu
|
|
91
|
+
"show_program_input": "開啟程式輸入",
|
|
92
|
+
"process_input_send_command": "傳送指令",
|
|
93
|
+
# Style Menu
|
|
94
|
+
"style_menu_label": "UI 風格",
|
|
95
|
+
# Tab Menu
|
|
96
|
+
"tab_menu_label": "分頁",
|
|
97
|
+
"tab_menu_add_editor_label": "新增編輯器分頁",
|
|
98
|
+
"tab_menu_add_frontengine_label": "新增前景引擎分頁",
|
|
99
|
+
"tab_menu_add_web_label": "新增瀏覽器分頁",
|
|
100
|
+
"tab_menu_add_stackoverflow_label": "新增 Stackoverflow 分頁",
|
|
101
|
+
"tab_menu_editor_tab_name": "編輯器",
|
|
102
|
+
"tab_menu_frontengine_tab_name": "前景引擎",
|
|
103
|
+
"tab_menu_web_tab_name": "瀏覽器",
|
|
104
|
+
"tab_menu_stackoverflow_tab_name": "Stackoverflow",
|
|
105
|
+
"tab_menu_ipython_tab_name": "IPython(Jupyter)",
|
|
106
|
+
"tab_menu_chat_ui_tab_name": "ChatUI",
|
|
107
|
+
"tab_menu_git_client_tab_name": "Git History",
|
|
108
|
+
"tab_menu_git_branch_tree_view_tab_name": "Git BranchTreeViewer",
|
|
109
|
+
"tab_menu_variable_inspector_tab_name": "Variable Inspector",
|
|
110
|
+
"tab_menu_console_widget_tab_name": "ConsoleWidget",
|
|
111
|
+
"tab_code_diff_viewer_tab_name": "Code Diff Viewer",
|
|
112
|
+
# Text Menu
|
|
113
|
+
"text_menu_label": "文字",
|
|
114
|
+
"text_menu_label_font": "字體",
|
|
115
|
+
"text_menu_label_font_size": "字體大小",
|
|
116
|
+
# System tray
|
|
117
|
+
"system_tray_hide": "隱藏",
|
|
118
|
+
"system_tray_maximized": "最大化",
|
|
119
|
+
"system_tray_normal": "正常顯示",
|
|
120
|
+
"system_tray_close": "關閉",
|
|
121
|
+
# Language Menu
|
|
122
|
+
"language_menu_label": "語言",
|
|
123
|
+
"language_menu_bar_english": "英文",
|
|
124
|
+
"language_menu_bar_traditional_chinese": "繁體中文",
|
|
125
|
+
"language_menu_bar_please_restart_messagebox": "請重啟以應用更改",
|
|
126
|
+
# Qtconsole
|
|
127
|
+
"please_install_qtcontsole_label": "請先 python -m pip install qtconsole",
|
|
128
|
+
# Chat UI
|
|
129
|
+
"font_size": "字體大小",
|
|
130
|
+
"set_ai_model_waring_title": "無法設置 AI Model",
|
|
131
|
+
"set_ai_model_warring_text": "請檢查 [ai_base_url, ai_api_key, chat_model]",
|
|
132
|
+
"call_ai_model_error_title": "無法連線到 AI 模型",
|
|
133
|
+
"call_ai_model_error_text": "請檢查 [ai_base_url, ai_api_key, chat_model]",
|
|
134
|
+
"chat_ui_dock_label": "聊天 UI",
|
|
135
|
+
"chat_ui_set_ai_button": "設定 AI 設定",
|
|
136
|
+
"chat_ui_load_ai_button": "載入 AI 設定",
|
|
137
|
+
"chat_ui_call_ai_model_button": "傳送 prompt",
|
|
138
|
+
"base_url_label": "AI 伺服器 URL",
|
|
139
|
+
"api_key_label": "AI 伺服器 API Key",
|
|
140
|
+
"ai_model_label": "AI Model",
|
|
141
|
+
"load_ai_messagebox_title": "載入成功",
|
|
142
|
+
"load_ai_messagebox_text": "載入成功",
|
|
143
|
+
# gitGUI
|
|
144
|
+
"label_repo_initial": "儲存庫: -",
|
|
145
|
+
"btn_open_repo": "開啟儲存庫",
|
|
146
|
+
"btn_switch_branch": "切換",
|
|
147
|
+
"btn_pull": "拉取",
|
|
148
|
+
"btn_push": "推送",
|
|
149
|
+
"btn_clone_remote": "複製遠端儲存庫",
|
|
150
|
+
"label_remote": "遠端:",
|
|
151
|
+
"label_branch": "分支:",
|
|
152
|
+
"placeholder_commit_message": "提交訊息...",
|
|
153
|
+
"btn_stage_all": "暫存全部",
|
|
154
|
+
"btn_commit": "提交",
|
|
155
|
+
"label_message": "訊息:",
|
|
156
|
+
"dialog_choose_repo": "選擇 Git 儲存庫",
|
|
157
|
+
"err_open_repo": "開啟儲存庫失敗",
|
|
158
|
+
"default_remote": "origin",
|
|
159
|
+
"err_load_branches": "載入分支失敗",
|
|
160
|
+
"err_load_commits": "載入提交記錄失敗",
|
|
161
|
+
"err_checkout": "切換分支失敗",
|
|
162
|
+
"info_checkout_title": "切換分支",
|
|
163
|
+
"info_checkout_msg": "已切換至",
|
|
164
|
+
"err_read_diff": "讀取差異失敗",
|
|
165
|
+
"err_stage": "暫存失敗",
|
|
166
|
+
"info_stage_title": "暫存",
|
|
167
|
+
"info_stage_msg": "已執行 git add -A",
|
|
168
|
+
"err_commit": "提交失敗",
|
|
169
|
+
"info_commit_title": "提交",
|
|
170
|
+
"info_commit_msg": "已建立提交",
|
|
171
|
+
"err_pull": "拉取失敗",
|
|
172
|
+
"info_pull_title": "拉取",
|
|
173
|
+
"err_push": "推送失敗",
|
|
174
|
+
"info_push_title": "推送",
|
|
175
|
+
"dialog_clone_title": "複製遠端儲存庫",
|
|
176
|
+
"dialog_clone_prompt": "輸入 Git 儲存庫 URL:",
|
|
177
|
+
"dialog_select_folder": "選擇本機資料夾",
|
|
178
|
+
"info_clone_success_title": "複製成功",
|
|
179
|
+
"info_clone_success_msg": "儲存庫已複製至:\\n",
|
|
180
|
+
"err_clone_failed_title": "複製失敗",
|
|
181
|
+
# Git 圖形
|
|
182
|
+
"git_graph_title": "Git 分支檢視器",
|
|
183
|
+
"git_graph_menu_file": "檔案",
|
|
184
|
+
"git_graph_menu_open_repo": "開啟儲存庫...",
|
|
185
|
+
"git_graph_menu_refresh": "重新整理",
|
|
186
|
+
"git_graph_menu_exit": "退出",
|
|
187
|
+
"git_graph_status_loading": "正在載入儲存庫...",
|
|
188
|
+
"git_graph_status_ready": "就緒",
|
|
189
|
+
"git_graph_status_repo_set": "儲存庫:{path}",
|
|
190
|
+
"git_graph_error_not_git": "所選路徑不是 Git 儲存庫。",
|
|
191
|
+
"git_graph_error_exec_failed": "Git 指令執行失敗。",
|
|
192
|
+
"git_graph_tooltip_commit": "提交:{short}\n作者:{author}\n日期:{date}\n訊息:{msg}",
|
|
193
|
+
"git_graph_toolbar_open": "開啟",
|
|
194
|
+
"git_graph_toolbar_refresh": "重新整理",
|
|
195
|
+
# Variable inspector
|
|
196
|
+
"variable_inspector_title": "變數查看器",
|
|
197
|
+
"variable_inspector_search": "搜尋變數:",
|
|
198
|
+
"variable_inspector_var_name": "變數名稱",
|
|
199
|
+
"variable_inspector_var_type": "型別",
|
|
200
|
+
"variable_inspector_var_value": "值",
|
|
201
|
+
# Dynamic Console
|
|
202
|
+
"dynamic_console_title": "動態主控台",
|
|
203
|
+
"dynamic_console_run": "執行",
|
|
204
|
+
"dynamic_console_stop": "停止",
|
|
205
|
+
"dynamic_console_clear": "清除",
|
|
206
|
+
"dynamic_console_cwd": "工作目錄",
|
|
207
|
+
"dynamic_console_shell": "Shell",
|
|
208
|
+
"dynamic_console_prompt": "❯ ",
|
|
209
|
+
"dynamic_console_running": "[執行中]",
|
|
210
|
+
"dynamic_console_ready": "[就緒]",
|
|
211
|
+
"dynamic_console_process_running": "程序正在執行;請先停止",
|
|
212
|
+
"dynamic_console_done": "[完成] 退出碼={code}, 狀態={status}",
|
|
213
|
+
"dynamic_console_system_prefix": "[系統] ",
|
|
214
|
+
}
|
|
@@ -2,69 +2,111 @@ import logging
|
|
|
2
2
|
import queue
|
|
3
3
|
import sys
|
|
4
4
|
|
|
5
|
+
from je_editor.utils.logging.loggin_instance import jeditor_logger
|
|
5
6
|
|
|
6
|
-
class RedirectStdOut(logging.Handler):
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
class RedirectStdOut(logging.Handler):
|
|
9
|
+
"""
|
|
10
|
+
功能說明 (Function Description):
|
|
11
|
+
- 將標準輸出 (stdout) 重導向到 queue
|
|
12
|
+
- Redirect standard output (stdout) to a queue
|
|
13
|
+
"""
|
|
9
14
|
|
|
10
15
|
def __init__(self):
|
|
11
16
|
super().__init__()
|
|
12
17
|
|
|
13
|
-
def write(self, content_to_write):
|
|
18
|
+
def write(self, content_to_write) -> None:
|
|
19
|
+
# 將輸出內容放入 RedirectManager 的 stdout queue
|
|
20
|
+
# Put output content into RedirectManager's stdout queue
|
|
14
21
|
redirect_manager_instance.std_out_queue.put(content_to_write)
|
|
15
22
|
|
|
16
23
|
def emit(self, record: logging.LogRecord) -> None:
|
|
24
|
+
# 將 logging 訊息格式化後放入 stdout queue
|
|
25
|
+
# Put formatted logging record into stdout queue
|
|
17
26
|
redirect_manager_instance.std_out_queue.put(self.format(record))
|
|
18
27
|
|
|
19
28
|
|
|
20
29
|
class RedirectStdErr(logging.Handler):
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
"""
|
|
31
|
+
功能說明 (Function Description):
|
|
32
|
+
- 將標準錯誤輸出 (stderr) 重導向到 queue
|
|
33
|
+
- Redirect standard error (stderr) to a queue
|
|
34
|
+
"""
|
|
23
35
|
|
|
24
36
|
def __init__(self):
|
|
25
37
|
super().__init__()
|
|
26
38
|
|
|
27
|
-
def write(self, content_to_write):
|
|
39
|
+
def write(self, content_to_write) -> None:
|
|
40
|
+
# 將錯誤輸出內容放入 RedirectManager 的 stderr queue
|
|
41
|
+
# Put error output content into RedirectManager's stderr queue
|
|
28
42
|
redirect_manager_instance.std_err_queue.put(content_to_write)
|
|
29
43
|
|
|
30
44
|
def emit(self, record: logging.LogRecord) -> None:
|
|
45
|
+
# 將 logging 訊息格式化後放入 stderr queue
|
|
46
|
+
# Put formatted logging record into stderr queue
|
|
31
47
|
redirect_manager_instance.std_err_queue.put(self.format(record))
|
|
32
48
|
|
|
33
49
|
|
|
34
50
|
class RedirectManager(object):
|
|
51
|
+
"""
|
|
52
|
+
功能說明 (Function Description):
|
|
53
|
+
- 管理 stdout 與 stderr 的重導向
|
|
54
|
+
- 提供 set_redirect 與 restore_std 方法
|
|
55
|
+
- Manage redirection of stdout and stderr
|
|
56
|
+
- Provides set_redirect and restore_std methods
|
|
57
|
+
"""
|
|
35
58
|
|
|
36
59
|
def __init__(self):
|
|
37
|
-
|
|
38
|
-
|
|
60
|
+
jeditor_logger.info("Init RedirectManager")
|
|
61
|
+
# 建立 stdout 與 stderr 的 queue
|
|
62
|
+
# Create queues for stdout and stderr
|
|
39
63
|
self.std_err_queue = queue.Queue()
|
|
40
64
|
self.std_out_queue = queue.Queue()
|
|
41
65
|
|
|
42
|
-
|
|
66
|
+
@staticmethod
|
|
67
|
+
def set_redirect() -> None:
|
|
43
68
|
"""
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
:return: None
|
|
69
|
+
啟用重導向
|
|
70
|
+
Redirect stdout and stderr to queues
|
|
47
71
|
"""
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
72
|
+
jeditor_logger.info("RedirectManager set_redirect")
|
|
73
|
+
redirect_out = RedirectStdOut()
|
|
74
|
+
redirect_err = RedirectStdErr()
|
|
75
|
+
|
|
76
|
+
# 將 sys.stdout / sys.stderr 指向自訂 handler
|
|
77
|
+
# Redirect sys.stdout / sys.stderr to custom handlers
|
|
78
|
+
sys.stdout = redirect_out
|
|
79
|
+
sys.stderr = redirect_err
|
|
80
|
+
|
|
81
|
+
# 建立一個 logger 並綁定 stderr handler
|
|
82
|
+
# Create a logger and bind stderr handler
|
|
83
|
+
default_logger = logging.getLogger("JEditor_RedirectManager")
|
|
84
|
+
default_logger.addHandler(redirect_err)
|
|
85
|
+
|
|
86
|
+
# 過濾掉不需要重導向的 logger
|
|
87
|
+
# Skip specific loggers from being redirected
|
|
88
|
+
skip_logger_list = [
|
|
89
|
+
"JEditor", "FrontEngine",
|
|
90
|
+
"AutomationIDE", "TestPioneer",
|
|
91
|
+
"langchain", "langchain_core", "langchain_openai"
|
|
92
|
+
]
|
|
93
|
+
for name in logging.root.manager.loggerDict.keys():
|
|
94
|
+
if name in skip_logger_list:
|
|
95
|
+
continue
|
|
96
|
+
else:
|
|
58
97
|
logging.getLogger(name).addHandler(redirect_err)
|
|
59
98
|
|
|
60
99
|
@staticmethod
|
|
61
|
-
def restore_std():
|
|
100
|
+
def restore_std() -> None:
|
|
62
101
|
"""
|
|
63
|
-
|
|
64
|
-
|
|
102
|
+
重設 stdout 與 stderr
|
|
103
|
+
Restore stdout and stderr to default
|
|
65
104
|
"""
|
|
105
|
+
jeditor_logger.info("RedirectManager restore_std")
|
|
66
106
|
sys.stdout = sys.__stdout__
|
|
67
107
|
sys.stderr = sys.__stderr__
|
|
68
108
|
|
|
69
109
|
|
|
110
|
+
# 建立全域 RedirectManager 實例
|
|
111
|
+
# Create a global instance of RedirectManager
|
|
70
112
|
redirect_manager_instance = RedirectManager()
|
|
File without changes
|