je-editor 0.0.106__py3-none-any.whl → 0.0.108__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- je_editor/__init__.py +3 -1
- je_editor/pyside_ui/code_process/code_exec.py +27 -28
- je_editor/pyside_ui/menu/menu_bar/venv_menu/build_venv_menu.py +6 -34
- je_editor/pyside_ui/shell_process/shell_exec.py +32 -3
- {je_editor-0.0.106.dist-info → je_editor-0.0.108.dist-info}/METADATA +1 -1
- {je_editor-0.0.106.dist-info → je_editor-0.0.108.dist-info}/RECORD +9 -9
- {je_editor-0.0.106.dist-info → je_editor-0.0.108.dist-info}/LICENSE +0 -0
- {je_editor-0.0.106.dist-info → je_editor-0.0.108.dist-info}/WHEEL +0 -0
- {je_editor-0.0.106.dist-info → je_editor-0.0.108.dist-info}/top_level.txt +0 -0
je_editor/__init__.py
CHANGED
@@ -16,7 +16,9 @@ from je_editor.pyside_ui.colors.global_color import error_color
|
|
16
16
|
from je_editor.pyside_ui.colors.global_color import output_color
|
17
17
|
# Exec and shell
|
18
18
|
from je_editor.pyside_ui.code_process.code_exec import exec_manage
|
19
|
+
from je_editor.pyside_ui.code_process.code_exec import ExecManager
|
19
20
|
from je_editor.pyside_ui.shell_process.shell_exec import default_shell_manager
|
21
|
+
from je_editor.pyside_ui.shell_process.shell_exec import ShellManager
|
20
22
|
|
21
23
|
__all__ = [
|
22
24
|
"start_editor", "EditorMain",
|
@@ -25,5 +27,5 @@ __all__ = [
|
|
25
27
|
"JEditorOpenFileException", "JEditorContentFileException",
|
26
28
|
"JEditorCantFindLanguageException", "JEditorJsonException",
|
27
29
|
"error_color", "output_color",
|
28
|
-
"exec_manage", "default_shell_manager"
|
30
|
+
"exec_manage", "default_shell_manager", "ExecManager", "ShellManager"
|
29
31
|
]
|
@@ -11,7 +11,6 @@ from PySide6.QtWidgets import QMainWindow, QTextEdit
|
|
11
11
|
|
12
12
|
from je_editor.pyside_ui.colors.global_color import error_color, output_color
|
13
13
|
from je_editor.utils.exception.exception_tags import compiler_not_found_error, je_editor_init_error
|
14
|
-
from je_editor.utils.exception.exception_tags import file_not_fond_error
|
15
14
|
from je_editor.utils.exception.exceptions import JEditorExecException, JEditorException
|
16
15
|
|
17
16
|
|
@@ -32,6 +31,7 @@ class ExecManager(object):
|
|
32
31
|
self.read_program_error_output_from_thread = None
|
33
32
|
self.read_program_output_from_thread = None
|
34
33
|
self.main_window: QMainWindow = main_window
|
34
|
+
self.compiler_path = None
|
35
35
|
self.code_result: [QTextEdit, None] = None
|
36
36
|
self.timer: [QTimer, None] = None
|
37
37
|
self.still_run_program = True
|
@@ -41,6 +41,30 @@ class ExecManager(object):
|
|
41
41
|
self.program_language = program_language
|
42
42
|
self.program_encoding = program_encoding
|
43
43
|
self.program_buffer = program_buffer
|
44
|
+
self.renew_path()
|
45
|
+
|
46
|
+
def renew_path(self):
|
47
|
+
|
48
|
+
if sys.platform in ["win32", "cygwin", "msys"]:
|
49
|
+
venv_path = Path(os.getcwd() + "/venv/Scripts")
|
50
|
+
else:
|
51
|
+
venv_path = Path(os.getcwd() + "/venv/bin")
|
52
|
+
if venv_path.is_dir() and venv_path.exists():
|
53
|
+
self.compiler_path = shutil.which(
|
54
|
+
cmd="python3",
|
55
|
+
path=str(venv_path)
|
56
|
+
)
|
57
|
+
else:
|
58
|
+
self.compiler_path = shutil.which(cmd="python3")
|
59
|
+
if self.compiler_path is None:
|
60
|
+
self.compiler_path = shutil.which(
|
61
|
+
cmd="python",
|
62
|
+
path=str(venv_path)
|
63
|
+
)
|
64
|
+
else:
|
65
|
+
self.compiler_path = shutil.which(cmd="python")
|
66
|
+
if self.compiler_path is None:
|
67
|
+
raise JEditorExecException(compiler_not_found_error)
|
44
68
|
|
45
69
|
def later_init(self):
|
46
70
|
if self.main_window is not None:
|
@@ -59,34 +83,9 @@ class ExecManager(object):
|
|
59
83
|
self.code_result.setPlainText("")
|
60
84
|
reformat_os_file_path = os.path.abspath(exec_file_name)
|
61
85
|
# detect file is exist
|
62
|
-
try:
|
63
|
-
if not Path(exec_file_name).exists():
|
64
|
-
raise JEditorExecException(file_not_fond_error)
|
65
|
-
except OSError as error:
|
66
|
-
raise JEditorExecException(error)
|
67
|
-
if sys.platform in ["win32", "cygwin", "msys"]:
|
68
|
-
venv_path = Path(os.getcwd() + "/venv/Scripts")
|
69
|
-
else:
|
70
|
-
venv_path = Path(os.getcwd() + "/venv/bin")
|
71
|
-
if venv_path.is_dir() and venv_path.exists():
|
72
|
-
compiler_path = shutil.which(
|
73
|
-
cmd="python3",
|
74
|
-
path=str(venv_path)
|
75
|
-
)
|
76
|
-
else:
|
77
|
-
compiler_path = shutil.which(cmd="python3")
|
78
|
-
if compiler_path is None:
|
79
|
-
compiler_path = shutil.which(
|
80
|
-
cmd="python",
|
81
|
-
path=str(venv_path)
|
82
|
-
)
|
83
|
-
else:
|
84
|
-
compiler_path = shutil.which(cmd="python")
|
85
|
-
if compiler_path is None:
|
86
|
-
raise JEditorExecException(compiler_not_found_error)
|
87
86
|
exec_file = reformat_os_file_path
|
88
87
|
# run program
|
89
|
-
execute_program_list = [compiler_path, exec_file]
|
88
|
+
execute_program_list = [self.compiler_path, exec_file]
|
90
89
|
self.process = subprocess.Popen(
|
91
90
|
execute_program_list,
|
92
91
|
stdout=subprocess.PIPE,
|
@@ -107,7 +106,7 @@ class ExecManager(object):
|
|
107
106
|
)
|
108
107
|
self.read_program_error_output_from_thread.start()
|
109
108
|
# show which file execute
|
110
|
-
self.code_result.append(compiler_path + " " + reformat_os_file_path)
|
109
|
+
self.code_result.append(self.compiler_path + " " + reformat_os_file_path)
|
111
110
|
# start tkinter_ui update
|
112
111
|
# start timer
|
113
112
|
self.timer = QTimer(self.main_window)
|
@@ -1,6 +1,4 @@
|
|
1
1
|
import os
|
2
|
-
import shutil
|
3
|
-
import sys
|
4
2
|
from pathlib import Path
|
5
3
|
|
6
4
|
from PySide6.QtGui import QAction
|
@@ -10,12 +8,6 @@ from je_editor.pyside_ui.shell_process.shell_exec import ShellManager
|
|
10
8
|
|
11
9
|
|
12
10
|
def set_venv_menu(ui_we_want_to_set: QMainWindow):
|
13
|
-
# Install virtualenv
|
14
|
-
ui_we_want_to_set.venv_menu.install_virtualenv_action = QAction("Install virtualenv")
|
15
|
-
ui_we_want_to_set.venv_menu.install_virtualenv_action.triggered.connect(
|
16
|
-
lambda: install_virtualenv(ui_we_want_to_set)
|
17
|
-
)
|
18
|
-
ui_we_want_to_set.venv_menu.addAction(ui_we_want_to_set.venv_menu.install_virtualenv_action)
|
19
11
|
# Create an venv
|
20
12
|
ui_we_want_to_set.venv_menu.create_venv_action = QAction("Create Venv")
|
21
13
|
ui_we_want_to_set.venv_menu.create_venv_action.setShortcut(
|
@@ -36,18 +28,14 @@ def set_venv_menu(ui_we_want_to_set: QMainWindow):
|
|
36
28
|
ui_we_want_to_set.venv_menu.addAction(ui_we_want_to_set.venv_menu.pip_action)
|
37
29
|
|
38
30
|
|
39
|
-
def install_virtualenv(ui_we_want_to_set: QMainWindow):
|
40
|
-
install_virtualenv_shell = ShellManager(main_window=ui_we_want_to_set)
|
41
|
-
install_virtualenv_shell.later_init()
|
42
|
-
install_virtualenv_shell.exec_shell("python -m pip install virtualenv")
|
43
|
-
|
44
|
-
|
45
31
|
def create_venv(ui_we_want_to_set: QMainWindow):
|
46
32
|
venv_path = Path(os.getcwd() + "/venv")
|
47
33
|
if not venv_path.exists():
|
48
34
|
create_venv_shell = ShellManager(main_window=ui_we_want_to_set)
|
49
35
|
create_venv_shell.later_init()
|
50
|
-
create_venv_shell.exec_shell(
|
36
|
+
create_venv_shell.exec_shell(
|
37
|
+
[f"{create_venv_shell.compiler_path}", "-m", "venv", "venv"]
|
38
|
+
)
|
51
39
|
print("Creating venv please waiting for shell exit code.")
|
52
40
|
else:
|
53
41
|
message_box = QMessageBox()
|
@@ -67,24 +55,8 @@ def pip_install_package(ui_we_want_to_set: QMainWindow):
|
|
67
55
|
ui_we_want_to_set, "Install Package", "What Package you want to install"
|
68
56
|
)
|
69
57
|
if press_ok:
|
70
|
-
if sys.platform in ["win32", "cygwin", "msys"]:
|
71
|
-
venv_path = Path(os.getcwd() + "/venv/Scripts")
|
72
|
-
else:
|
73
|
-
venv_path = Path(os.getcwd() + "/venv/bin")
|
74
|
-
if venv_path.is_dir() and venv_path.exists():
|
75
|
-
compiler_path = shutil.which(
|
76
|
-
cmd="python3",
|
77
|
-
path=str(venv_path)
|
78
|
-
)
|
79
|
-
else:
|
80
|
-
compiler_path = shutil.which(cmd="python3")
|
81
|
-
if compiler_path is None:
|
82
|
-
compiler_path = shutil.which(
|
83
|
-
cmd="python",
|
84
|
-
path=str(venv_path)
|
85
|
-
)
|
86
|
-
else:
|
87
|
-
compiler_path = shutil.which(cmd="python")
|
88
58
|
pip_install_shell = ShellManager(main_window=ui_we_want_to_set)
|
89
59
|
pip_install_shell.later_init()
|
90
|
-
pip_install_shell.exec_shell(
|
60
|
+
pip_install_shell.exec_shell(
|
61
|
+
[f"{pip_install_shell.compiler_path}", "-m", "pip", "install", f"{package_text}"]
|
62
|
+
)
|
@@ -1,15 +1,18 @@
|
|
1
|
+
import os
|
1
2
|
import queue
|
2
3
|
import shlex
|
4
|
+
import shutil
|
3
5
|
import subprocess
|
4
6
|
import sys
|
7
|
+
from pathlib import Path
|
5
8
|
from threading import Thread
|
6
9
|
|
7
10
|
from PySide6.QtCore import QTimer
|
8
11
|
from PySide6.QtWidgets import QMainWindow, QTextEdit
|
9
12
|
|
10
13
|
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
|
14
|
+
from je_editor.utils.exception.exception_tags import je_editor_init_error, compiler_not_found_error
|
15
|
+
from je_editor.utils.exception.exceptions import JEditorException, JEditorExecException
|
13
16
|
|
14
17
|
|
15
18
|
class ShellManager(object):
|
@@ -26,6 +29,7 @@ class ShellManager(object):
|
|
26
29
|
self.read_program_error_output_from_thread = None
|
27
30
|
self.read_program_output_from_thread = None
|
28
31
|
self.main_window: QMainWindow = main_window
|
32
|
+
self.compiler_path = None
|
29
33
|
self.code_result: [QTextEdit, None] = None
|
30
34
|
self.timer: [QTimer, None] = None
|
31
35
|
self.still_run_shell: bool = True
|
@@ -34,6 +38,30 @@ class ShellManager(object):
|
|
34
38
|
self.run_error_queue: queue = queue.Queue()
|
35
39
|
self.program_encoding: str = shell_encoding
|
36
40
|
self.program_buffer: int = program_buffer
|
41
|
+
self.renew_path()
|
42
|
+
|
43
|
+
def renew_path(self):
|
44
|
+
|
45
|
+
if sys.platform in ["win32", "cygwin", "msys"]:
|
46
|
+
venv_path = Path(os.getcwd() + "/venv/Scripts")
|
47
|
+
else:
|
48
|
+
venv_path = Path(os.getcwd() + "/venv/bin")
|
49
|
+
if venv_path.is_dir() and venv_path.exists():
|
50
|
+
self.compiler_path = shutil.which(
|
51
|
+
cmd="python3",
|
52
|
+
path=str(venv_path)
|
53
|
+
)
|
54
|
+
else:
|
55
|
+
self.compiler_path = shutil.which(cmd="python3")
|
56
|
+
if self.compiler_path is None:
|
57
|
+
self.compiler_path = shutil.which(
|
58
|
+
cmd="python",
|
59
|
+
path=str(venv_path)
|
60
|
+
)
|
61
|
+
else:
|
62
|
+
self.compiler_path = shutil.which(cmd="python")
|
63
|
+
if self.compiler_path is None:
|
64
|
+
raise JEditorExecException(compiler_not_found_error)
|
37
65
|
|
38
66
|
def later_init(self):
|
39
67
|
if self.main_window is not None:
|
@@ -53,8 +81,9 @@ class ShellManager(object):
|
|
53
81
|
args = shell_command
|
54
82
|
else:
|
55
83
|
args = shlex.split(shell_command)
|
84
|
+
print(args)
|
56
85
|
self.process = subprocess.Popen(
|
57
|
-
args,
|
86
|
+
args=args,
|
58
87
|
stdout=subprocess.PIPE,
|
59
88
|
stderr=subprocess.PIPE,
|
60
89
|
shell=True,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
je_editor/__init__.py,sha256=
|
1
|
+
je_editor/__init__.py,sha256=2ehQGiIIhGESrwbqrmyp57thrJxWarRbOTHpHTzYOks,1615
|
2
2
|
je_editor/__main__.py,sha256=tv19PbVG_8bg4HhRWINNYL_Zu6VtkJR00U_0v56GsK8,598
|
3
3
|
je_editor/start_editor.py,sha256=8DqldiwcDCtG7Mu_d4NN8--xhJQZCnkU1aBMRYPRLA4,505
|
4
4
|
je_editor/pyside_ui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -7,7 +7,7 @@ je_editor/pyside_ui/auto_save/auto_save_thread.py,sha256=IE2Uqf1lRewHeQX4iFmws_m
|
|
7
7
|
je_editor/pyside_ui/code_editor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
8
|
je_editor/pyside_ui/code_editor/code_edit_plaintext.py,sha256=DolSFn8LoP0Bvj7v6vh1RHajjmFF9VEeMGLBKNLq4d8,5355
|
9
9
|
je_editor/pyside_ui/code_process/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
-
je_editor/pyside_ui/code_process/code_exec.py,sha256=
|
10
|
+
je_editor/pyside_ui/code_process/code_exec.py,sha256=w0fgKyxcKl_l47PHgiq_kA2_bGKa6sIW_8M_2A4C7no,7639
|
11
11
|
je_editor/pyside_ui/code_result/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
12
|
je_editor/pyside_ui/code_result/code_record.py,sha256=mTD2bJ1GVeFFNpuOlfPB8am-5MGFxrwYW6nq0tQckPU,1393
|
13
13
|
je_editor/pyside_ui/colors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -32,12 +32,12 @@ je_editor/pyside_ui/menu/menu_bar/help_menu/build_help_menu.py,sha256=17mk5RJ6rz
|
|
32
32
|
je_editor/pyside_ui/menu/menu_bar/run_menu/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
33
|
je_editor/pyside_ui/menu/menu_bar/run_menu/build_run_menu.py,sha256=Ux7JnRP8BZm0r2Bw8BaM2wABzCk_G8oRScCEZCztIRk,4162
|
34
34
|
je_editor/pyside_ui/menu/menu_bar/venv_menu/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
35
|
-
je_editor/pyside_ui/menu/menu_bar/venv_menu/build_venv_menu.py,sha256=
|
35
|
+
je_editor/pyside_ui/menu/menu_bar/venv_menu/build_venv_menu.py,sha256=82_OkfttiosOZ0MqWgHNnxzOXU78O8CCfsVb0zrGC1k,2403
|
36
36
|
je_editor/pyside_ui/search_ui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
37
37
|
je_editor/pyside_ui/search_ui/search_error_box.py,sha256=ost5tDwCJp6izbJNDb4jPJrrOpoNAuDkhpROW9R02NQ,865
|
38
38
|
je_editor/pyside_ui/search_ui/search_text_box.py,sha256=DRtJ3QHu-QzvGwIRLebzCgpVV17apNB2-4Q3tsBwnSM,857
|
39
39
|
je_editor/pyside_ui/shell_process/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
40
|
-
je_editor/pyside_ui/shell_process/shell_exec.py,sha256=
|
40
|
+
je_editor/pyside_ui/shell_process/shell_exec.py,sha256=NYCoxJRDx6obxS4HBuLa-SMKcd8JbAgwlRB5xFrGFpc,7316
|
41
41
|
je_editor/pyside_ui/syntax/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
42
42
|
je_editor/pyside_ui/syntax/python_syntax.py,sha256=C5Ie5y57Pm_oVJIzpNCOtVAItHp_sq-zbn_sJMgVVNE,3749
|
43
43
|
je_editor/pyside_ui/treeview/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -62,8 +62,8 @@ je_editor/utils/json_format/__init__.py,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_X
|
|
62
62
|
je_editor/utils/json_format/json_process.py,sha256=Ic-OpIueSYmtWgnHPP_RzM3dlSmKTsGdLm22pypLb5M,983
|
63
63
|
je_editor/utils/redirect_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
64
64
|
je_editor/utils/redirect_manager/redirect_manager_class.py,sha256=0HX7XyFhN8cFaZefKUsE1MrpQIcnLozrvNTMOsfV5zU,1991
|
65
|
-
je_editor-0.0.
|
66
|
-
je_editor-0.0.
|
67
|
-
je_editor-0.0.
|
68
|
-
je_editor-0.0.
|
69
|
-
je_editor-0.0.
|
65
|
+
je_editor-0.0.108.dist-info/LICENSE,sha256=YcSMBs2sED35BtlErMkfIDye9Oo-3SYmUJiZJOpa34g,1085
|
66
|
+
je_editor-0.0.108.dist-info/METADATA,sha256=Dk1Jx_wnBsw8gN2Jgbt6gK5qlVO9jWLga-LHcIufQWE,3194
|
67
|
+
je_editor-0.0.108.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
68
|
+
je_editor-0.0.108.dist-info/top_level.txt,sha256=_9YA7BgxpkmdLs-5V_UQILxClcMRgPyG1a3qaE-Bkcs,10
|
69
|
+
je_editor-0.0.108.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|