This repository was archived by the owner on Feb 19, 2020. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathparser.py
More file actions
105 lines (100 loc) · 4.25 KB
/
Copy pathparser.py
File metadata and controls
105 lines (100 loc) · 4.25 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
from curses import *
import os.path
from os import *
import io
keyMaps = {
}
fileColors = {
}
fileIcons = {
}
openFiles = {
}
cwd = getcwd()
home = os.path.expanduser('~')
chdir(home)
if os.path.isfile(home + '/.config/pluto/config'):
chdir('.config/pluto')
with io.open('config', 'r') as config:
for line in config:
command = line.split(' ')[0]
if command[0] == "#" or line.isspace() or line == "\n" or line == "":
pass
elif command == "dir-slash":
if line.split(' ')[1].rstrip() == "true":
dirSlash = True
elif line.split(' ')[1].rstrip == "false":
dirSlash = False
else:
pass
elif command == "select-type":
if line.split(' ')[1].rstrip() == 'reverse':
selType = A_REVERSE
elif line.split(' ')[1].rstrip() == 'dim':
selType = A_DIM
elif line.split(' ')[1].rstrip() == "underline":
selType = A_UNDERLINE
else:
pass
elif command == "bar":
if line.split(' ')[1].rstrip() == 'true':
barEnable = True
elif line.split(' ')[1].rstrip() == 'false':
barEnable = False
else:
pass
elif command == "side-offset":
sideOffset = int(line.split(' ')[1].rstrip())
elif command == "top-offset":
topOffset = int(line.split(' ')[1].rstrip())
elif command == "bottom-offset":
bottomOffset = int(line.split(' ')[1].rstrip())
elif command == "bar-locale":
barLocale = str(line.split(' ')[1].rstrip())
elif command == "barx":
barX = int(line.split(' ')[1].rstrip())
elif command == "bary":
barY = int(line.split(' ')[1].rstrip())
elif command == "bar-color":
barColor = int(line.split(' ')[1].rstrip())
elif command == "bar-format":
if line.split(' ')[1].rstrip() == "reverse":
barFormat = A_REVERSE
elif line.split(' ')[1].rstrip() == "bold":
barFormat = A_BOLD
elif line.split(' ')[1].rstrip() == "dim":
barFormat = A_DIM
elif line.split(' ')[1].rstrip() == "none":
barFormat = A_NORMAL
elif command == "color":
fileColors[line.split(' ')[1].rstrip()] = int(line.split(' ')[2].rstrip())
if len(line.split(' ')) == 4:
fileIcons[line.split(' ')[1].rstrip()] = str(line.split(' ')[3].rstrip())
elif command == "open":
openFiles[line.split(' ')[2].rstrip()] = [str(line.split(' ')[3].rstrip()), str(line.split(' ')[1].rstrip())]
elif command == "bind":
if line.split(' ')[1].rstrip() == "up":
keyMaps[line.split(' ')[2].rstrip()] = KEY_UP
elif line.split(' ')[1].rstrip() == "down":
keyMaps[line.split(' ')[2].rstrip()] = KEY_DOWN
elif line.split(' ')[1].rstrip() == "left":
keyMaps[line.split(' ')[2].rstrip()] = KEY_LEFT
elif line.split(' ')[1].rstrip() == "right":
keyMaps[line.split(' ')[2].rstrip()] = KEY_RIGHT
elif line.split(' ')[1].rstrip() == "space":
keyMaps[line.split(' ')[2].rstrip()] = ord(" ")
else:
keyMaps[line.split(' ')[2].rstrip()] = ord(str(line.split(' ')[1].rstrip()))
elif command == "arrow-select":
if line.split(' ')[1].rstrip() == "true":
arrowSelect = True
elif line.split(' ')[1].rstrip() == "false":
arrowSelect = False
elif command == "arrow":
arrow = line.split(' ')[1].rstrip()
elif command == "arrow-color":
arrowColor = int(line.split(' ')[1].rstrip())
else:
print("\033[31;1;3mError:\033[0m " + line.rstrip())
exit()
chdir(cwd)