PyBreeze 1.0.4__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.
Files changed (109) hide show
  1. automation_ide/__init__.py +7 -0
  2. automation_ide/__main__.py +0 -0
  3. automation_ide/automation_editor_ui/__init__.py +0 -0
  4. automation_ide/automation_editor_ui/connect_gui/__init__.py +0 -0
  5. automation_ide/automation_editor_ui/connect_gui/ssh/__init__.py +0 -0
  6. automation_ide/automation_editor_ui/connect_gui/ssh/ssh_command_widget.py +246 -0
  7. automation_ide/automation_editor_ui/connect_gui/ssh/ssh_file_viewer_widget.py +501 -0
  8. automation_ide/automation_editor_ui/connect_gui/ssh/ssh_login_widget.py +67 -0
  9. automation_ide/automation_editor_ui/connect_gui/ssh/ssh_main_widget.py +49 -0
  10. automation_ide/automation_editor_ui/connect_gui/url/__init__.py +0 -0
  11. automation_ide/automation_editor_ui/connect_gui/url/ai_code_review_gui.py +177 -0
  12. automation_ide/automation_editor_ui/editor_main/__init__.py +0 -0
  13. automation_ide/automation_editor_ui/editor_main/main_ui.py +104 -0
  14. automation_ide/automation_editor_ui/extend_ai_gui/__init__.py +0 -0
  15. automation_ide/automation_editor_ui/extend_ai_gui/ai_gui_global_variable.py +40 -0
  16. automation_ide/automation_editor_ui/extend_ai_gui/code_review/__init__.py +0 -0
  17. automation_ide/automation_editor_ui/extend_ai_gui/code_review/code_review_thread.py +81 -0
  18. automation_ide/automation_editor_ui/extend_ai_gui/code_review/cot_code_review_gui.py +82 -0
  19. automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/__init__.py +0 -0
  20. automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/cot_code_review_prompt_templates/__init__.py +0 -0
  21. automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/cot_code_review_prompt_templates/code_smell_detector.py +22 -0
  22. automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/cot_code_review_prompt_templates/first_code_review.py +17 -0
  23. automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/cot_code_review_prompt_templates/first_summary_prompt.py +17 -0
  24. automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/cot_code_review_prompt_templates/global_rule.py +59 -0
  25. automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/cot_code_review_prompt_templates/judge.py +91 -0
  26. automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/cot_code_review_prompt_templates/judge_single_review.py +85 -0
  27. automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/cot_code_review_prompt_templates/linter.py +17 -0
  28. automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/cot_code_review_prompt_templates/step_by_step_analysis.py +35 -0
  29. automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/cot_code_review_prompt_templates/total_summary.py +66 -0
  30. automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/cot_prompt_editor_widget.py +136 -0
  31. automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/skills_prompt_editor_widget.py +136 -0
  32. automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/skills_prompt_templates/__init__.py +0 -0
  33. automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/skills_prompt_templates/code_explainer.py +21 -0
  34. automation_ide/automation_editor_ui/extend_ai_gui/prompt_edit_gui/skills_prompt_templates/code_review.py +37 -0
  35. automation_ide/automation_editor_ui/extend_ai_gui/skills/__init__.py +0 -0
  36. automation_ide/automation_editor_ui/extend_ai_gui/skills/skills_send_gui.py +98 -0
  37. automation_ide/automation_editor_ui/extend_multi_language/__init__.py +0 -0
  38. automation_ide/automation_editor_ui/extend_multi_language/extend_english.py +272 -0
  39. automation_ide/automation_editor_ui/extend_multi_language/extend_traditional_chinese.py +272 -0
  40. automation_ide/automation_editor_ui/extend_multi_language/update_language_dict.py +8 -0
  41. automation_ide/automation_editor_ui/menu/__init__.py +0 -0
  42. automation_ide/automation_editor_ui/menu/automation_menu/__init__.py +0 -0
  43. automation_ide/automation_editor_ui/menu/automation_menu/api_testka_menu/__init__.py +0 -0
  44. automation_ide/automation_editor_ui/menu/automation_menu/api_testka_menu/build_api_testka_menu.py +137 -0
  45. automation_ide/automation_editor_ui/menu/automation_menu/auto_control_menu/__init__.py +0 -0
  46. automation_ide/automation_editor_ui/menu/automation_menu/auto_control_menu/build_autocontrol_menu.py +169 -0
  47. automation_ide/automation_editor_ui/menu/automation_menu/automation_file_menu/__init__.py +0 -0
  48. automation_ide/automation_editor_ui/menu/automation_menu/automation_file_menu/build_automation_file_menu.py +122 -0
  49. automation_ide/automation_editor_ui/menu/automation_menu/load_density_menu/__init__.py +0 -0
  50. automation_ide/automation_editor_ui/menu/automation_menu/load_density_menu/build_load_density_menu.py +137 -0
  51. automation_ide/automation_editor_ui/menu/automation_menu/mail_thunder_menu/__init__.py +0 -0
  52. automation_ide/automation_editor_ui/menu/automation_menu/mail_thunder_menu/build_mail_thunder_menu.py +88 -0
  53. automation_ide/automation_editor_ui/menu/automation_menu/test_pioneer_menu/__init__.py +0 -0
  54. automation_ide/automation_editor_ui/menu/automation_menu/test_pioneer_menu/build_test_pioneer_menu.py +62 -0
  55. automation_ide/automation_editor_ui/menu/automation_menu/web_runner_menu/__init__.py +0 -0
  56. automation_ide/automation_editor_ui/menu/automation_menu/web_runner_menu/build_webrunner_menu.py +119 -0
  57. automation_ide/automation_editor_ui/menu/build_menubar.py +47 -0
  58. automation_ide/automation_editor_ui/menu/install_menu/__init__.py +0 -0
  59. automation_ide/automation_editor_ui/menu/install_menu/automation_menu/__init__.py +0 -0
  60. automation_ide/automation_editor_ui/menu/install_menu/automation_menu/build_automation_install_menu.py +82 -0
  61. automation_ide/automation_editor_ui/menu/install_menu/install_utils.py +21 -0
  62. automation_ide/automation_editor_ui/menu/install_menu/tools_menu/__init__.py +0 -0
  63. automation_ide/automation_editor_ui/menu/install_menu/tools_menu/build_tool_install_menu.py +29 -0
  64. automation_ide/automation_editor_ui/menu/menu_utils.py +16 -0
  65. automation_ide/automation_editor_ui/menu/tools/__init__.py +0 -0
  66. automation_ide/automation_editor_ui/menu/tools/tools_menu.py +162 -0
  67. automation_ide/automation_editor_ui/show_code_window/__init__.py +0 -0
  68. automation_ide/automation_editor_ui/show_code_window/code_window.py +21 -0
  69. automation_ide/automation_editor_ui/syntax/__init__.py +0 -0
  70. automation_ide/automation_editor_ui/syntax/syntax_extend.py +40 -0
  71. automation_ide/automation_editor_ui/syntax/syntax_keyword.py +163 -0
  72. automation_ide/extend/__init__.py +0 -0
  73. automation_ide/extend/mail_thunder_extend/__init__.py +0 -0
  74. automation_ide/extend/mail_thunder_extend/mail_thunder_setting.py +36 -0
  75. automation_ide/extend/process_executor/__init__.py +0 -0
  76. automation_ide/extend/process_executor/api_testka/__init__.py +0 -0
  77. automation_ide/extend/process_executor/api_testka/api_testka_process.py +66 -0
  78. automation_ide/extend/process_executor/auto_control/__init__.py +0 -0
  79. automation_ide/extend/process_executor/auto_control/auto_control_process.py +62 -0
  80. automation_ide/extend/process_executor/file_automation/__init__.py +0 -0
  81. automation_ide/extend/process_executor/file_automation/file_automation_process.py +66 -0
  82. automation_ide/extend/process_executor/load_density/__init__.py +0 -0
  83. automation_ide/extend/process_executor/load_density/load_density_process.py +66 -0
  84. automation_ide/extend/process_executor/mail_thunder/__init__.py +0 -0
  85. automation_ide/extend/process_executor/mail_thunder/mail_thunder_process.py +16 -0
  86. automation_ide/extend/process_executor/process_executor_utils.py +72 -0
  87. automation_ide/extend/process_executor/python_task_process_manager.py +177 -0
  88. automation_ide/extend/process_executor/test_pioneer/__init__.py +0 -0
  89. automation_ide/extend/process_executor/test_pioneer/test_pioneer_process_manager.py +181 -0
  90. automation_ide/extend/process_executor/web_runner/__init__.py +0 -0
  91. automation_ide/extend/process_executor/web_runner/web_runner_process.py +66 -0
  92. automation_ide/utils/__init__.py +0 -0
  93. automation_ide/utils/exception/__init__.py +0 -0
  94. automation_ide/utils/exception/exception_tags.py +37 -0
  95. automation_ide/utils/exception/exceptions.py +50 -0
  96. automation_ide/utils/file_process/__init__.py +0 -0
  97. automation_ide/utils/file_process/get_dir_file_list.py +29 -0
  98. automation_ide/utils/json_format/__init__.py +1 -0
  99. automation_ide/utils/json_format/json_process.py +28 -0
  100. automation_ide/utils/logging/__init__.py +0 -0
  101. automation_ide/utils/logging/logger.py +50 -0
  102. automation_ide/utils/manager/__init__.py +0 -0
  103. automation_ide/utils/manager/package_manager/__init__.py +0 -0
  104. automation_ide/utils/manager/package_manager/package_manager_class.py +18 -0
  105. pybreeze-1.0.4.dist-info/METADATA +69 -0
  106. pybreeze-1.0.4.dist-info/RECORD +109 -0
  107. pybreeze-1.0.4.dist-info/WHEEL +5 -0
  108. pybreeze-1.0.4.dist-info/licenses/LICENSE +21 -0
  109. pybreeze-1.0.4.dist-info/top_level.txt +1 -0
