forked from RandomComp/ROS_Old
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakeASCIICommandsToUGSM.py
More file actions
53 lines (32 loc) · 864 Bytes
/
makeASCIICommandsToUGSM.py
File metadata and controls
53 lines (32 loc) · 864 Bytes
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
from pyperclip import copy
commands = [
"help",
"echo",
"color",
"program",
"shutdown",
"reboot",
"clear"
]
maxCommandNameLength = len(max(commands, key=len))
result = f" UGSMGlyphCode commands[{len(commands)}][{maxCommandNameLength}] = {{"
for i, command in enumerate(commands):
result += "\n { "
if (len(command) == 0):
result += "0"
for j, char in enumerate(command):
result += str(ord(char) - 33 + 5)
if (j != (len(command) - 1)):
result += ", "
if (len(command) < maxCommandNameLength):
result += ", "
for j in range(maxCommandNameLength - len(command)):
result += "0"
if (j != (maxCommandNameLength - len(command) - 1)):
result += ", "
result += " }"
if (i != (len(commands) - 1)):
result += ","
result += "\n"
result += " };\n"
copy(result)