aboutsummaryrefslogtreecommitdiff
path: root/bcst/theme.py
diff options
context:
space:
mode:
Diffstat (limited to 'bcst/theme.py')
-rw-r--r--bcst/theme.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/bcst/theme.py b/bcst/theme.py
index 58e7902..9bdd956 100644
--- a/bcst/theme.py
+++ b/bcst/theme.py
@@ -26,11 +26,10 @@ def get_theme_path(name):
class Theme:
- def __init__(self, name, resource_data):
+ def __init__(self, name):
self.theme_path=get_theme_path(name)
- res=Resource(self.theme_path+"/resources.json")
- self.data=res.json
- self.data.update(resource_data)
+ self.res_path=self.theme_path+"/resources.json"
+ self.data=Resource(self.res_path).json
# Read theme
try:
with open(self.theme_path+"/index.html",'r') as f:
@@ -39,6 +38,15 @@ class Theme:
print("Unable to found "+resource)
exit(1)
+ def update_resource(self,resource_path):
+ r=Resource(resource_path)
+ self.data.update(r.json)
+
+
+ def extract(self, dest):
+ with open(dest, "w") as resFile:
+ resFile.write(self.data.data)
+
def deploy(self, dest_path):
copytree(self.theme_path, dest_path, dirs_exist_ok=True,ignore=ignore_patterns("*.json","index.html"))