Skip to content

Commit 94b4177

Browse files
authored
Merge pull request #137 from Integration-Automation/dev
Dev
2 parents 12a8400 + 2cc24eb commit 94b4177

File tree

5 files changed

+32
-20
lines changed

5 files changed

+32
-20
lines changed

dev.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
66

77
[project]
88
name = "je_editor_dev"
9-
version = "0.0.186"
9+
version = "0.0.190"
1010
authors = [
1111
{ name = "JE-Chen", email = "[email protected]" },
1212
]

je_editor/pyside_ui/code/code_process/code_exec.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(
2525
main_window: Union[EditorWidget, None] = None,
2626
program_language: str = "python",
2727
program_encoding: str = "utf-8",
28-
program_buffer: int = 8192000,
28+
program_buffer: int = 1024,
2929
):
3030
"""
3131
:param main_window: Pyside main window
@@ -83,18 +83,20 @@ def exec_code(self, exec_file_name, exec_prefix: Union[str, list] = None) -> Non
8383
exec_file = reformat_os_file_path
8484
# run program
8585
if exec_prefix is None:
86-
execute_program_list = [self.compiler_path, exec_file]
86+
execute_program_param = [self.compiler_path, exec_file]
8787
else:
8888
if isinstance(exec_prefix, str):
89-
execute_program_list = [self.compiler_path, exec_prefix, exec_file]
89+
execute_program_param = [self.compiler_path, exec_prefix, exec_file]
9090
else:
91-
execute_program_list = list()
92-
execute_program_list.append(self.compiler_path)
91+
execute_program_param = list()
92+
execute_program_param.append(self.compiler_path)
9393
for prefix in exec_prefix:
94-
execute_program_list.append(prefix)
95-
execute_program_list.append(exec_file)
94+
execute_program_param.append(prefix)
95+
execute_program_param.append(exec_file)
96+
if sys.platform not in ["win32", "cygwin", "msys"]:
97+
execute_program_param = " ".join(execute_program_param)
9698
self.process = subprocess.Popen(
97-
execute_program_list,
99+
execute_program_param,
98100
stdout=subprocess.PIPE,
99101
stderr=subprocess.PIPE,
100102
stdin=subprocess.PIPE,
@@ -178,12 +180,16 @@ def print_and_clear_queue(self) -> None:
178180

179181
def read_program_output_from_process(self) -> None:
180182
while self.still_run_program:
181-
program_output_data: str = self.process.stdout.raw.read(self.program_buffer).decode(self.program_encoding,
182-
errors="replace")
183+
program_output_data: str = self.process.stdout.read(
184+
self.program_buffer).decode(self.program_encoding, "replace")
185+
if self.process:
186+
self.process.stdout.flush()
183187
self.run_output_queue.put_nowait(program_output_data)
184188

185189
def read_program_error_output_from_process(self) -> None:
186190
while self.still_run_program:
187-
program_error_output_data: str = self.process.stderr.raw.read(self.program_buffer).decode(
188-
self.program_encoding, errors="replace")
191+
program_error_output_data: str = self.process.stderr.read(
192+
self.program_buffer).decode(self.program_encoding, "replace")
193+
if self.process:
194+
self.process.stderr.flush()
189195
self.run_error_queue.put_nowait(program_error_output_data)

je_editor/pyside_ui/code/plaintext_code_edit/code_edit_plaintext.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ def complete(self) -> None:
136136
else:
137137
script = jedi.Script(code=self.toPlainText())
138138
jedi_complete_list: List[Completion] = script.complete(
139-
self.textCursor().blockNumber() + 1, self.textCursor().positionInBlock())
139+
self.textCursor().blockNumber() + 1,
140+
len(self.textCursor().document().findBlockByLineNumber(self.textCursor().blockNumber()).text())
141+
)
140142
if len(jedi_complete_list) > 0:
141143
new_complete_list = list()
142144
for complete_text in jedi_complete_list:

je_editor/pyside_ui/code/shell_process/shell_exec.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __init__(
2626
self,
2727
main_window: Union[EditorWidget, None] = None,
2828
shell_encoding: str = "utf-8",
29-
program_buffer: int = 8192000,
29+
program_buffer: int = 1024,
3030
after_done_function: Union[None, Callable] = None
3131
):
3232
"""
@@ -165,14 +165,18 @@ def print_and_clear_queue(self) -> None:
165165

166166
def read_program_output_from_process(self) -> None:
167167
while self.still_run_shell:
168-
program_output_data = self.process.stdout.raw.read(
168+
program_output_data = self.process.stdout.read(
169169
self.program_buffer) \
170-
.decode(self.program_encoding)
170+
.decode(self.program_encoding, "replace")
171+
if self.process:
172+
self.process.stdout.flush()
171173
self.run_output_queue.put_nowait(program_output_data)
172174

173175
def read_program_error_output_from_process(self) -> None:
174176
while self.still_run_shell:
175-
program_error_output_data = self.process.stderr.raw.read(
177+
program_error_output_data = self.process.stderr.read(
176178
self.program_buffer) \
177-
.decode(self.program_encoding)
179+
.decode(self.program_encoding, "replace")
180+
if self.process:
181+
self.process.stderr.flush()
178182
self.run_error_queue.put_nowait(program_error_output_data)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
66

77
[project]
88
name = "je_editor"
9-
version = "0.0.171"
9+
version = "0.0.175"
1010
authors = [
1111
{ name = "JE-Chen", email = "[email protected]" },
1212
]

0 commit comments

Comments
 (0)