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.
Files changed (151) hide show
  1. je_editor/__init__.py +26 -21
  2. je_editor/__main__.py +1 -1
  3. je_editor/code_scan/ruff_thread.py +58 -0
  4. je_editor/code_scan/watchdog_implement.py +56 -0
  5. je_editor/code_scan/watchdog_thread.py +78 -0
  6. je_editor/git_client/commit_graph.py +77 -0
  7. je_editor/git_client/git_action.py +175 -0
  8. je_editor/git_client/git_cli.py +66 -0
  9. je_editor/pyside_ui/browser/browser_download_window.py +75 -0
  10. je_editor/pyside_ui/browser/browser_serach_lineedit.py +51 -0
  11. je_editor/pyside_ui/browser/browser_view.py +87 -0
  12. je_editor/pyside_ui/browser/browser_widget.py +103 -0
  13. je_editor/pyside_ui/browser/main_browser_widget.py +85 -0
  14. je_editor/pyside_ui/code/auto_save/auto_save_manager.py +60 -0
  15. je_editor/pyside_ui/code/auto_save/auto_save_thread.py +59 -0
  16. je_editor/pyside_ui/code/code_format/pep8_format.py +130 -0
  17. je_editor/pyside_ui/code/code_process/code_exec.py +267 -0
  18. je_editor/pyside_ui/code/plaintext_code_edit/code_edit_plaintext.py +412 -0
  19. je_editor/pyside_ui/code/running_process_manager.py +48 -0
  20. je_editor/pyside_ui/code/shell_process/shell_exec.py +236 -0
  21. je_editor/pyside_ui/code/syntax/python_syntax.py +99 -0
  22. je_editor/pyside_ui/code/syntax/syntax_setting.py +95 -0
  23. je_editor/pyside_ui/code/textedit_code_result/code_record.py +75 -0
  24. je_editor/pyside_ui/code/variable_inspector/inspector_gui.py +172 -0
  25. je_editor/pyside_ui/dialog/ai_dialog/set_ai_dialog.py +71 -0
  26. je_editor/pyside_ui/dialog/file_dialog/create_file_dialog.py +68 -0
  27. je_editor/pyside_ui/dialog/file_dialog/open_file_dialog.py +111 -0
  28. je_editor/pyside_ui/dialog/file_dialog/save_file_dialog.py +67 -0
  29. je_editor/pyside_ui/dialog/search_ui/search_error_box.py +49 -0
  30. je_editor/pyside_ui/dialog/search_ui/search_text_box.py +49 -0
  31. je_editor/pyside_ui/git_ui/code_diff_compare/code_diff_viewer_widget.py +90 -0
  32. je_editor/pyside_ui/git_ui/code_diff_compare/line_number_code_viewer.py +141 -0
  33. je_editor/pyside_ui/git_ui/code_diff_compare/multi_file_diff_viewer.py +88 -0
  34. je_editor/pyside_ui/git_ui/code_diff_compare/side_by_side_diff_widget.py +284 -0
  35. je_editor/pyside_ui/git_ui/git_client/commit_table.py +65 -0
  36. je_editor/pyside_ui/git_ui/git_client/git_branch_tree_widget.py +156 -0
  37. je_editor/pyside_ui/git_ui/git_client/git_client_gui.py +799 -0
  38. je_editor/pyside_ui/git_ui/git_client/graph_view.py +218 -0
  39. je_editor/pyside_ui/main_ui/ai_widget/ai_config.py +34 -0
  40. je_editor/pyside_ui/main_ui/ai_widget/ask_thread.py +36 -0
  41. je_editor/pyside_ui/main_ui/ai_widget/chat_ui.py +147 -0
  42. je_editor/pyside_ui/main_ui/ai_widget/langchain_interface.py +84 -0
  43. je_editor/pyside_ui/main_ui/console_widget/console_gui.py +162 -0
  44. je_editor/pyside_ui/main_ui/console_widget/qprocess_adapter.py +84 -0
  45. je_editor/pyside_ui/main_ui/dock/__init__.py +0 -0
  46. je_editor/pyside_ui/main_ui/dock/destroy_dock.py +50 -0
  47. je_editor/pyside_ui/main_ui/editor/__init__.py +0 -0
  48. je_editor/pyside_ui/main_ui/editor/editor_widget.py +301 -0
  49. je_editor/pyside_ui/main_ui/editor/editor_widget_dock.py +70 -0
  50. je_editor/pyside_ui/main_ui/editor/process_input.py +101 -0
  51. je_editor/pyside_ui/main_ui/ipython_widget/__init__.py +0 -0
  52. je_editor/pyside_ui/main_ui/ipython_widget/rich_jupyter.py +78 -0
  53. je_editor/pyside_ui/main_ui/main_editor.py +369 -0
  54. je_editor/pyside_ui/main_ui/menu/__init__.py +0 -0
  55. je_editor/pyside_ui/main_ui/menu/check_style_menu/__init__.py +0 -0
  56. je_editor/pyside_ui/main_ui/menu/check_style_menu/build_check_style_menu.py +104 -0
  57. je_editor/pyside_ui/main_ui/menu/dock_menu/__init__.py +0 -0
  58. je_editor/pyside_ui/main_ui/menu/dock_menu/build_dock_menu.py +208 -0
  59. je_editor/pyside_ui/main_ui/menu/file_menu/__init__.py +0 -0
  60. je_editor/pyside_ui/main_ui/menu/file_menu/build_file_menu.py +186 -0
  61. je_editor/pyside_ui/main_ui/menu/help_menu/__init__.py +0 -0
  62. je_editor/pyside_ui/main_ui/menu/help_menu/build_help_menu.py +100 -0
  63. je_editor/pyside_ui/main_ui/menu/language_menu/__init__.py +0 -0
  64. je_editor/pyside_ui/main_ui/menu/language_menu/build_language_server.py +89 -0
  65. je_editor/pyside_ui/main_ui/menu/python_env_menu/__init__.py +0 -0
  66. je_editor/pyside_ui/main_ui/menu/python_env_menu/build_venv_menu.py +238 -0
  67. je_editor/pyside_ui/main_ui/menu/run_menu/__init__.py +0 -0
  68. je_editor/pyside_ui/main_ui/menu/run_menu/build_run_menu.py +160 -0
  69. je_editor/pyside_ui/main_ui/menu/run_menu/under_run_menu/__init__.py +0 -0
  70. je_editor/pyside_ui/main_ui/menu/run_menu/under_run_menu/build_debug_menu.py +109 -0
  71. je_editor/pyside_ui/main_ui/menu/run_menu/under_run_menu/build_program_menu.py +101 -0
  72. je_editor/pyside_ui/main_ui/menu/run_menu/under_run_menu/build_shell_menu.py +98 -0
  73. je_editor/pyside_ui/main_ui/menu/run_menu/under_run_menu/utils.py +41 -0
  74. je_editor/pyside_ui/main_ui/menu/set_menu_bar.py +63 -0
  75. je_editor/pyside_ui/main_ui/menu/style_menu/__init__.py +0 -0
  76. je_editor/pyside_ui/main_ui/menu/style_menu/build_style_menu.py +73 -0
  77. je_editor/pyside_ui/main_ui/menu/tab_menu/__init__.py +0 -0
  78. je_editor/pyside_ui/main_ui/menu/tab_menu/build_tab_menu.py +275 -0
  79. je_editor/pyside_ui/main_ui/menu/text_menu/__init__.py +0 -0
  80. je_editor/pyside_ui/main_ui/menu/text_menu/build_text_menu.py +135 -0
  81. je_editor/pyside_ui/main_ui/save_settings/__init__.py +0 -0
  82. je_editor/pyside_ui/main_ui/save_settings/setting_utils.py +33 -0
  83. je_editor/pyside_ui/main_ui/save_settings/user_color_setting_file.py +103 -0
  84. je_editor/pyside_ui/main_ui/save_settings/user_setting_file.py +58 -0
  85. je_editor/pyside_ui/main_ui/system_tray/__init__.py +0 -0
  86. je_editor/pyside_ui/main_ui/system_tray/extend_system_tray.py +90 -0
  87. je_editor/start_editor.py +32 -8
  88. je_editor/utils/encodings/python_encodings.py +100 -97
  89. je_editor/utils/exception/exception_tags.py +11 -11
  90. je_editor/utils/file/open/open_file.py +38 -22
  91. je_editor/utils/file/save/save_file.py +40 -16
  92. je_editor/utils/json/json_file.py +36 -15
  93. je_editor/utils/json_format/json_process.py +38 -2
  94. je_editor/utils/logging/__init__.py +0 -0
  95. je_editor/utils/logging/loggin_instance.py +57 -0
  96. je_editor/utils/multi_language/__init__.py +0 -0
  97. je_editor/utils/multi_language/english.py +221 -0
  98. je_editor/utils/multi_language/multi_language_wrapper.py +54 -0
  99. je_editor/utils/multi_language/traditional_chinese.py +214 -0
  100. je_editor/utils/redirect_manager/redirect_manager_class.py +67 -25
  101. je_editor/utils/venv_check/__init__.py +0 -0
  102. je_editor/utils/venv_check/check_venv.py +51 -0
  103. je_editor-0.0.228.dist-info/METADATA +99 -0
  104. je_editor-0.0.228.dist-info/RECORD +140 -0
  105. {je_editor-0.0.104.dist-info → je_editor-0.0.228.dist-info}/WHEEL +1 -1
  106. {je_editor-0.0.104.dist-info → je_editor-0.0.228.dist-info/licenses}/LICENSE +1 -1
  107. je_editor/pyside_ui/auto_save/auto_save_thread.py +0 -34
  108. je_editor/pyside_ui/code_editor/code_edit_plaintext.py +0 -143
  109. je_editor/pyside_ui/code_process/code_exec.py +0 -190
  110. je_editor/pyside_ui/code_result/code_record.py +0 -39
  111. je_editor/pyside_ui/colors/global_color.py +0 -4
  112. je_editor/pyside_ui/file_dialog/open_file_dialog.py +0 -27
  113. je_editor/pyside_ui/file_dialog/save_file_dialog.py +0 -24
  114. je_editor/pyside_ui/main_ui/editor_main_ui/main_editor.py +0 -183
  115. je_editor/pyside_ui/main_ui_setting/ui_setting.py +0 -36
  116. je_editor/pyside_ui/menu/menu_bar/check_style_menu/build_check_style_menu.py +0 -44
  117. je_editor/pyside_ui/menu/menu_bar/file_menu/build_file_menu.py +0 -30
  118. je_editor/pyside_ui/menu/menu_bar/help_menu/build_help_menu.py +0 -39
  119. je_editor/pyside_ui/menu/menu_bar/run_menu/build_run_menu.py +0 -102
  120. je_editor/pyside_ui/menu/menu_bar/set_menu_bar.py +0 -24
  121. je_editor/pyside_ui/menu/menu_bar/venv_menu/build_venv_menu.py +0 -74
  122. je_editor/pyside_ui/search_ui/search_error_box.py +0 -20
  123. je_editor/pyside_ui/search_ui/search_text_box.py +0 -20
  124. je_editor/pyside_ui/shell_process/shell_exec.py +0 -157
  125. je_editor/pyside_ui/syntax/python_syntax.py +0 -99
  126. je_editor/pyside_ui/treeview/project_treeview/set_project_treeview.py +0 -47
  127. je_editor/pyside_ui/user_setting/user_setting_file.py +0 -23
  128. je_editor-0.0.104.dist-info/METADATA +0 -84
  129. je_editor-0.0.104.dist-info/RECORD +0 -69
  130. /je_editor/{pyside_ui/auto_save → code_scan}/__init__.py +0 -0
  131. /je_editor/{pyside_ui/code_editor → git_client}/__init__.py +0 -0
  132. /je_editor/pyside_ui/{code_process → browser}/__init__.py +0 -0
  133. /je_editor/pyside_ui/{code_result → code}/__init__.py +0 -0
  134. /je_editor/pyside_ui/{colors → code/auto_save}/__init__.py +0 -0
  135. /je_editor/pyside_ui/{file_dialog → code/code_format}/__init__.py +0 -0
  136. /je_editor/pyside_ui/{main_ui/editor_main_ui → code/code_process}/__init__.py +0 -0
  137. /je_editor/pyside_ui/{main_ui_setting → code/plaintext_code_edit}/__init__.py +0 -0
  138. /je_editor/pyside_ui/{menu → code/shell_process}/__init__.py +0 -0
  139. /je_editor/pyside_ui/{menu/menu_bar → code/syntax}/__init__.py +0 -0
  140. /je_editor/pyside_ui/{menu/menu_bar/check_style_menu → code/textedit_code_result}/__init__.py +0 -0
  141. /je_editor/pyside_ui/{menu/menu_bar/file_menu → code/variable_inspector}/__init__.py +0 -0
  142. /je_editor/pyside_ui/{menu/menu_bar/help_menu → dialog}/__init__.py +0 -0
  143. /je_editor/pyside_ui/{menu/menu_bar/run_menu → dialog/ai_dialog}/__init__.py +0 -0
  144. /je_editor/pyside_ui/{menu/menu_bar/venv_menu → dialog/file_dialog}/__init__.py +0 -0
  145. /je_editor/pyside_ui/{search_ui → dialog/search_ui}/__init__.py +0 -0
  146. /je_editor/pyside_ui/{shell_process → git_ui}/__init__.py +0 -0
  147. /je_editor/pyside_ui/{syntax → git_ui/code_diff_compare}/__init__.py +0 -0
  148. /je_editor/pyside_ui/{treeview → git_ui/git_client}/__init__.py +0 -0
  149. /je_editor/pyside_ui/{treeview/project_treeview → main_ui/ai_widget}/__init__.py +0 -0
  150. /je_editor/pyside_ui/{user_setting → main_ui/console_widget}/__init__.py +0 -0
  151. {je_editor-0.0.104.dist-info → je_editor-0.0.228.dist-info}/top_level.txt +0 -0
