fixing weather?

This commit is contained in:
Remy Moll 2020-11-06 20:28:51 +01:00
parent 37deb0d01b
commit 9d887930da
5 changed files with 18 additions and 21 deletions

View File

@ -56,6 +56,7 @@ class UnicornHat(object):
GPIO.output(self.PINS_DAT[0], b1 & 0b10000000) GPIO.output(self.PINS_DAT[0], b1 & 0b10000000)
GPIO.output(self.PINS_DAT[1], b2 & 0b10000000) GPIO.output(self.PINS_DAT[1], b2 & 0b10000000)
GPIO.output(self.PIN_CLK, GPIO.HIGH) GPIO.output(self.PIN_CLK, GPIO.HIGH)
b1 <<= 1 b1 <<= 1
b2 <<= 1 b2 <<= 1
#time.sleep(0.00000001) #time.sleep(0.00000001)
@ -83,21 +84,19 @@ class UnicornHat(object):
def set_pixel(self, x, y, r, g, b): def set_pixel(self, x, y, r, g, b):
"""Set a single pixel to RGB colour. """Set a single pixel to RGB colour.
:param x: Horizontal position from 0 to width :param x: Horizontal position from 0 to width
:param y: Veritcal position from 0 to height :param y: Vertical position from 0 to height
:param r: Amount of red from 0 to 255 :param r: Amount of red from 0 to 255
:param g: Amount of green from 0 to 255 :param g: Amount of green from 0 to 255
:param b: Amount of blue from 0 to 255 :param b: Amount of blue from 0 to 255
""" """
self.buffer[y][x] = r, g, b self.buffer[y][x] = r, g, b
def set_matrix(self, matrix): def set_matrix(self, matrix):
"""Sets a height x width matrix directly""" """Sets a height x width matrix directly"""
self.reset_clock() self.reset_clock()
self.buffer = matrix self.buffer = matrix
self.show() self.show()
def set_pixel_hsv(self, x, y, h, s=1.0, v=1.0): def set_pixel_hsv(self, x, y, h, s=1.0, v=1.0):
"""set a single pixel to a colour using HSV. """set a single pixel to a colour using HSV.
:param x: Horizontal position from 0 to 15 :param x: Horizontal position from 0 to 15
@ -124,7 +123,6 @@ class UnicornHat(object):
def get_shape(self): def get_shape(self):
"""Return the shape (width, height) of the display.""" """Return the shape (width, height) of the display."""
return self.WIDTH, self.HEIGHT return self.WIDTH, self.HEIGHT
def clear(self): def clear(self):

View File

@ -11,14 +11,14 @@ except ImportError:
class OutputHandler(): class OutputHandler():
def __init__(self, width, height): def __init__(self, width, height, primary = [200, 200, 200], secondary = [10, 200, 10], error = [200, 10, 10]):
"""width is presumed to be larger than height""" """width is presumed to be larger than height"""
self.width = width self.width = width
self.height = height self.height = height
self.output = HAT.UnicornHat(width, height) self.output = HAT.UnicornHat(width, height)
self.primary = [200, 200, 200] self.primary = primary
self.secondary = [10, 200, 10] self.secondary = secondary
self.red = [200, 10, 10] self.red = error

View File

@ -53,6 +53,7 @@ class ClockFace(object):
def set_face(self, weather): def set_face(self, weather):
"""""" """"""
self.weather = weather self.weather = weather
print("WEATHER: ", weather)
self.run(self.IO.clock_face,(weather,)) self.run(self.IO.clock_face,(weather,))

View File

@ -10,8 +10,8 @@ app = dash.Dash(__name__, external_stylesheets=ex_css)
card_main = dbc.Card( card_main = dbc.Card(
[ [
dbc.CardImg(src="/assets/ball_of_sun.jpg", top=True, bottom=False, #dbc.CardImg(src="/assets/ball_of_sun.jpg", top=True, bottom=False,
title="Image by Kevin Dinkel", alt='Learn Dash Bootstrap Card Component'), # title="Image by Kevin Dinkel", alt='Learn Dash Bootstrap Card Component'),
dbc.CardBody( dbc.CardBody(
[ [
html.H4("Learn Dash with Charming Data", className="card-title"), html.H4("Learn Dash with Charming Data", className="card-title"),
@ -47,9 +47,6 @@ card_question = dbc.Card(
) )
today = datetime.date.today().strftime("%d.%m.%Y") today = datetime.date.today().strftime("%d.%m.%Y")
tag = ["Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"][datetime.datetime.today().weekday()] tag = ["Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"][datetime.datetime.today().weekday()]
@ -59,24 +56,24 @@ string_header = tag + ", der " + today
app.layout = html.Div([ app.layout = html.Div([
html.Header(children = [ html.Header(children = [
html.H1(string_header) html.H1(string_header)
]), ],),
html.Div( html.Div(
className = "content", className = "content",
style = {"padding-top" : "32em"}, style = {"padding-top" : "32em"},
children = [ children = [
dbc.Row([dbc.Col(card_main, width=3), # dbc.Row([dbc.Col(card_main, width=3),
dbc.Col(card_question, width=3)], justify="around"), # justify="start", "center", "end", "between", "around" # dbc.Col(card_question, width=3)], justify="around"), # justify="start", "center", "end", "between", "around"
# dbc.CardGroup([card_main, card_question, card_graph]) # attaches cards with equal width and height columns # dbc.CardGroup([card_main, card_question, card_graph]) # attaches cards with equal width and height columns
# dbc.CardDeck([card_main, card_question, card_graph]) # same as CardGroup but with gutter in between cards # dbc.CardDeck([card_main, card_question, card_graph]) # same as CardGroup but with gutter in between cards
# dbc.CardColumns([ # Cards organised into Masonry-like columns dbc.CardColumns([ # Cards organised into Masonry-like columns
# card_main, card_main,
# card_question, card_question,card_question,card_question,card_question,
# card_graph, # card_graph,
# card_question, # card_question,
# card_question, # card_question,
# ]) ])
]) ])
]) ])
@ -85,3 +82,4 @@ app.layout = html.Div([
if __name__ == "__main__": if __name__ == "__main__":
app.run_server(host="0.0.0.0") app.run_server(host="0.0.0.0")
5

View File

@ -1,4 +1,4 @@
header { div.header {
position: fixed; position: fixed;
width: 100%; width: 100%;
height: var(--heading-height); height: var(--heading-height);