-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathconstants.py
More file actions
323 lines (273 loc) Β· 8.67 KB
/
constants.py
File metadata and controls
323 lines (273 loc) Β· 8.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
"""
Copyright (c) 2013-present Matic Kukovec.
Released under the GNU GPL3 license.
For more information check the 'LICENSE.txt' file.
For complete license information of the dependencies, check the 'additional_licenses' directory.
"""
import enum
class LanguageIcon(enum.Enum):
PYTHON = "language_icons/logo_python.png"
CYTHON = "language_icons/logo_cython.png"
C = "language_icons/logo_c.png"
AWK = "language_icons/logo_awk.png"
C_CPP = "language_icons/logo_c_cpp.png"
CIDODE = "language_icons/logo_cicode.png"
OBERON_MODULA = "language_icons/logo_oberon.png"
D = "language_icons/logo_d.png"
NIM = "language_icons/logo_nim.png"
ADA = "language_icons/logo_ada.png"
CMAKE = "language_icons/logo_cmake.png"
CSS = "language_icons/logo_css.png"
HTML = "language_icons/logo_html.png"
JSON = "language_icons/logo_json.png"
LUA = "language_icons/logo_lua.png"
MATLAB = "language_icons/logo_matlab.png"
PERL = "language_icons/logo_perl.png"
RUBY = "language_icons/logo_ruby.png"
TCL = "language_icons/logo_tcl.png"
TEX = "language_icons/logo_tex.png"
IDL = "language_icons/logo_idl.png"
BASH = "language_icons/logo_bash.png"
BATCH = "language_icons/logo_batch.png"
FORTRAN = "language_icons/logo_fortran.png"
FORTRAN77 = "language_icons/logo_fortran77.png"
COFFEESCRIPT = "language_icons/logo_coffeescript.png"
C_SHARP = "language_icons/logo_csharp.png"
JAVA = "language_icons/logo_java.png"
JAVASCRIPT = "language_icons/logo_javascript.png"
MAKEFILE = "language_icons/logo_makefile.png"
OCTAVE = "language_icons/logo_octave.png"
PASCAL = "language_icons/logo_pascal.png"
POSTSCRIPT = "language_icons/logo_postscript.png"
ROUTEROS = "language_icons/logo_routeros.png"
SPICE = "language_icons/logo_spice.png"
SQL = "language_icons/logo_sql.png"
VERILOG = "language_icons/logo_verilog.png"
VHDL = "language_icons/logo_vhdl.png"
XML = "language_icons/logo_xml.png"
YAML = "language_icons/logo_yaml.png"
ZIG = "language_icons/logo_zig.png"
RUST = "language_icons/logo_rust.png"
INI = "tango_icons/document-properties.png"
TEXT = "tango_icons/text-x-generic.png"
UNKNOWN = "tango_icons/file.png"
# File extension lists
supported_file_extentions = {
# "assembly": [".s", ".S", ".Asm"],
"ada": [".ads", ".adb"],
"awk": [".awk"],
"bash": [".sh"],
"batch": [".bat", ".batch"],
"c": [".c", ".h"],
"c++": [
".c++",
".h++",
".cc",
".hh",
".cpp",
".hpp",
".cxx",
".hxx",
".cpp2",
".cppx",
".ixx",
],
"cicode": [".ci"],
"coffeescript": [".coffee"],
"csharp": [".cs"],
"css": [".css"],
"cython": [".pyx", ".pxd", ".pxi"],
"d": [".d"],
"fortran": [".f90", ".f95", ".f03"],
"fortran77": [".f", ".for"],
"html": [".html", ".htm", ".svelte", ".htmx"],
"idl": [".idl"],
"ini": [".ini"],
"java": [".java"],
"javascript": [
".js",
".jsx",
".mjs",
".ts",
".tsx",
],
"json": [".json"],
"lua": [".lua"],
"nim": [".nim", ".nims", ".nimble"],
"oberon/modula": [".mod", ".ob", ".ob2", ".cp"],
"octave": [".m"],
"pascal": [".pas", ".pp", ".lpr", ".cyp"],
"perl": [".pl", ".pm"],
"php": [".php"],
"postscript": [
".ps",
],
"python": [".py", ".pyw", ".pyi", ".scons", ".mojo", ".π₯οΈσ ³σ
σ
σ
σ ͺσ Ύσ σ
σ »σ
σ
σ
σ
’σ £σ σ
σ
£σ σ
₯σ
σ
σ
¦σ
σ
’σ
£σ
σ
σ σ
σ
¦σ
σ
’σ
’σ
σ
σ
σ σ
σ
₯σ
£σ
€σ σ
£σ
σ
©σ σ σ
°σ σ Ώσ
σ
σ
©σ σ
£σ
₯σ
’σ
σ σ
°σ σ σ
€σ
σ σ
£σ
©σ
£σ
€σ
σ
σ σ
σ
σ
¦σ
σ
σ
σ
σ
σ
’σ σ
σ
σ
’σ
σ
σ
σ σ "],
"routeros": [".rsc"],
"ruby": [".rb", ".rbw"],
"spice": [".cir", ".inp"],
"smallbasic": [
".bas",
],
"skill": [".il", ".ils"],
"sql": [".sql"],
"text": [".txt", ".text"],
"xml": [".xml", ".tpy"],
"yaml": [".yml", ".yaml"],
"zig": [".zig", ".zon"],
"rust": [".rs"],
}
# Special tab names
class SpecialTabNames(enum.Enum):
Messages = "Message log"
FileExplorer = "File explorer"
# Global enumerations
class FileStatus(enum.Enum):
OK = 0
MODIFIED = 1
class FileType(enum.Enum):
Text = 0
Hex = 1
class CanSave:
YES = 0
NO = 1
class SearchResult(enum.Enum):
NOT_FOUND = None
FOUND = 1
CYCLED = 2
class WindowMode(enum.Enum):
THREE = 0
ONE = 1
class MainWindowSide(enum.Enum):
LEFT = 0
RIGHT = 1
class ReplType(enum.Enum):
SINGLE_LINE = 0
MULTI_LINE = 1
class ReplLanguage(enum.Enum):
Python = 0
Hy = 1
class Direction(enum.Enum):
LEFT = 0
RIGHT = 1
class SpinDirection(enum.Enum):
CLOCKWISE = 0
COUNTER_CLOCKWISE = 1
class MessageType(enum.Enum):
ERROR = 0
WARNING = 1
SUCCESS = 2
DIFF_UNIQUE_1 = 3
DIFF_UNIQUE_2 = 4
DIFF_SIMILAR = 5
class HexButtonFocus(enum.Enum):
NONE = 0
TAB = 1
WINDOW = 2
class NodeDisplayType(enum.Enum):
DOCUMENT = 0
TREE = 1
class TreeDisplayType(enum.Enum):
NODES = 0
FILES = 1
FILES_WITH_LINES = 2
class DialogResult(enum.Enum):
Ok = 0
Cancel = 1
Yes = 2
No = 3
Quit = 4
Close = 5
Restore = 6
SaveAllAndQuit = 7
SaveAndClose = 8
SaveAndRestore = 9
SwitchToLargestWindow = 10
RecycleBin = 11
PermanentDelete = 12
class FormatterType(enum.Enum):
JSON = enum.auto()
XML = enum.auto()
HTML_Python_Standard_Library = enum.auto()
HTML_BeautifulSoup = enum.auto()
# Default user configuration file content
default_config_file_content = '''## FILE DESCRIPTION:
## Normal module with a special name that holds custom user functions/variables.
## To manipulate the editors/windows, take a look at the QScintilla details at:
## http://pyqt.sourceforge.net/Docs/QScintilla2
##
## NOTES:
## Built-in special function escape sequence: "lit#"
## (prepend it to escape built-ins like: cmain, set_all_text, lines, ...)
\'\'\'
# These imports are optional as they are already imported
# by the REPL, I added them here for clarity.
import data
import functions
import settings
# Imported for less typing
from gui import *
# Initialization function that gets executed only ONCE at startup
def first_scan():
pass
# Example of got to customize the menu font and menu font scaling
#data.custom_menu_scale = 25
#data.custom_menu_font = ("Segoe UI", 10, qt.QFont.Weight.Bold)
#data.custom_menu_scale = None
#data.custom_menu_font = None
def trim_whitespace():
"""
Remove whitespace from back of every line in the main document
"""
ll = []
tab = form.get_tab_by_indication()
for line in tab.line_list:
ll.append(line.rstrip())
tab.line_list = ll
trim_whitespace.autocompletion = "trim_whitespace()"
def align_assignments():
"""
Align any assignments in the selected lines
"""
tab = form.get_tab_by_indication()
new_lines = []
selected_text = tab.selectedText()
max_left_size = 0
for line in selected_text.split('\n'):
if '=' in line and line.count('=') == 1:
split_line = line.split('=')
left_size = len(split_line[0].rstrip())
if left_size > max_left_size:
max_left_size = left_size
new_lines.append(split_line)
else:
new_lines.append(line)
for i in range(len(new_lines)):
if isinstance(new_lines[i], list):
new_lines[i] = "{} = {}".format(
new_lines[i][0].rstrip().ljust(max_left_size, ' '),
new_lines[i][1].strip()
)
tab.replaceSelectedText('\n'.join(new_lines))
align_assignments.autocompletion = "align_assignments()"
# Example function definition with defined autocompletion string
def delete_files_in_dir(extension=None, directory=None):
# Delete all files with the selected file extension from the directory
if isinstance(extension, str) == False:
print("File extension argument must be a string!")
return
if directory == None:
directory = os.getcwd()
elif os.path.isdir(directory) == False:
return
print("Deleting '{:s}' files in:".format(extension))
print(directory)
for file in os.listdir(directory):
file_extension = os.path.splitext(file)[1].lower()
if file_extension == extension or file_extension == "." + extension:
os.remove(os.path.join(directory, file))
print(" - deleted file: {:s}".format(file))
print("DONE")
delete_files_in_dir.autocompletion = "delete_files_in_dir(extension=\"\", directory=None)"
\'\'\'
'''