je-editor 0.0.63__tar.gz → 0.0.64__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {je_editor-0.0.63 → je_editor-0.0.64}/PKG-INFO +1 -1
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/main_ui_setting/ui_setting.py +3 -0
- je_editor-0.0.64/je_editor/pyside_ui/syntax/python_syntax.py +97 -0
- je_editor-0.0.64/je_editor/utils/redirect_manager/__init__.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor.egg-info/PKG-INFO +1 -1
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor.egg-info/SOURCES.txt +2 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/pyproject.toml +1 -1
- {je_editor-0.0.63 → je_editor-0.0.64}/LICENSE +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/README.md +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/__init__.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/__main__.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/__init__.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/actions/__init__.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/auto_save/__init__.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/auto_save/auto_save_thread.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/code_process/__init__.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/code_process/code_exec.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/file_dialog/__init__.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/file_dialog/open_file_dialog.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/file_dialog/save_file_dialog.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/main_ui/__init__.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/main_ui/editor_main_ui/__init__.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/main_ui/editor_main_ui/main_editor.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/main_ui_setting/__init__.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/menu/__init__.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/menu/menu_bar/__init__.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/menu/menu_bar/file_menu/__init__.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/menu/menu_bar/file_menu/build_file_menu.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/menu/menu_bar/run_menu/__init__.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/menu/menu_bar/run_menu/build_run_menu.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/menu/menu_bar/set_menu_bar.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/shell_process/__init__.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/shell_process/shell_exec.py +0 -0
- {je_editor-0.0.63/je_editor/pyside_ui/treeview → je_editor-0.0.64/je_editor/pyside_ui/syntax}/__init__.py +0 -0
- {je_editor-0.0.63/je_editor/pyside_ui/treeview/project_treeview → je_editor-0.0.64/je_editor/pyside_ui/treeview}/__init__.py +0 -0
- {je_editor-0.0.63/je_editor/utils/file → je_editor-0.0.64/je_editor/pyside_ui/treeview/project_treeview}/__init__.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/treeview/project_treeview/set_project_treeview.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/start_editor.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/utils/__init__.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/utils/exception/__init__.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/utils/exception/exception_tags.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/utils/exception/exceptions.py +0 -0
- {je_editor-0.0.63/je_editor/utils/project → je_editor-0.0.64/je_editor/utils/file}/__init__.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/utils/file/open/__init__.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/utils/file/open/open_file.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/utils/file/save/__init__.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/utils/file/save/save_file.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/utils/json_format/__init__.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/utils/json_format/json_process.py +0 -0
- {je_editor-0.0.63/je_editor/utils/redirect_manager → je_editor-0.0.64/je_editor/utils/project}/__init__.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/utils/project/create_project.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor/utils/redirect_manager/redirect_manager_class.py +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor.egg-info/dependency_links.txt +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor.egg-info/requires.txt +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/je_editor.egg-info/top_level.txt +0 -0
- {je_editor-0.0.63 → je_editor-0.0.64}/setup.cfg +0 -0
@@ -1,6 +1,8 @@
|
|
1
1
|
from PySide6 import QtGui
|
2
2
|
from PySide6.QtWidgets import QMainWindow, QScrollArea, QPlainTextEdit, QGridLayout, QWidget, QTextEdit
|
3
3
|
|
4
|
+
from je_editor.pyside_ui.syntax.python_syntax import PythonHighlighter
|
5
|
+
|
4
6
|
|
5
7
|
def set_ui(ui_we_want_to_set: QMainWindow):
|
6
8
|
# set qt window
|
@@ -14,6 +16,7 @@ def set_ui(ui_we_want_to_set: QMainWindow):
|
|
14
16
|
ui_we_want_to_set.code_edit.setLineWrapMode(ui_we_want_to_set.code_edit.LineWrapMode.NoWrap)
|
15
17
|
ui_we_want_to_set.code_edit.setTabStopDistance(
|
16
18
|
QtGui.QFontMetricsF(ui_we_want_to_set.code_edit.font()).horizontalAdvance(' ') * 4)
|
19
|
+
PythonHighlighter(ui_we_want_to_set.code_edit.document())
|
17
20
|
ui_we_want_to_set.code_result = QTextEdit()
|
18
21
|
ui_we_want_to_set.code_result.setLineWrapMode(ui_we_want_to_set.code_result.LineWrapMode.NoWrap)
|
19
22
|
ui_we_want_to_set.code_result.setReadOnly(True)
|
@@ -0,0 +1,97 @@
|
|
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"'[^'\\]*(\\.[^'\\]*)*'", # Singel
|
41
|
+
r'"[^"\\]*(\\.[^"\\]*)*"' # Double
|
42
|
+
]
|
43
|
+
|
44
|
+
number_rule = [
|
45
|
+
r"\b[+-]?[0-9]+[lL]?\b",
|
46
|
+
r"\b[+-]?0[xX][0-9A-Fa-f]+[lL]?\b",
|
47
|
+
r"\b[+-]?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\b"
|
48
|
+
]
|
49
|
+
|
50
|
+
|
51
|
+
class PythonHighlighter(QSyntaxHighlighter):
|
52
|
+
def __init__(self, parent=None):
|
53
|
+
super().__init__(parent)
|
54
|
+
|
55
|
+
self.highlight_rules = []
|
56
|
+
|
57
|
+
text_char_format = QTextCharFormat()
|
58
|
+
text_char_format.setForeground(QColor(255, 212, 102))
|
59
|
+
text_char_format.setFontWeight(QFont.Bold)
|
60
|
+
for word in keywords:
|
61
|
+
pattern = QRegularExpression(rf"\b{word}\b")
|
62
|
+
self.highlight_rules.append((pattern, text_char_format))
|
63
|
+
|
64
|
+
text_char_format = QTextCharFormat()
|
65
|
+
text_char_format.setForeground(QColor(0, 153, 0))
|
66
|
+
for rule in string_rule:
|
67
|
+
pattern = QRegularExpression(rule)
|
68
|
+
self.highlight_rules.append((pattern, text_char_format))
|
69
|
+
|
70
|
+
text_char_format = QTextCharFormat()
|
71
|
+
text_char_format.setForeground(QColor(0, 128, 255))
|
72
|
+
for rule in number_rule:
|
73
|
+
pattern = QRegularExpression(rule)
|
74
|
+
self.highlight_rules.append((pattern, text_char_format))
|
75
|
+
|
76
|
+
text_char_format = QTextCharFormat()
|
77
|
+
text_char_format.setForeground(QColor(0, 0, 255))
|
78
|
+
for rule in builtins_keyword:
|
79
|
+
pattern = QRegularExpression(rule)
|
80
|
+
self.highlight_rules.append((pattern, text_char_format))
|
81
|
+
|
82
|
+
text_char_format = QTextCharFormat()
|
83
|
+
text_char_format.setForeground(QColor(80, 80, 80))
|
84
|
+
pattern = QRegularExpression(r"#[^\n]*")
|
85
|
+
self.highlight_rules.append((pattern, text_char_format))
|
86
|
+
|
87
|
+
text_char_format = QTextCharFormat()
|
88
|
+
text_char_format.setForeground(QColor(204, 0, 204))
|
89
|
+
pattern = QRegularExpression(r"\bself\b")
|
90
|
+
self.highlight_rules.append((pattern, text_char_format))
|
91
|
+
|
92
|
+
def highlightBlock(self, text):
|
93
|
+
for pattern, format in self.highlight_rules:
|
94
|
+
match_iterator = pattern.globalMatch(text)
|
95
|
+
while match_iterator.hasNext():
|
96
|
+
match = match_iterator.next()
|
97
|
+
self.setFormat(match.capturedStart(), match.capturedLength(), format)
|
File without changes
|
@@ -32,6 +32,8 @@ je_editor/pyside_ui/menu/menu_bar/run_menu/__init__.py
|
|
32
32
|
je_editor/pyside_ui/menu/menu_bar/run_menu/build_run_menu.py
|
33
33
|
je_editor/pyside_ui/shell_process/__init__.py
|
34
34
|
je_editor/pyside_ui/shell_process/shell_exec.py
|
35
|
+
je_editor/pyside_ui/syntax/__init__.py
|
36
|
+
je_editor/pyside_ui/syntax/python_syntax.py
|
35
37
|
je_editor/pyside_ui/treeview/__init__.py
|
36
38
|
je_editor/pyside_ui/treeview/project_treeview/__init__.py
|
37
39
|
je_editor/pyside_ui/treeview/project_treeview/set_project_treeview.py
|
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.63 → je_editor-0.0.64}/je_editor/pyside_ui/main_ui/editor_main_ui/__init__.py
RENAMED
File without changes
|
{je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/main_ui/editor_main_ui/main_editor.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/menu/menu_bar/file_menu/__init__.py
RENAMED
File without changes
|
{je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/menu/menu_bar/file_menu/build_file_menu.py
RENAMED
File without changes
|
{je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/menu/menu_bar/run_menu/__init__.py
RENAMED
File without changes
|
{je_editor-0.0.63 → je_editor-0.0.64}/je_editor/pyside_ui/menu/menu_bar/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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{je_editor-0.0.63/je_editor/utils/project → je_editor-0.0.64/je_editor/utils/file}/__init__.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
|
{je_editor-0.0.63 → je_editor-0.0.64}/je_editor/utils/redirect_manager/redirect_manager_class.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|