je-editor 0.0.184__tar.gz → 0.0.187__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {je_editor-0.0.184 → je_editor-0.0.187}/PKG-INFO +2 -2
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/__init__.py +2 -2
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/__main__.py +1 -1
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/code/plaintext_code_edit/code_edit_plaintext.py +6 -1
- je_editor-0.0.187/je_editor/pyside_ui/code/syntax/python_syntax.py +62 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/code/syntax/syntax_setting.py +2 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/main_editor.py +4 -3
- je_editor-0.0.187/je_editor/utils/logging/loggin_instance.py +27 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/redirect_manager/redirect_manager_class.py +2 -7
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor.egg-info/PKG-INFO +2 -2
- {je_editor-0.0.184 → je_editor-0.0.187}/pyproject.toml +1 -1
- je_editor-0.0.184/je_editor/pyside_ui/code/syntax/python_syntax.py +0 -39
- je_editor-0.0.184/je_editor/utils/logging/loggin_instance.py +0 -13
- {je_editor-0.0.184 → je_editor-0.0.187}/LICENSE +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/README.md +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/browser/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/browser/browser_download_window.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/browser/browser_serach_lineedit.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/browser/browser_view.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/browser/browser_widget.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/code/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/code/auto_save/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/code/auto_save/auto_save_manager.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/code/auto_save/auto_save_thread.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/code/code_format/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/code/code_format/pep8_format.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/code/code_process/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/code/code_process/code_exec.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/code/plaintext_code_edit/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/code/running_process_manager.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/code/shell_process/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/code/shell_process/shell_exec.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/code/syntax/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/code/textedit_code_result/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/code/textedit_code_result/code_record.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/dialog/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/dialog/file_dialog/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/dialog/file_dialog/create_file_dialog.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/dialog/file_dialog/open_file_dialog.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/dialog/file_dialog/save_file_dialog.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/dialog/search_ui/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/dialog/search_ui/search_error_box.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/dialog/search_ui/search_text_box.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/dock/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/dock/destroy_dock.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/editor/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/editor/editor_widget.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/editor/editor_widget_dock.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/editor/process_input.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/ipython_widget/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/ipython_widget/rich_jupyter.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/check_style_menu/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/check_style_menu/build_check_style_menu.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/dock_menu/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/dock_menu/build_dock_menu.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/file_menu/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/file_menu/build_file_menu.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/help_menu/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/help_menu/build_help_menu.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/language_menu/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/language_menu/build_language_server.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/python_env_menu/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/python_env_menu/build_venv_menu.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/run_menu/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/run_menu/build_run_menu.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/run_menu/under_run_menu/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/run_menu/under_run_menu/build_debug_menu.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/run_menu/under_run_menu/build_program_menu.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/run_menu/under_run_menu/build_shell_menu.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/run_menu/under_run_menu/utils.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/set_menu_bar.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/style_menu/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/style_menu/build_style_menu.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/tab_menu/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/tab_menu/build_tab_menu.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/text_menu/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/text_menu/build_text_menu.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/save_settings/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/save_settings/setting_utils.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/save_settings/user_color_setting_file.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/save_settings/user_setting_file.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/system_tray/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/system_tray/extend_system_tray.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/start_editor.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/encodings/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/encodings/python_encodings.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/exception/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/exception/exception_tags.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/exception/exceptions.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/file/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/file/open/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/file/open/open_file.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/file/save/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/file/save/save_file.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/json/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/json/json_file.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/json_format/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/json_format/json_process.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/logging/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/multi_language/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/multi_language/english.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/multi_language/multi_language_wrapper.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/multi_language/traditional_chinese.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/redirect_manager/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/venv_check/__init__.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/venv_check/check_venv.py +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor.egg-info/SOURCES.txt +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor.egg-info/dependency_links.txt +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor.egg-info/requires.txt +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/je_editor.egg-info/top_level.txt +0 -0
- {je_editor-0.0.184 → je_editor-0.0.187}/setup.cfg +0 -0
@@ -2,7 +2,7 @@ from je_editor.pyside_ui.browser.browser_widget import BrowserWidget
|
|
2
2
|
from je_editor.pyside_ui.code.code_process.code_exec import ExecManager
|
3
3
|
from je_editor.pyside_ui.code.shell_process.shell_exec import ShellManager
|
4
4
|
from je_editor.pyside_ui.code.syntax.python_syntax import PythonHighlighter
|
5
|
-
from je_editor.pyside_ui.code.syntax.syntax_setting import
|
5
|
+
from je_editor.pyside_ui.code.syntax.syntax_setting import syntax_extend_setting_dict, syntax_rule_setting_dict
|
6
6
|
from je_editor.pyside_ui.main_ui.editor.editor_widget import EditorWidget
|
7
7
|
from je_editor.pyside_ui.main_ui.editor.editor_widget_dock import FullEditorWidget
|
8
8
|
from je_editor.pyside_ui.main_ui.main_editor import EDITOR_EXTEND_TAB
|
@@ -26,7 +26,7 @@ __all__ = [
|
|
26
26
|
"start_editor", "EditorMain", "EDITOR_EXTEND_TAB",
|
27
27
|
"JEditorException", "JEditorExecException", "FullEditorWidget",
|
28
28
|
"JEditorRunOnShellException", "JEditorSaveFileException", "syntax_rule_setting_dict",
|
29
|
-
"JEditorOpenFileException", "JEditorContentFileException", "
|
29
|
+
"JEditorOpenFileException", "JEditorContentFileException", "syntax_extend_setting_dict",
|
30
30
|
"JEditorCantFindLanguageException", "JEditorJsonException", "PythonHighlighter",
|
31
31
|
"user_setting_dict", "user_setting_color_dict", "EditorWidget", "BrowserWidget",
|
32
32
|
"ExecManager", "ShellManager", "traditional_chinese_word_dict", "english_word_dict",
|
@@ -43,6 +43,7 @@ class CodeEditor(QPlainTextEdit):
|
|
43
43
|
self.check_env()
|
44
44
|
# Self main window (parent)
|
45
45
|
self.main_window = main_window
|
46
|
+
self.current_file = main_window.current_file
|
46
47
|
|
47
48
|
self.skip_popup_behavior_list = [
|
48
49
|
Qt.Key.Key_Enter, Qt.Key.Key_Return, Qt.Key.Key_Up, Qt.Key.Key_Down,
|
@@ -64,7 +65,7 @@ class CodeEditor(QPlainTextEdit):
|
|
64
65
|
self.setTabStopDistance(
|
65
66
|
QtGui.QFontMetricsF(self.font()).horizontalAdvance(" ")
|
66
67
|
)
|
67
|
-
self.highlighter = PythonHighlighter(self.document())
|
68
|
+
self.highlighter = PythonHighlighter(self.document(), main_window=self)
|
68
69
|
self.highlight_current_line()
|
69
70
|
self.setLineWrapMode(self.LineWrapMode.NoWrap)
|
70
71
|
# Search Text
|
@@ -79,6 +80,10 @@ class CodeEditor(QPlainTextEdit):
|
|
79
80
|
self.completer: Union[None, QCompleter] = None
|
80
81
|
self.set_complete([])
|
81
82
|
|
83
|
+
def reset_highlighter(self):
|
84
|
+
self.highlighter = PythonHighlighter(self.document(), main_window=self)
|
85
|
+
self.highlight_current_line()
|
86
|
+
|
82
87
|
def check_env(self):
|
83
88
|
jeditor_logger.info("CodeEditor check_env")
|
84
89
|
path = venv_check()
|
@@ -0,0 +1,62 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from pathlib import Path
|
4
|
+
from typing import TYPE_CHECKING
|
5
|
+
|
6
|
+
if TYPE_CHECKING:
|
7
|
+
from je_editor.pyside_ui.code.plaintext_code_edit.code_edit_plaintext import CodeEditor
|
8
|
+
|
9
|
+
from PySide6.QtCore import QRegularExpression
|
10
|
+
from PySide6.QtGui import QSyntaxHighlighter
|
11
|
+
from PySide6.QtGui import QTextCharFormat
|
12
|
+
|
13
|
+
from je_editor.pyside_ui.code.syntax.syntax_setting import syntax_word_setting_dict, syntax_rule_setting_dict, \
|
14
|
+
syntax_extend_setting_dict
|
15
|
+
from je_editor.utils.logging.loggin_instance import jeditor_logger
|
16
|
+
|
17
|
+
|
18
|
+
class PythonHighlighter(QSyntaxHighlighter):
|
19
|
+
def __init__(self, parent=None, main_window: CodeEditor = None):
|
20
|
+
jeditor_logger.info(f"Init PythonHighlighter parent: {parent}")
|
21
|
+
super().__init__(parent)
|
22
|
+
|
23
|
+
self.highlight_rules = []
|
24
|
+
if main_window.current_file is not None:
|
25
|
+
current_file_suffix = Path(main_window.current_file).suffix
|
26
|
+
else:
|
27
|
+
current_file_suffix = ".py"
|
28
|
+
if current_file_suffix == ".py":
|
29
|
+
# Highlight
|
30
|
+
for rule_variable_dict in syntax_word_setting_dict.values():
|
31
|
+
color = rule_variable_dict.get("color")
|
32
|
+
text_char_format = QTextCharFormat()
|
33
|
+
text_char_format.setForeground(color)
|
34
|
+
for word in rule_variable_dict.get("words"):
|
35
|
+
pattern = QRegularExpression(rf"\b{word}\b")
|
36
|
+
self.highlight_rules.append((pattern, text_char_format))
|
37
|
+
for rule_variable_dict in syntax_rule_setting_dict.values():
|
38
|
+
color = rule_variable_dict.get("color")
|
39
|
+
text_char_format = QTextCharFormat()
|
40
|
+
text_char_format.setForeground(color)
|
41
|
+
for rule in rule_variable_dict.get("rules"):
|
42
|
+
pattern = QRegularExpression(rule)
|
43
|
+
self.highlight_rules.append((pattern, text_char_format))
|
44
|
+
else:
|
45
|
+
if syntax_extend_setting_dict.get(current_file_suffix):
|
46
|
+
for rule_variable_dict in syntax_extend_setting_dict.get("current_file_suffix").values():
|
47
|
+
color = rule_variable_dict.get("color")
|
48
|
+
text_char_format = QTextCharFormat()
|
49
|
+
text_char_format.setForeground(color)
|
50
|
+
for word in rule_variable_dict.get("words"):
|
51
|
+
pattern = QRegularExpression(rf"\b{word}\b")
|
52
|
+
self.highlight_rules.append((pattern, text_char_format))
|
53
|
+
else:
|
54
|
+
pass
|
55
|
+
|
56
|
+
def highlightBlock(self, text) -> None:
|
57
|
+
jeditor_logger.info(f"PythonHighlighter highlightBlock text: {text}")
|
58
|
+
for pattern, pattern_format in self.highlight_rules:
|
59
|
+
match_iterator = pattern.globalMatch(text)
|
60
|
+
while match_iterator.hasNext():
|
61
|
+
match = match_iterator.next()
|
62
|
+
self.setFormat(match.capturedStart(), match.capturedLength(), pattern_format)
|
@@ -12,6 +12,7 @@ from frontengine import FrontEngineMainUI
|
|
12
12
|
from frontengine import RedirectManager
|
13
13
|
from qt_material import QtStyleTools
|
14
14
|
|
15
|
+
from je_editor.utils.logging.loggin_instance import jeditor_logger
|
15
16
|
from je_editor.pyside_ui.browser.browser_widget import BrowserWidget
|
16
17
|
from je_editor.pyside_ui.code.auto_save.auto_save_manager import init_new_auto_save_thread, file_is_open_manager_dict
|
17
18
|
from je_editor.pyside_ui.main_ui.editor.editor_widget import EditorWidget
|
@@ -22,7 +23,6 @@ from je_editor.pyside_ui.main_ui.save_settings.user_setting_file import user_set
|
|
22
23
|
write_user_setting
|
23
24
|
from je_editor.pyside_ui.main_ui.system_tray.extend_system_tray import ExtendSystemTray
|
24
25
|
from je_editor.utils.file.open.open_file import read_file
|
25
|
-
from je_editor.utils.logging.loggin_instance import jeditor_logger
|
26
26
|
from je_editor.utils.multi_language.multi_language_wrapper import language_wrapper
|
27
27
|
from je_editor.utils.redirect_manager.redirect_manager_class import redirect_manager_instance
|
28
28
|
|
@@ -97,7 +97,7 @@ class EditorMain(QMainWindow, QtStyleTools):
|
|
97
97
|
self.system_tray.show()
|
98
98
|
self.system_tray.setToolTip(language_wrapper.language_word_dict.get("application_name"))
|
99
99
|
# Put Redirect on last to trace exception
|
100
|
-
|
100
|
+
redirect_manager_instance.restore_std()
|
101
101
|
redirect_manager_instance.set_redirect()
|
102
102
|
# Timer to redirect error or message
|
103
103
|
self.redirect_timer = QTimer(self)
|
@@ -181,6 +181,7 @@ class EditorMain(QMainWindow, QtStyleTools):
|
|
181
181
|
if last_file_path.is_file() and last_file_path.exists() and widget.code_save_thread is None:
|
182
182
|
init_new_auto_save_thread(str(last_file_path), widget)
|
183
183
|
widget.code_edit.setPlainText(read_file(widget.current_file)[1])
|
184
|
+
widget.code_edit.reset_highlighter()
|
184
185
|
file_is_open_manager_dict.update({str(last_file_path): str(last_file_path.name)})
|
185
186
|
widget.rename_self_tab()
|
186
187
|
|
@@ -204,7 +205,7 @@ class EditorMain(QMainWindow, QtStyleTools):
|
|
204
205
|
self.tab_widget.setCurrentWidget(widget)
|
205
206
|
|
206
207
|
def closeEvent(self, event) -> None:
|
207
|
-
jeditor_logger.info(
|
208
|
+
jeditor_logger.info("EditorMain closeEvent")
|
208
209
|
write_user_setting()
|
209
210
|
write_user_color_setting()
|
210
211
|
super().closeEvent(event)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import logging
|
2
|
+
from logging.handlers import RotatingFileHandler
|
3
|
+
|
4
|
+
logging.root.setLevel(logging.DEBUG)
|
5
|
+
jeditor_logger = logging.getLogger("JEditor")
|
6
|
+
formatter = logging.Formatter('%(asctime)s | %(name)s | %(levelname)s | %(message)s')
|
7
|
+
|
8
|
+
|
9
|
+
class JEditorLoggingHandler(RotatingFileHandler):
|
10
|
+
|
11
|
+
# redirect logging stderr output to queue
|
12
|
+
|
13
|
+
def __init__(self, filename: str = "JEditor.log", mode="w",
|
14
|
+
maxBytes:int=1073741824, backupCount:int=0):
|
15
|
+
super().__init__(filename=filename, mode=mode, maxBytes=maxBytes, backupCount=backupCount)
|
16
|
+
self.formatter = formatter
|
17
|
+
self.setLevel(logging.DEBUG)
|
18
|
+
|
19
|
+
def emit(self, record: logging.LogRecord) -> None:
|
20
|
+
super().emit(record)
|
21
|
+
|
22
|
+
|
23
|
+
# File handler
|
24
|
+
file_handler = JEditorLoggingHandler()
|
25
|
+
jeditor_logger.addHandler(file_handler)
|
26
|
+
|
27
|
+
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/redirect_manager/redirect_manager_class.py
RENAMED
@@ -10,15 +10,12 @@ class RedirectStdOut(logging.Handler):
|
|
10
10
|
# redirect logging std output to queue
|
11
11
|
|
12
12
|
def __init__(self):
|
13
|
-
jeditor_logger.info("Init RedirectStdOut")
|
14
13
|
super().__init__()
|
15
14
|
|
16
15
|
def write(self, content_to_write) -> None:
|
17
|
-
jeditor_logger.info(f"RedirectStdOut write content_to_write: {content_to_write}")
|
18
16
|
redirect_manager_instance.std_out_queue.put(content_to_write)
|
19
17
|
|
20
18
|
def emit(self, record: logging.LogRecord) -> None:
|
21
|
-
jeditor_logger.info(f"RedirectStdOut emit record: {record}")
|
22
19
|
redirect_manager_instance.std_out_queue.put(self.format(record))
|
23
20
|
|
24
21
|
|
@@ -27,15 +24,12 @@ class RedirectStdErr(logging.Handler):
|
|
27
24
|
# redirect logging stderr output to queue
|
28
25
|
|
29
26
|
def __init__(self):
|
30
|
-
jeditor_logger.info("Init RedirectStdErr")
|
31
27
|
super().__init__()
|
32
28
|
|
33
29
|
def write(self, content_to_write) -> None:
|
34
|
-
jeditor_logger.info(f"RedirectStdErr write content_to_write: {content_to_write}")
|
35
30
|
redirect_manager_instance.std_err_queue.put(content_to_write)
|
36
31
|
|
37
32
|
def emit(self, record: logging.LogRecord) -> None:
|
38
|
-
jeditor_logger.info(f"RedirectStdErr emit record: {record}")
|
39
33
|
redirect_manager_instance.std_err_queue.put(self.format(record))
|
40
34
|
|
41
35
|
|
@@ -58,8 +52,9 @@ class RedirectManager(object):
|
|
58
52
|
sys.stderr = redirect_err
|
59
53
|
default_logger = logging.getLogger("RedirectManager")
|
60
54
|
default_logger.addHandler(redirect_err)
|
55
|
+
skip_logger_list = ["JEditor", "FrontEngine", "AutomationIDE"]
|
61
56
|
for name in logging.root.manager.loggerDict.keys():
|
62
|
-
if name
|
57
|
+
if name in skip_logger_list:
|
63
58
|
continue
|
64
59
|
else:
|
65
60
|
logging.getLogger(name).addHandler(redirect_err)
|
@@ -1,39 +0,0 @@
|
|
1
|
-
from PySide6.QtCore import QRegularExpression
|
2
|
-
from PySide6.QtGui import QSyntaxHighlighter
|
3
|
-
from PySide6.QtGui import QTextCharFormat
|
4
|
-
|
5
|
-
from je_editor.pyside_ui.code.syntax.syntax_setting import syntax_word_setting_dict, syntax_rule_setting_dict
|
6
|
-
from je_editor.utils.logging.loggin_instance import jeditor_logger
|
7
|
-
|
8
|
-
|
9
|
-
class PythonHighlighter(QSyntaxHighlighter):
|
10
|
-
def __init__(self, parent=None):
|
11
|
-
jeditor_logger.info(f"Init PythonHighlighter parent: {parent}")
|
12
|
-
super().__init__(parent)
|
13
|
-
|
14
|
-
self.highlight_rules = []
|
15
|
-
|
16
|
-
# Highlight
|
17
|
-
for rule_variable_dict in syntax_word_setting_dict.values():
|
18
|
-
color = rule_variable_dict.get("color")
|
19
|
-
text_char_format = QTextCharFormat()
|
20
|
-
text_char_format.setForeground(color)
|
21
|
-
for word in rule_variable_dict.get("words"):
|
22
|
-
pattern = QRegularExpression(rf"\b{word}\b")
|
23
|
-
self.highlight_rules.append((pattern, text_char_format))
|
24
|
-
|
25
|
-
for rule_variable_dict in syntax_rule_setting_dict.values():
|
26
|
-
color = rule_variable_dict.get("color")
|
27
|
-
text_char_format = QTextCharFormat()
|
28
|
-
text_char_format.setForeground(color)
|
29
|
-
for rule in rule_variable_dict.get("rules"):
|
30
|
-
pattern = QRegularExpression(rule)
|
31
|
-
self.highlight_rules.append((pattern, text_char_format))
|
32
|
-
|
33
|
-
def highlightBlock(self, text) -> None:
|
34
|
-
jeditor_logger.info(f"PythonHighlighter highlightBlock text: {text}")
|
35
|
-
for pattern, pattern_format in self.highlight_rules:
|
36
|
-
match_iterator = pattern.globalMatch(text)
|
37
|
-
while match_iterator.hasNext():
|
38
|
-
match = match_iterator.next()
|
39
|
-
self.setFormat(match.capturedStart(), match.capturedLength(), pattern_format)
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import logging
|
2
|
-
from logging.handlers import RotatingFileHandler
|
3
|
-
|
4
|
-
logging.root.setLevel(logging.DEBUG)
|
5
|
-
jeditor_logger = logging.getLogger("JEditor")
|
6
|
-
formatter = logging.Formatter('%(asctime)s | %(name)s | %(levelname)s | %(message)s')
|
7
|
-
|
8
|
-
# Rotating File Handler
|
9
|
-
rotating_file_handler = RotatingFileHandler(filename="JEditor.log", mode="w",maxBytes=1073741824)
|
10
|
-
rotating_file_handler.setFormatter(formatter)
|
11
|
-
jeditor_logger.addHandler(rotating_file_handler)
|
12
|
-
|
13
|
-
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/browser/browser_download_window.py
RENAMED
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/browser/browser_serach_lineedit.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/code/auto_save/auto_save_manager.py
RENAMED
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/code/auto_save/auto_save_thread.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/code/plaintext_code_edit/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/code/shell_process/shell_exec.py
RENAMED
File without changes
|
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/code/textedit_code_result/__init__.py
RENAMED
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/code/textedit_code_result/code_record.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/dialog/file_dialog/create_file_dialog.py
RENAMED
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/dialog/file_dialog/open_file_dialog.py
RENAMED
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/dialog/file_dialog/save_file_dialog.py
RENAMED
File without changes
|
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/dialog/search_ui/search_error_box.py
RENAMED
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/dialog/search_ui/search_text_box.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/editor/editor_widget_dock.py
RENAMED
File without changes
|
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/ipython_widget/__init__.py
RENAMED
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/ipython_widget/rich_jupyter.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/dock_menu/__init__.py
RENAMED
File without changes
|
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/file_menu/__init__.py
RENAMED
File without changes
|
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/help_menu/__init__.py
RENAMED
File without changes
|
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/language_menu/__init__.py
RENAMED
File without changes
|
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/python_env_menu/__init__.py
RENAMED
File without changes
|
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/run_menu/__init__.py
RENAMED
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/run_menu/build_run_menu.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/style_menu/__init__.py
RENAMED
File without changes
|
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/tab_menu/__init__.py
RENAMED
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/tab_menu/build_tab_menu.py
RENAMED
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/menu/text_menu/__init__.py
RENAMED
File without changes
|
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/save_settings/__init__.py
RENAMED
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/pyside_ui/main_ui/save_settings/setting_utils.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/multi_language/multi_language_wrapper.py
RENAMED
File without changes
|
{je_editor-0.0.184 → je_editor-0.0.187}/je_editor/utils/multi_language/traditional_chinese.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|