Skip to content

Commit

Permalink
samsing brouk
Browse files Browse the repository at this point in the history
  • Loading branch information
lugipfupf committed Apr 17, 2024
1 parent bb70044 commit 05e462c
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 4 deletions.
3 changes: 2 additions & 1 deletion happyMirror/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
enabled_widgets = [
'hello',
'clock',
'quote'
'quote',
'simple_image'
]
2 changes: 0 additions & 2 deletions happyMirror/widgets/clock/clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ def __init__(self, config=None, secrets_config=None) -> None:
pass

def render(self) -> RenderResult:
# script_path = os.path.realpath(__file__).resolve('/static/js/clock.js')
script_path = os.path.dirname(os.path.relpath(__file__)) + '/static/js/clock.js'
print("script_path: ", script_path)

return {
'script': open(script_path, 'r').read(),
Expand Down
2 changes: 1 addition & 1 deletion happyMirror/widgets/quote/widget_secrets.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
api_key = 'secret'
api_key = 'yt1AXMJll6s0dFBRUZX/6A==xFhZOW7LWUzYeYn3'
1 change: 1 addition & 0 deletions happyMirror/widgets/simple_image/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# intentionally left empty
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions happyMirror/widgets/simple_image/simple_image.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import base64
import os

from flask import render_template_string

from happyMirror.render import BaseRenderer, RenderResult


class Renderer(BaseRenderer):
def render(self) -> RenderResult:
image = '/' + os.path.dirname(os.path.relpath(__file__)) + '/images/01.png'
print(image)

return {
'view': render_template_string('<img src="{{ image }}" />', image=image)
}


0 comments on commit 05e462c

Please sign in to comment.