@@ -0,0 +1,7 @@
1
+ from automation_ide.automation_editor_ui.editor_main.main_ui import AutomationEditor
2
+ from automation_ide.automation_editor_ui.editor_main.main_ui import EDITOR_EXTEND_TAB
3
+ from automation_ide.automation_editor_ui.editor_main.main_ui import start_editor
4
+
5
+ __all__ = [
6
+ "start_editor", "AutomationEditor", "EDITOR_EXTEND_TAB"
7
+ ]
File without changes
File without changes
@@ -0,0 +1,246 @@
1
+ import os
2
+ import re
3
+
4
+ import paramiko
5
+ from PySide6.QtCore import QThread, Signal
6
+ from PySide6.QtWidgets import (
7
+ QWidget, QLineEdit, QPushButton,
8
+ QPlainTextEdit, QHBoxLayout, QVBoxLayout,
9
+ QMessageBox
10
+ )
11
+ from je_editor import language_wrapper
12
+
13
+ from automation_ide.automation_editor_ui.connect_gui.ssh.ssh_login_widget import LoginWidget
14
+
15
+ ANSI_ESCAPE_PATTERN = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
16
+
17
+
18
+ class SSHReaderThread(QThread):
19
+ data_received = Signal(bytes)
20
+ closed = Signal(str)
21
+
22
+ def __init__(self, chan: paramiko.Channel, parent=None):
23
+ super().__init__(parent)
24
+ self.chan = chan
25
+ self._running = True
26
+ self.word_dict = language_wrapper.language_word_dict
27
+
28
+ def run(self):
29
+ try:
30
+ while self._running:
31
+ if self.chan.recv_ready():
32
+ data = self.chan.recv(4096)
33
+ if data:
34
+ self.data_received.emit(data)
35
+
36
+ if self.chan.recv_stderr_ready():
37
+ err = self.chan.recv_stderr(4096)
38
+ if err:
39
+ self.data_received.emit(err)
40
+
41
+ if self.chan.closed or self.chan.exit_status_ready():
42
+ break
43
+
44
+ self.msleep(10)
45
+ except Exception as e:
46
+ self.closed.emit(
47
+ f"{self.word_dict.get('ssh_command_widget_error_message_reader_failed')} {e}")
48
+ finally:
49
+ self.closed.emit(
50
+ self.word_dict.get("ssh_command_widget_log_message_reader_closed"))
51
+
52
+ def stop(self):
53
+ self._running = False
54
+
55
+
56
+ class SSHCommandWidget(QWidget):
57
+ def __init__(self, external_login_widget: LoginWidget = None, add_login_widget: bool = True):
58
+ super().__init__()
59
+ self.word_dict = language_wrapper.language_word_dict
60
+ self.setWindowTitle(
61
+ self.word_dict.get("ssh_command_widget_window_title_ssh_command_widget"))
62
+
63
+ self.add_login_widget = add_login_widget
64
+
65
+ # SSH 相關物件
66
+ self.ssh_client: paramiko.SSHClient | None = None
67
+ self.shell_channel: paramiko.Channel | None = None
68
+ self.reader_thread: SSHReaderThread | None = None
69
+
70
+ if self.add_login_widget:
71
+ # 使用獨立的登入介面
72
+ self.login_widget = LoginWidget()
73
+ else:
74
+ if external_login_widget is None:
75
+ external_login_widget = LoginWidget()
76
+ self.login_widget = external_login_widget
77
+
78
+ # 其他 UI 控制元件
79
+ self.terminal = QPlainTextEdit()
80
+ self.terminal.setReadOnly(True)
81
+ self.command_input_edit = QLineEdit()
82
+ self.command_send_button = QPushButton(
83
+ self.word_dict.get("ssh_command_widget_button_label_send_command"))
84
+
85
+ self._setup_ui()
86
+ self._bind_events()
87
+
88
+ def _setup_ui(self):
89
+ self.terminal.setReadOnly(True)
90
+ self.terminal.setLineWrapMode(QPlainTextEdit.LineWrapMode.NoWrap)
91
+ self.command_input_edit.setPlaceholderText(
92
+ self.word_dict.get("ssh_command_widget_input_placeholder_command_line")
93
+ )
94
+
95
+ terminal_panel = QVBoxLayout()
96
+ terminal_panel.addWidget(self.terminal)
97
+
98
+ command_input_bar = QHBoxLayout()
99
+ command_input_bar.addWidget(self.command_input_edit)
100
+ command_input_bar.addWidget(self.command_send_button)
101
+
102
+ main_widget = QVBoxLayout()
103
+ main_widget.addWidget(self.login_widget) # 插入登入介面
104
+ main_widget.addLayout(terminal_panel)
105
+ main_widget.addLayout(command_input_bar)
106
+
107
+ self.setLayout(main_widget)
108
+
109
+ def _bind_events(self):
110
+ # 綁定 LoginWidget 的按鈕
111
+ self.login_widget.connect_btn.clicked.connect(self.connect_ssh)
112
+ self.login_widget.disconnect_btn.clicked.connect(self.disconnect_ssh)
113
+
114
+ # 綁定其他按鈕
115
+ self.command_send_button.clicked.connect(self.send_command)
116
+ self.command_input_edit.returnPressed.connect(self.send_command)
117
+
118
+ def append_text(self, text: str):
119
+ self.terminal.appendPlainText(text)
120
+
121
+ def connect_ssh(self):
122
+ host = self.login_widget.host_edit.text().strip()
123
+ port = self.login_widget.port_spin.value()
124
+ user = self.login_widget.user_edit.text().strip()
125
+ use_key = self.login_widget.use_key_check.isChecked()
126
+ key_path = self.login_widget.key_edit.text().strip()
127
+ password = self.login_widget.pass_edit.text()
128
+
129
+ if not host or not user:
130
+ QMessageBox.warning(
131
+ self,
132
+ self.word_dict.get("ssh_command_widget_dialog_title_input_error"),
133
+ self.word_dict.get(
134
+ "ssh_command_widget_dialog_message_input_error_host_user_required"))
135
+ return
136
+
137
+ try:
138
+ self.ssh_client = paramiko.SSHClient()
139
+ self.ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
140
+
141
+ if use_key:
142
+ if not os.path.exists(key_path):
143
+ QMessageBox.warning(
144
+ self,
145
+ self.word_dict.get("ssh_command_widget_dialog_title_key_error"),
146
+ self.word_dict.get("ssh_command_widget_dialog_message_key_file_not_exist"))
147
+ return
148
+ try:
149
+ pkey = None
150
+ for KeyType in (paramiko.RSAKey, paramiko.Ed25519Key, paramiko.ECDSAKey):
151
+ try:
152
+ pkey = KeyType.from_private_key_file(key_path, password if password else None)
153
+ break
154
+ except Exception as error:
155
+ print(error)
156
+ continue
157
+ if pkey is None:
158
+ raise ValueError(
159
+ self.word_dict.get(
160
+ "ssh_command_widget_error_message_unsupported_private_key"
161
+ ))
162
+ self.ssh_client.connect(hostname=host, port=port, username=user, pkey=pkey, timeout=10)
163
+ except Exception as e:
164
+ raise RuntimeError(
165
+ f"{self.word_dict.get('ssh_command_widget_error_message_key_auth_failed')} {e}")
166
+ else:
167
+ self.ssh_client.connect(
168
+ hostname=host, port=port, username=user, password=password, timeout=10
169
+ )
170
+
171
+ self.shell_channel = self.ssh_client.invoke_shell(term='xterm', width=120, height=32)
172
+ self.shell_channel.settimeout(0.0)
173
+ self.reader_thread = SSHReaderThread(self.shell_channel)
174
+ self.reader_thread.data_received.connect(self._on_data)
175
+ self.reader_thread.closed.connect(self._on_closed)
176
+ self.reader_thread.start()
177
+ self.login_widget.status_label.setText(
178
+ self.word_dict.get("ssh_command_widget_dialog_title_not_connected"))
179
+ self.append_text(f"{self.word_dict.get('ssh_command_widget_log_message_connected')}"
180
+ f" {host}:{port} as {user}\n")
181
+ except Exception as e:
182
+ self.login_widget.status_label.setText(
183
+ self.word_dict.get('ssh_command_widget_status_label_disconnected'))
184
+ self.append_text(f"{self.word_dict.get('ssh_command_widget_log_message_error')} {e}\n")
185
+ self._cleanup()
186
+
187
+ def _on_data(self, data: bytes):
188
+ try:
189
+ text = data.decode("utf-8", errors="replace")
190
+ clean_text = ANSI_ESCAPE_PATTERN.sub('', text)
191
+ self.append_text(clean_text)
192
+ except Exception as error:
193
+ self.append_text(f"{self.word_dict.get('ssh_command_widget_error_message_decode_failed')}"
194
+ f" {error}\n")
195
+
196
+ def _on_closed(self, msg: str):
197
+ self.append_text(f"\n{self.word_dict.get('ssh_command_widget_log_message_channel_closed')}"
198
+ f" {msg}\n")
199
+ self.login_widget.status_label.setText(self.word_dict.get(
200
+ 'ssh_command_widget_status_label_disconnected'
201
+ ))
202
+
203
+ def send_command(self):
204
+ cmd = self.command_input_edit.text()
205
+ if not cmd:
206
+ return
207
+ if self.shell_channel and not self.shell_channel.closed:
208
+ try:
209
+ self.shell_channel.send(cmd + "\n")
210
+ self.command_input_edit.clear()
211
+ except Exception as e:
212
+ self.append_text(f"{self.word_dict.get('ssh_command_widget_error_message_send_failed')} {e}\n")
213
+ else:
214
+ QMessageBox.information(
215
+ self,
216
+ self.word_dict.get('ssh_command_widget_dialog_title_not_connected'),
217
+ self.word_dict.get('ssh_command_widget_dialog_message_not_connected_shell'))
218
+
219
+ def disconnect_ssh(self):
220
+ self.append_text(f"{self.word_dict.get('ssh_command_widget_log_message_disconnect_in_progress')} \n")
221
+ self._cleanup()
222
+ self.login_widget.status_label.setText(
223
+ self.word_dict.get('ssh_command_widget_status_label_disconnected'))
224
+
225
+ def _cleanup(self):
226
+ try:
227
+ if self.reader_thread:
228
+ self.reader_thread.stop()
229
+ self.reader_thread.wait(1000)
230
+ except Exception as error:
231
+ print(error)
232
+ self.reader_thread = None
233
+
234
+ try:
235
+ if self.shell_channel and not self.shell_channel.closed:
236
+ self.shell_channel.close()
237
+ except Exception as error:
238
+ print(error)
239
+ self.shell_channel = None
240
+
241
+ try:
242
+ if self.ssh_client:
243
+ self.ssh_client.close()
244
+ except Exception as error:
245
+ print(error)
246
+ self.ssh_client = None