-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththemeParser.py
More file actions
36 lines (36 loc) · 1.14 KB
/
Copy paththemeParser.py
File metadata and controls
36 lines (36 loc) · 1.14 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
import os
class parse():
def __init__(self,className,theme_path):
try:
path = os.getcwd()
themeFile = open(theme_path,"r")
themeContent = themeFile.readlines()
themeFile.close()
except Exception as Error:
print ("Error While Loading Theme File : " + str(Error))
return
startRecording = 0
global style
style = ""
for i in themeContent:
if className in i:
startRecording = 1
if startRecording == 1:
startRecording = 2
continue
if startRecording == 2 and "]" in i:
break
if startRecording == 2:
style = style + "\n" + i
def getStyle(self):
return style
def getName(self,theme_type):
themeFile = open("Themes\\"+theme_type)
themeContent = themeFile.readlines()
# themeFile.close()
themeFile.close()
name = themeContent[0]
name = name.replace("#name ","")
name = name.replace("#name","")
name = name.replace("\n","")
return name