@@ -1,102 +0,0 @@
1
- from PySide6.QtGui import QAction, QKeySequence, Qt
2
- from PySide6.QtWidgets import QMainWindow, QMessageBox
3
-
4
- from je_editor.pyside_ui.code_process.code_exec import exec_manage
5
- from je_editor.pyside_ui.file_dialog.save_file_dialog import choose_file_get_save_filename
6
- from je_editor.pyside_ui.shell_process.shell_exec import shell_manager
7
-
8
-
9
- def set_run_menu(ui_we_want_to_set: QMainWindow):
10
- ui_we_want_to_set.run_menu.run_program_action = QAction("Run Program")
11
- ui_we_want_to_set.run_menu.run_program_action.triggered.connect(
12
- lambda: run_program(ui_we_want_to_set)
13
- )
14
- ui_we_want_to_set.run_menu.run_program_action.setShortcut(
15
- QKeySequence(Qt.Key.Key_R, Qt.Key.Key_F1)
16
- )
17
- ui_we_want_to_set.run_menu.addAction(ui_we_want_to_set.run_menu.run_program_action)
18
- ui_we_want_to_set.run_menu.run_on_shell_action = QAction("Run On Shell")
19
- ui_we_want_to_set.run_menu.run_on_shell_action.triggered.connect(
20
- lambda: shell_exec(ui_we_want_to_set)
21
- )
22
- ui_we_want_to_set.run_menu.run_on_shell_action.setShortcut(
23
- QKeySequence(Qt.Key.Key_R, Qt.Key.Key_F2)
24
- )
25
- ui_we_want_to_set.run_menu.addAction(ui_we_want_to_set.run_menu.run_on_shell_action)
26
- ui_we_want_to_set.run_menu.clean_result_action = QAction("Clean Result")
27
- ui_we_want_to_set.run_menu.clean_result_action.triggered.connect(
28
- lambda: clean_result(ui_we_want_to_set)
29
- )
30
- ui_we_want_to_set.run_menu.clean_result_action.setShortcut(
31
- QKeySequence(Qt.Key.Key_R, Qt.Key.Key_F3)
32
- )
33
- ui_we_want_to_set.run_menu.addAction(ui_we_want_to_set.run_menu.clean_result_action)
34
-
35
- ui_we_want_to_set.run_menu.stop_program_action = QAction("Stop Program")
36
- ui_we_want_to_set.run_menu.stop_program_action.triggered.connect(
37
- stop_program
38
- )
39
- ui_we_want_to_set.run_menu.stop_program_action.setShortcut(
40
- QKeySequence(Qt.Key.Key_R, Qt.Key.Key_F4)
41
- )
42
- ui_we_want_to_set.run_menu.addAction(ui_we_want_to_set.run_menu.stop_program_action)
43
- # Run help menu
44
- ui_we_want_to_set.run_menu.run_help_menu = ui_we_want_to_set.run_menu.addMenu("Run Help")
45
- # Run help action
46
- ui_we_want_to_set.run_menu.run_help_menu.run_help_action = QAction("Run Help")
47
- ui_we_want_to_set.run_menu.run_help_menu.run_help_action.triggered.connect(
48
- show_run_help
49
- )
50
- ui_we_want_to_set.run_menu.run_help_menu.addAction(ui_we_want_to_set.run_menu.run_help_menu.run_help_action)
51
- # Shell help action
52
- ui_we_want_to_set.run_menu.run_help_menu.shell_help_action = QAction("Shell Help")
53
- ui_we_want_to_set.run_menu.run_help_menu.shell_help_action.triggered.connect(
54
- show_shell_help
55
- )
56
- ui_we_want_to_set.run_menu.run_help_menu.addAction(ui_we_want_to_set.run_menu.run_help_menu.shell_help_action)
57
-
58
-
59
- def run_program(ui_we_want_to_set: QMainWindow):
60
- choose_file_get_save_filename(ui_we_want_to_set)
61
- exec_manage.main_window = ui_we_want_to_set
62
- exec_manage.later_init()
63
- exec_manage.exec_code(
64
- ui_we_want_to_set.current_file
65
- )
66
-
67
-
68
- def shell_exec(ui_we_want_to_set: QMainWindow):
69
- shell_manager.exec_shell(
70
- ui_we_want_to_set.code_edit.toPlainText()
71
- )
72
-
73
-
74
- def stop_program():
75
- exec_manage.exit_program()
76
-
77
-
78
- def clean_result(ui_we_want_to_set: QMainWindow):
79
- ui_we_want_to_set.code_result.setPlainText("")
80
-
81
-
82
- def show_run_help():
83
- message_box = QMessageBox()
84
- message_box.setText(
85
- """
86
- If you are unable to run a Python program, please make sure you are not using the default system Python.
87
- (For Windows, you can use the Windows Store or Venv.)
88
- (For Linux & MacOS, you can use Venv.)
89
- """
90
- )
91
- message_box.exec()
92
-
93
-
94
- def show_shell_help():
95
- message_box = QMessageBox()
96
- message_box.setText(
97
- """
98
- When executing a shell command, if you encounter a decoding error,
99
- please make sure that the current encoding is consistent with the default encoding of the system shell.
100
- """
101
- )
102
- message_box.exec()
@@ -1,24 +0,0 @@
1
- from PySide6.QtWidgets import QMainWindow, QMenuBar
2
-
3
- from je_editor.pyside_ui.menu.menu_bar.check_style_menu.build_check_style_menu import set_check_menu
4
- from je_editor.pyside_ui.menu.menu_bar.file_menu.build_file_menu import set_file_menu
5
- from je_editor.pyside_ui.menu.menu_bar.help_menu.build_help_menu import set_help_menu
6
- from je_editor.pyside_ui.menu.menu_bar.run_menu.build_run_menu import set_run_menu
7
- from je_editor.pyside_ui.menu.menu_bar.venv_menu.build_venv_menu import set_venv_menu
8
-
9
-
10
- def set_menu_bar(ui_we_want_to_set: QMainWindow):
11
- # set menu
12
- ui_we_want_to_set.menu = QMenuBar()
13
- ui_we_want_to_set.file_menu = ui_we_want_to_set.menu.addMenu("File")
14
- ui_we_want_to_set.run_menu = ui_we_want_to_set.menu.addMenu("Run")
15
- ui_we_want_to_set.text_menu = ui_we_want_to_set.menu.addMenu("Text")
16
- ui_we_want_to_set.check_menu = ui_we_want_to_set.menu.addMenu("Check Code Style")
17
- ui_we_want_to_set.help_menu = ui_we_want_to_set.menu.addMenu("Help")
18
- ui_we_want_to_set.venv_menu = ui_we_want_to_set.menu.addMenu("Venv")
19
- ui_we_want_to_set.setMenuBar(ui_we_want_to_set.menu)
20
- set_file_menu(ui_we_want_to_set)
21
- set_run_menu(ui_we_want_to_set)
22
- set_check_menu(ui_we_want_to_set)
23
- set_help_menu(ui_we_want_to_set)
24
- set_venv_menu(ui_we_want_to_set)
@@ -1,74 +0,0 @@
1
- import os
2
- import shutil
3
- import sys
4
- from pathlib import Path
5
-
6
- from PySide6.QtGui import QAction
7
- from PySide6.QtWidgets import QMainWindow, QMessageBox, QInputDialog
8
-
9
- from je_editor.pyside_ui.shell_process.shell_exec import shell_manager
10
-
11
-
12
- def set_venv_menu(ui_we_want_to_set: QMainWindow):
13
- # Create an venv
14
- ui_we_want_to_set.venv_menu.create_venv_action = QAction("Create Venv")
15
- ui_we_want_to_set.venv_menu.create_venv_action.setShortcut(
16
- "Ctrl+v"
17
- )
18
- ui_we_want_to_set.venv_menu.create_venv_action.triggered.connect(
19
- lambda: create_venv(ui_we_want_to_set)
20
- )
21
- ui_we_want_to_set.venv_menu.addAction(ui_we_want_to_set.venv_menu.create_venv_action)
22
- # PIP a package
23
- ui_we_want_to_set.venv_menu.pip_action = QAction("pip package")
24
- ui_we_want_to_set.venv_menu.pip_action.setShortcut(
25
- "Ctrl+p"
26
- )
27
- ui_we_want_to_set.venv_menu.pip_action.triggered.connect(
28
- lambda: pip_install_package(ui_we_want_to_set)
29
- )
30
- ui_we_want_to_set.venv_menu.addAction(ui_we_want_to_set.venv_menu.pip_action)
31
-
32
-
33
- def create_venv(ui_we_want_to_set: QMainWindow):
34
- venv_path = Path(os.getcwd() + "/venv")
35
- if not venv_path.exists():
36
- shell_manager.exec_shell("python -m venv venv")
37
- print("Creating venv please waiting for shell exit code.")
38
- else:
39
- message_box = QMessageBox()
40
- message_box.setText("venv already exists.")
41
- message_box.exec()
42
-
43
-
44
- def pip_install_package(ui_we_want_to_set: QMainWindow):
45
- venv_path = Path(os.getcwd() + "/venv")
46
- if not venv_path.exists():
47
- message_box = QMessageBox()
48
- message_box.setText("Please create venv first.")
49
- message_box.exec()
50
- else:
51
- ask_package_dialog = QInputDialog()
52
- package_text, press_ok = ask_package_dialog.getText(
53
- ui_we_want_to_set, "Install Package", "What Package you want to install"
54
- )
55
- if press_ok:
56
- if sys.platform in ["win32", "cygwin", "msys"]:
57
- venv_path = Path(os.getcwd() + "/venv/Scripts")
58
- else:
59
- venv_path = Path(os.getcwd() + "/venv/bin")
60
- if venv_path.is_dir() and venv_path.exists():
61
- compiler_path = shutil.which(
62
- cmd="python3",
63
- path=str(venv_path)
64
- )
65
- else:
66
- compiler_path = shutil.which(cmd="python3")
67
- if compiler_path is None:
68
- compiler_path = shutil.which(
69
- cmd="python",
70
- path=str(venv_path)
71
- )
72
- else:
73
- compiler_path = shutil.which(cmd="python")
74
- shell_manager.exec_shell(f"{compiler_path} -m pip install {package_text}")
@@ -1,20 +0,0 @@
1
- from PySide6.QtWidgets import QWidget, QLineEdit, QPushButton, QBoxLayout, QHBoxLayout
2
-
3
-
4
- class SearchResultBox(QWidget):
5
-
6
- def __init__(self):
7
- super().__init__()
8
- self.box_layout = QBoxLayout(QBoxLayout.Direction.TopToBottom)
9
- self.search_input = QLineEdit()
10
- self.search_next_button = QPushButton()
11
- self.search_next_button.setText("Search Next")
12
- self.search_back_button = QPushButton()
13
- self.search_back_button.setText("Search Back")
14
- self.box_h_layout = QHBoxLayout()
15
- self.box_h_layout.addWidget(self.search_back_button)
16
- self.box_h_layout.addWidget(self.search_next_button)
17
- self.box_layout.addWidget(self.search_input)
18
- self.box_layout.addLayout(self.box_h_layout)
19
- self.setWindowTitle("Search Result")
20
- self.setLayout(self.box_layout)
@@ -1,20 +0,0 @@
1
- from PySide6.QtWidgets import QWidget, QLineEdit, QPushButton, QBoxLayout, QHBoxLayout
2
-
3
-
4
- class SearchBox(QWidget):
5
-
6
- def __init__(self):
7
- super().__init__()
8
- self.box_layout = QBoxLayout(QBoxLayout.Direction.TopToBottom)
9
- self.search_input = QLineEdit()
10
- self.search_next_button = QPushButton()
11
- self.search_next_button.setText("Search Next")
12
- self.search_back_button = QPushButton()
13
- self.search_back_button.setText("Search Back")
14
- self.box_h_layout = QHBoxLayout()
15
- self.box_h_layout.addWidget(self.search_back_button)
16
- self.box_h_layout.addWidget(self.search_next_button)
17
- self.box_layout.addWidget(self.search_input)
18
- self.box_layout.addLayout(self.box_h_layout)
19
- self.setWindowTitle("Search Text")
20
- self.setLayout(self.box_layout)
@@ -1,157 +0,0 @@
1
- import queue
2
- import shlex
3
- import subprocess
4
- import sys
5
- from threading import Thread
6
-
7
- from PySide6.QtCore import QTimer
8
- from PySide6.QtWidgets import QMainWindow, QTextEdit
9
-
10
- from je_editor.pyside_ui.colors.global_color import error_color, output_color
11
- from je_editor.utils.exception.exception_tags import je_editor_init_error
12
- from je_editor.utils.exception.exceptions import JEditorException
13
-
14
-
15
- class ShellManager(object):
16
-
17
- def __init__(
18
- self,
19
- main_window: QMainWindow = None,
20
- shell_encoding: str = "utf-8",
21
- program_buffer: int = 10240000,
22
- ):
23
- """
24
- :param main_window: tkinter main window
25
- """
26
- self.read_program_error_output_from_thread = None
27
- self.read_program_output_from_thread = None
28
- self.main_window: QMainWindow = main_window
29
- self.code_result: [QTextEdit, None] = None
30
- self.timer: [QTimer, None] = None
31
- self.still_run_shell: bool = True
32
- self.process = None
33
- self.run_output_queue: queue = queue.Queue()
34
- self.run_error_queue: queue = queue.Queue()
35
- self.program_encoding: str = shell_encoding
36
- self.program_buffer: int = program_buffer
37
-
38
- def later_init(self):
39
- if self.main_window is not None:
40
- self.code_result: QTextEdit = self.main_window.code_result
41
- else:
42
- raise JEditorException(je_editor_init_error)
43
-
44
- def exec_shell(self, shell_command: [str, list]):
45
- """
46
- :param shell_command: shell command will run
47
- :return: if error return result and True else return result and False
48
- """
49
- try:
50
- self.exit_program()
51
- self.code_result.setPlainText("")
52
- if sys.platform in ["win32", "cygwin", "msys"]:
53
- args = shell_command
54
- else:
55
- args = shlex.split(shell_command)
56
- self.process = subprocess.Popen(
57
- args,
58
- stdout=subprocess.PIPE,
59
- stderr=subprocess.PIPE,
60
- shell=True,
61
- )
62
- self.still_run_shell = True
63
- # program output message queue thread
64
- self.read_program_output_from_thread = Thread(
65
- target=self.read_program_output_from_process,
66
- daemon=True
67
- )
68
- self.read_program_output_from_thread.start()
69
- # program error message queue thread
70
- self.read_program_error_output_from_thread = Thread(
71
- target=self.read_program_error_output_from_process,
72
- daemon=True
73
- )
74
- self.read_program_error_output_from_thread.start()
75
- # start timer
76
- self.timer = QTimer(self.main_window)
77
- self.timer.setInterval(1)
78
- self.timer.timeout.connect(self.pull_text)
79
- self.timer.start()
80
- except Exception as error:
81
- self.code_result.setTextColor(error_color)
82
- self.code_result.append(str(error))
83
- self.code_result.setTextColor(output_color)
84
-
85
- # tkinter_ui update method
86
- def pull_text(self):
87
- try:
88
- self.code_result.setTextColor(error_color)
89
- if not self.run_error_queue.empty():
90
- error_message = self.run_error_queue.get_nowait()
91
- error_message = str(error_message).strip()
92
- if error_message:
93
- self.code_result.append(error_message)
94
- self.code_result.setTextColor(output_color)
95
- if not self.run_output_queue.empty():
96
- output_message = self.run_output_queue.get_nowait()
97
- output_message = str(output_message).strip()
98
- if output_message:
99
- self.code_result.append(output_message)
100
- except queue.Empty:
101
- pass
102
- if self.process.returncode == 0:
103
- self.timer.stop()
104
- self.exit_program()
105
- elif self.process.returncode is not None:
106
- self.timer.stop()
107
- self.exit_program()
108
- if self.still_run_shell:
109
- # poll return code
110
- self.process.poll()
111
-
112
- # exit program change run flag to false and clean read thread and queue and process
113
- def exit_program(self):
114
- self.still_run_shell = False
115
- if self.read_program_output_from_thread is not None:
116
- self.read_program_output_from_thread = None
117
- if self.read_program_error_output_from_thread is not None:
118
- self.read_program_error_output_from_thread = None
119
- self.print_and_clear_queue()
120
- if self.process is not None:
121
- self.process.terminate()
122
- print(f"Shell command exit with code {self.process.returncode}")
123
- self.process = None
124
-
125
- def print_and_clear_queue(self):
126
- try:
127
- for std_output in iter(self.run_output_queue.get_nowait, None):
128
- std_output = str(std_output).strip()
129
- if std_output:
130
- self.code_result.append(std_output)
131
- self.code_result.setTextColor(error_color)
132
- for std_err in iter(self.run_error_queue.get_nowait, None):
133
- std_err = str(std_err).strip()
134
- if std_err:
135
- self.code_result.append(std_err)
136
- self.code_result.setTextColor(output_color)
137
- except queue.Empty:
138
- pass
139
- self.run_output_queue = queue.Queue()
140
- self.run_error_queue = queue.Queue()
141
-
142
- def read_program_output_from_process(self):
143
- while self.still_run_shell:
144
- program_output_data = self.process.stdout.raw.read(
145
- self.program_buffer) \
146
- .decode(self.program_encoding)
147
- self.run_output_queue.put_nowait(program_output_data)
148
-
149
- def read_program_error_output_from_process(self):
150
- while self.still_run_shell:
151
- program_error_output_data = self.process.stderr.raw.read(
152
- self.program_buffer) \
153
- .decode(self.program_encoding)
154
- self.run_error_queue.put_nowait(program_error_output_data)
155
-
156
-
157
- shell_manager = ShellManager()
@@ -1,99 +0,0 @@
1
- from PySide6.QtCore import QRegularExpression
2
- from PySide6.QtGui import QColor
3
- from PySide6.QtGui import QFont
4
- from PySide6.QtGui import QSyntaxHighlighter
5
- from PySide6.QtGui import QTextCharFormat
6
-
7
- keywords = [
8
- "False", "None", "True", "and", "as", "assert", "async",
9
- "await", "break", "class", "continue", "def", "del",
10
- "elif", "else", "except", "finally", "for", "from",
11
- "global", "if", "import", "in", "is", "lambda", "nonlocal",
12
- "not", "or", "pass", "raise", "return", "try", "while", "with", "yield"
13
- ]
14
-
15
- builtins_keyword = [
16
- "abs", "aiter", "all", "any", "anext", "ascii",
17
- "bin", "bool", "breakpoint", "bytearray", "bytes",
18
- "callable", "chr", "classmethod", "compile", "complex",
19
- "delattr", "dict", "dir", "divmod",
20
- "enumerate", "eval", "exec",
21
- "filter", "float", "format", "frozenset",
22
- "getattr", "globals",
23
- "hasattr", "hash", "help", "hex",
24
- "id", "input", "int", "isinstance", "issubclass", "iter",
25
- "len", "list", "locals",
26
- "map", "max", "memoryview", "min",
27
- "next",
28
- "object", "oct", "open", "ord",
29
- "pow", "print", "property",
30
- "range", "repr", "reversed", "round",
31
- "set", "setattr", "slice", "sorted", "staticmethod",
32
- "str", "sum", "super",
33
- "tuple", "type",
34
- "vars",
35
- "zip",
36
- "__import__"
37
- ]
38
-
39
- string_rule = [
40
- r"'''[^'\\]*(\\.[^'\\]*)*'''", # 3* Singel
41
- r'"""[^"\\]*(\\.[^"\\]*)*"""', # 3* Double
42
- r"'[^'\\]*(\\.[^'\\]*)*'", # Singel
43
- r'"[^"\\]*(\\.[^"\\]*)*"' # Double
44
- ]
45
-
46
- number_rule = [
47
- r"\b[+-]?[0-9]+[lL]?\b",
48
- r"\b[+-]?0[xX][0-9A-Fa-f]+[lL]?\b",
49
- r"\b[+-]?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\b"
50
- ]
51
-
52
-
53
- class PythonHighlighter(QSyntaxHighlighter):
54
- def __init__(self, parent=None):
55
- super().__init__(parent)
56
-
57
- self.highlight_rules = []
58
-
59
- text_char_format = QTextCharFormat()
60
- text_char_format.setForeground(QColor(255, 212, 102))
61
- text_char_format.setFontWeight(QFont.Bold)
62
- for word in keywords:
63
- pattern = QRegularExpression(rf"\b{word}\b")
64
- self.highlight_rules.append((pattern, text_char_format))
65
-
66
- text_char_format = QTextCharFormat()
67
- text_char_format.setForeground(QColor(0, 128, 255))
68
- for rule in number_rule:
69
- pattern = QRegularExpression(rule)
70
- self.highlight_rules.append((pattern, text_char_format))
71
-
72
- text_char_format = QTextCharFormat()
73
- text_char_format.setForeground(QColor(0, 153, 0))
74
- for rule in string_rule:
75
- pattern = QRegularExpression(rule)
76
- self.highlight_rules.append((pattern, text_char_format))
77
-
78
- text_char_format = QTextCharFormat()
79
- text_char_format.setForeground(QColor(0, 255, 255))
80
- for word in builtins_keyword:
81
- pattern = QRegularExpression(rf"\b{word}\b")
82
- self.highlight_rules.append((pattern, text_char_format))
83
-
84
- text_char_format = QTextCharFormat()
85
- text_char_format.setForeground(QColor(255, 255, 255))
86
- pattern = QRegularExpression(r"#[^\n]*")
87
- self.highlight_rules.append((pattern, text_char_format))
88
-
89
- text_char_format = QTextCharFormat()
90
- text_char_format.setForeground(QColor(204, 0, 204))
91
- pattern = QRegularExpression(r"\bself\b")
92
- self.highlight_rules.append((pattern, text_char_format))
93
-
94
- def highlightBlock(self, text):
95
- for pattern, format in self.highlight_rules:
96
- match_iterator = pattern.globalMatch(text)
97
- while match_iterator.hasNext():
98
- match = match_iterator.next()
99
- self.setFormat(match.capturedStart(), match.capturedLength(), format)
@@ -1,47 +0,0 @@
1
- import os
2
- import pathlib
3
-
4
- from PySide6.QtCore import QDir, QFileInfo
5
- from PySide6.QtWidgets import QMainWindow, QFileSystemModel, QTreeView, QScrollArea
6
-
7
- from je_editor.pyside_ui.auto_save.auto_save_thread import SaveThread
8
- from je_editor.utils.file.open.open_file import read_file
9
-
10
-
11
- def set_project_treeview(ui_we_want_to_set: QMainWindow):
12
- ui_we_want_to_set.grid_layout.setColumnStretch(0, 4)
13
- ui_we_want_to_set.project_treeview_model = QFileSystemModel()
14
- ui_we_want_to_set.project_treeview_model.setRootPath(QDir.currentPath())
15
- ui_we_want_to_set.project_treeview = QTreeView()
16
- ui_we_want_to_set.project_treeview.setModel(ui_we_want_to_set.project_treeview_model)
17
- ui_we_want_to_set.project_treeview.setRootIndex(
18
- ui_we_want_to_set.project_treeview_model.index(os.getcwd())
19
- )
20
- ui_we_want_to_set.tree_view_scroll_area = QScrollArea()
21
- ui_we_want_to_set.tree_view_scroll_area.setWidgetResizable(True)
22
- ui_we_want_to_set.tree_view_scroll_area.setViewportMargins(0, 0, 0, 0)
23
- ui_we_want_to_set.tree_view_scroll_area.setWidget(ui_we_want_to_set.project_treeview)
24
- ui_we_want_to_set.grid_layout.addWidget(ui_we_want_to_set.tree_view_scroll_area, 0, 0, 0, 1)
25
- ui_we_want_to_set.project_treeview.clicked.connect(
26
- lambda: treeview_click(ui_we_want_to_set)
27
- )
28
-
29
-
30
- def treeview_click(ui_we_want_to_set):
31
- clicked_item: QFileSystemModel = ui_we_want_to_set.project_treeview.selectedIndexes()[0]
32
- file_info: QFileInfo = ui_we_want_to_set.project_treeview.model().fileInfo(clicked_item)
33
- path = pathlib.Path(file_info.absoluteFilePath())
34
- if path.is_file():
35
- file, file_content = read_file(path)
36
- ui_we_want_to_set.code_edit.setPlainText(
37
- file_content
38
- )
39
- ui_we_want_to_set.current_file = file
40
- if ui_we_want_to_set.auto_save_thread is None:
41
- ui_we_want_to_set.auto_save_thread = SaveThread(
42
- ui_we_want_to_set.current_file,
43
- ui_we_want_to_set.code_edit.toPlainText()
44
- )
45
- ui_we_want_to_set.auto_save_thread.start()
46
- if ui_we_want_to_set.auto_save_thread is not None:
47
- ui_we_want_to_set.auto_save_thread.file = ui_we_want_to_set.current_file
@@ -1,23 +0,0 @@
1
- from os import getcwd
2
- from pathlib import Path
3
-
4
- from je_editor.utils.json.json_file import read_json
5
- from je_editor.utils.json.json_file import write_json
6
-
7
- user_setting_dict = {
8
- "font": "Lato",
9
- "font_size": 12,
10
- "encoding": "utf-8",
11
- "last_file": None,
12
- }
13
-
14
-
15
- def write_user_setting():
16
- user_setting_file = Path(getcwd() + "/user_setting.json")
17
- write_json(str(user_setting_file), user_setting_dict)
18
-
19
-
20
- def read_user_setting():
21
- user_setting_file = Path(getcwd() + "/user_setting.json")
22
- if user_setting_file.exists() and user_setting_file.is_file():
23
- user_setting_dict.update(read_json(str(user_setting_file)))
@@ -1,84 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: je-editor
3
- Version: 0.0.104
4
- Summary: JEditor is basic but powerful editor for python
5
- Author-email: JE-Chen <jechenmailman@gmail.com>
6
- License: MIT
7
- Project-URL: Homepage, https://github.com/JE-Chen/je_editor
8
- Project-URL: Documentation, https://je-editor.readthedocs.io/en/latest/
9
- Project-URL: Code, https://github.com/JE-Chen/je_editor
10
- Classifier: Programming Language :: Python :: 3.8
11
- Classifier: Development Status :: 2 - Pre-Alpha
12
- Classifier: Environment :: Win32 (MS Windows)
13
- Classifier: Environment :: MacOS X
14
- Classifier: Environment :: X11 Applications
15
- Classifier: License :: OSI Approved :: MIT License
16
- Classifier: Operating System :: OS Independent
17
- Requires-Python: >=3.8
18
- Description-Content-Type: text/markdown
19
- License-File: LICENSE
20
- Requires-Dist: PySide6
21
- Requires-Dist: qt-material
22
- Requires-Dist: yapf
23
-
24
- # je_editor
25
-
26
- ---
27
-
28
- [![Downloads](https://static.pepy.tech/badge/je-editor)](https://pepy.tech/project/je-editor)
29
-
30
-
31
- [![Codacy Badge](https://app.codacy.com/project/badge/Grade/825a90622a224207be4abe869775b50a)](https://www.codacy.com/gh/JE-Chen/je_editor/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=JE-Chen/je_editor&amp;utm_campaign=Badge_Grade)
32
-
33
- [![CircleCI](https://dl.circleci.com/status-badge/img/gh/Intergration-Automation-Testing/je_editor/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/Intergration-Automation-Testing/je_editor/tree/main)
34
-
35
- [![JE_Editor GitHub Actions Dev](https://github.com/JE-Chen/je_editor/actions/workflows/je-editor-github-actions_dev.yml/badge.svg?branch=dev)](https://github.com/JE-Chen/je_editor/actions/workflows/je-editor-github-actions_dev.yml)
36
-
37
- [![JE_Editor GitHub Actions Stable](https://github.com/JE-Chen/je_editor/actions/workflows/je-editor-github-actions_stable.yml/badge.svg?branch=main)](https://github.com/JE-Chen/je_editor/actions/workflows/je-editor-github-actions_stable.yml)
38
-
39
- ### Document
40
-
41
- [![Documentation Status](https://readthedocs.org/projects/je-editor/badge/?version=latest)](https://je-editor.readthedocs.io/en/latest/?badge=latest)
42
-
43
- ---
44
-
45
-
46
- ![Editor Picture](image/JEditor.png)
47
- > * Project Kanban https://github.com/orgs/Intergration-Automation-Testing/projects/2
48
- > * JEditor is a simple text editor, but it has all the necessary features.
49
- > * JEditor is one of the components of ITE, but modularization allows it to be used separately.
50
- > * JEditor defaults to using a dark interface as shown below:
51
- >> * JEditor has the following features:
52
- >> * Font change.
53
- >> * Font size change.
54
- >> * Auto-save (after first save or open).
55
- >> * Tree file structure browsing.
56
- >> * Save and open files.
57
- >> * Python formatting check using yapf.
58
- >> * Run python programs.
59
- >> * Run shell commands.
60
-
61
- ---
62
-
63
- ## Requires
64
-
65
- ```
66
- python 3.8 or later
67
- ```
68
-
69
- ## install
70
-
71
- ```commandline
72
- pip install je_editor
73
- ```
74
-
75
- * Test on
76
- * windows 10 ~ 11
77
- * osx 10.5 ~ 11 big sur
78
- * ubuntu 20.0.4
79
- * raspberry pi 3B+
80
-
81
- | All test in test dir
82
-
83
- ### Architecture Diagram
84
- ![Architecture Diagram](architecture_diagram/JEditor_Architecture.drawio.png)