diff --git a/.gitignore b/.gitignore
old mode 100644
new mode 100755
diff --git a/notiframe/NotiFrame.py b/notiframe/NotiFrame.py
old mode 100644
new mode 100755
index c2def83..f2246b7
--- a/notiframe/NotiFrame.py
+++ b/notiframe/NotiFrame.py
@@ -45,11 +45,11 @@ config2 = {'resWidth': 640, 'resHeight': 384, 'cellsWidth': 3, 'cellsHeight': 3
]}
#print(toml.dumps(config))
-print(config)
-print(config2)
+#print(config)
+#print(config2)
-cwidth = int(round(config['resWidth']/config['cellsWidth']))
-cheight = int(round(config['resHeight']/config['cellsHeight']))
+cwidth = int(round(int(config['resWidth'])/int(config['cellsWidth'])))
+cheight = int(round(int(config['resHeight'])/int(config['cellsHeight'])))
image_yellow = Image.new('1', (config['resWidth'], config['resHeight']), 255) # 255: clear the frame
draw_yellow = ImageDraw.Draw(image_yellow)
@@ -91,18 +91,18 @@ def drawWidget(w):
image_yellow.paste(w.image_yellow, (coordX, coordY))
def render(index):
- if index is not 0:
+ if index is not 0:
for widg in widgetList:
widg.updateWidget()
- draw_black.rectangle(xy=((0,0), image_black.size), fill=255)
- draw_yellow.rectangle(xy=((0,0), image_yellow.size), fill=255)
- for widg in widgetList:
- drawWidget(widg)
- if not testMode:
- epd.display_frame(epd.get_frame_buffer(image_black),epd.get_frame_buffer(image_yellow))
- else:
- image_black.save(os.path.join(mydir, 'test/imgBlack.bmp'))
- image_yellow.save(os.path.join(mydir, 'test/imgYellow.bmp'))
+ draw_black.rectangle(xy=((0,0), image_black.size), fill=255)
+ draw_yellow.rectangle(xy=((0,0), image_yellow.size), fill=255)
+ for widg in widgetList:
+ drawWidget(widg)
+ if not testMode:
+ epd.display_frame(epd.get_frame_buffer(image_black),epd.get_frame_buffer(image_yellow))
+ else:
+ image_black.save(os.path.join(mydir, 'test/imgBlack.bmp'))
+ image_yellow.save(os.path.join(mydir, 'test/imgYellow.bmp'))
widgetList = initWidgets()
i = 0
diff --git a/notiframe/config.toml b/notiframe/config.toml
old mode 100644
new mode 100755
index 0a8c057..ee9157b
--- a/notiframe/config.toml
+++ b/notiframe/config.toml
@@ -1,16 +1,16 @@
-cellsHeight = 3
resHeight = 384
+cellsHeight = 3
resWidth = 640
cellsWidth = 3
[[widgets]]
+bwStyle = "mono"
+filename = "forest.jpg"
width = 3
posX = 0
posY = 0
scaleMode = "fill"
-bwStyle = "mono"
-type = "image"
-filename = "forest.jpg"
height = 3
+type = "image"
[[widgets]]
list = "Plans"
@@ -38,3 +38,4 @@ board = "Organisation"
posX = 1
posY = 2
type = "trello"
+
diff --git a/notiframe/drivers/__init__.py b/notiframe/drivers/__init__.py
old mode 100644
new mode 100755
diff --git a/notiframe/drivers/epd7in5b.py b/notiframe/drivers/epd7in5b.py
old mode 100644
new mode 100755
diff --git a/notiframe/drivers/epdif.py b/notiframe/drivers/epdif.py
old mode 100644
new mode 100755
diff --git a/notiframe/test/card_image.bmp b/notiframe/test/card_image.bmp
old mode 100644
new mode 100755
diff --git a/notiframe/test/greyscale.bmp b/notiframe/test/greyscale.bmp
old mode 100644
new mode 100755
diff --git a/notiframe/test/imgBlack.bmp b/notiframe/test/imgBlack.bmp
index afb7a94..fe5d3d9 100644
Binary files a/notiframe/test/imgBlack.bmp and b/notiframe/test/imgBlack.bmp differ
diff --git a/notiframe/test/imgBlackWidget.bmp b/notiframe/test/imgBlackWidget.bmp
old mode 100644
new mode 100755
diff --git a/notiframe/test/imgYellow.bmp b/notiframe/test/imgYellow.bmp
old mode 100644
new mode 100755
diff --git a/notiframe/test/imgYellowWidget.bmp b/notiframe/test/imgYellowWidget.bmp
old mode 100644
new mode 100755
diff --git a/notiframe/test/mask.bmp b/notiframe/test/mask.bmp
old mode 100644
new mode 100755
diff --git a/notiframe/webserver/templates/home.html b/notiframe/webserver/templates/home.html
new file mode 100644
index 0000000..0c3e4ae
--- /dev/null
+++ b/notiframe/webserver/templates/home.html
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/notiframe/webserver/templates/style.css b/notiframe/webserver/templates/style.css
new file mode 100644
index 0000000..e69de29
diff --git a/notiframe/webserver/webserver.py b/notiframe/webserver/webserver.py
new file mode 100644
index 0000000..ab29276
--- /dev/null
+++ b/notiframe/webserver/webserver.py
@@ -0,0 +1,97 @@
+from flask import Flask, render_template, request, redirect, url_for
+import toml
+import os
+
+app = Flask(__name__)
+
+mydir = os.path.dirname(os.path.abspath(__file__))
+#print(mydir)
+mydir = os.path.join(mydir, '../')
+#print(mydir)
+
+essentials = {'type': None, 'height': None, 'width': None, 'posX': None, 'posY': None}
+trello_options = {'board': None, 'list': None}
+image_options = {'filename': None, 'scaleMode': None, 'bwStyle': None}
+
+def convert(input):
+ if isinstance(input, dict):
+ return dict((convert(key), convert(value)) for key, value in input.iteritems())
+ elif isinstance(input, list):
+ return [convert(element) for element in input]
+ elif isinstance(input, unicode):
+ return input.encode('utf-8')
+ else:
+ return input
+
+#HOMEPAGE
+@app.route('/home', methods=['GET', 'POST'])
+def home():
+ config = read_config()
+ widgLists, sysList = prep_dict_for_web(config)
+ if request.method == 'POST':
+ #update system variables
+ for key in sysList:
+ if request.form[key]:
+ if isInt(request.form[key]):
+ #print(request.form[key] + " is int")
+ sysList[key] = int(request.form[key])
+ else:
+ sysList[key] = request.form[key]
+ #update widget variables
+ #for i in range(len(widgLists)):
+ # for key in widgLists[i]:
+ # if request.form[key+str(i)]:
+ # widgLists[i][key] = request.form[key+str(i)]
+ for i in range(len(widgLists)):
+ for key in widgLists[i]:
+ #print(request.form[key+str(i)])
+ if isInt(request.form[key+str(i)]):
+ #print(request.form[key+str(i)] + " is int")
+ widgLists[i][key] = int(request.form[key+str(i)])
+ else:
+ widgLists[i][key] = request.form[key+str(i)]
+
+ #print(widgLists)
+ #print(sysList)
+
+ update_config(widgLists, sysList)
+
+ return render_template('home.html', title='Overview', widgLists=widgLists, sysList=sysList)
+
+def isInt(s):
+ try:
+ int(s)
+ return True
+ except ValueError:
+ return False
+
+def prep_dict_for_web(config):
+ widgLists = config['widgets'] #list of dicts
+ sysList = {} #dict
+ for key in config:
+ if key != 'widgets':
+ sysList[key] = config[key]
+ return widgLists, sysList
+
+def read_config():
+ uni_config = toml.load(os.path.join(mydir, 'config.toml'))
+ config = convert(uni_config)
+ #print(config)
+ #config = {'widgets': [
+ #{'width': 3, 'posX': 0, 'posY': 0, 'scaleMode': 'fill', 'bwStyle': 'mono', 'type': 'image', 'filename': 'forest.jpg', 'height': 3},
+ #{'list': 'Plans', 'height': 3, 'width': 1, 'board': 'Organisation', 'posX': 0, 'posY': 0, 'type': 'trello'},
+ #{'list': 'To Do:', 'height': 3, 'width': 2, 'board': 'E-paper', 'posX': 1, 'posY': 0, 'type': 'trello'}
+ #], 'cellsHeight': 3, 'resHeight': 384, 'resWidth': 640, 'cellsWidth': 3}
+ return config
+
+def update_config(widgLists, sysList):
+ config = {'widgets': widgLists}
+ for key in sysList:
+ config[key] = sysList[key]
+ convert(config)
+ path = os.path.join(mydir, 'config.toml')
+ with open(path, "w+") as config_file:
+ config_file.write(toml.dumps(config))
+
+if __name__ == '__main__':
+ app.run(debug=True,host='0.0.0.0')
\ No newline at end of file
diff --git a/notiframe/widgets/__init__.py b/notiframe/widgets/__init__.py
old mode 100644
new mode 100755
diff --git a/notiframe/widgets/resources/fonts/DejaVuSans.ttf b/notiframe/widgets/resources/fonts/DejaVuSans.ttf
old mode 100644
new mode 100755
diff --git a/notiframe/widgets/resources/fonts/DejaVuSansMono.ttf b/notiframe/widgets/resources/fonts/DejaVuSansMono.ttf
old mode 100644
new mode 100755
diff --git a/notiframe/widgets/resources/fonts/FreeMonoBold.ttf b/notiframe/widgets/resources/fonts/FreeMonoBold.ttf
old mode 100644
new mode 100755
diff --git a/notiframe/widgets/resources/images/calvin.jpg b/notiframe/widgets/resources/images/calvin.jpg
old mode 100644
new mode 100755
diff --git a/notiframe/widgets/resources/images/folk.png b/notiframe/widgets/resources/images/folk.png
old mode 100644
new mode 100755
diff --git a/notiframe/widgets/resources/images/forest.jpg b/notiframe/widgets/resources/images/forest.jpg
old mode 100644
new mode 100755
diff --git a/notiframe/widgets/resources/images/leaves.jpg b/notiframe/widgets/resources/images/leaves.jpg
old mode 100644
new mode 100755
diff --git a/notiframe/widgets/resources/images/onyxbook.jpg b/notiframe/widgets/resources/images/onyxbook.jpg
old mode 100644
new mode 100755
diff --git a/notiframe/widgets/resources/images/staff.png b/notiframe/widgets/resources/images/staff.png
old mode 100644
new mode 100755
diff --git a/notiframe/widgets/resources/images/steps.jpg b/notiframe/widgets/resources/images/steps.jpg
old mode 100644
new mode 100755
diff --git a/notiframe/widgets/widget.py b/notiframe/widgets/widget.py
old mode 100644
new mode 100755
diff --git a/readme.md b/readme.md
old mode 100644
new mode 100755