From 1b71cabd14f0ec5590fde56254a4d019238a8968 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Mon, 28 Feb 2022 12:01:06 -0600 Subject: [PATCH] code format --- MagTag_Webb_Telescope_Status/code.py | 42 ++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/MagTag_Webb_Telescope_Status/code.py b/MagTag_Webb_Telescope_Status/code.py index 7eacec50e..1ab136584 100644 --- a/MagTag_Webb_Telescope_Status/code.py +++ b/MagTag_Webb_Telescope_Status/code.py @@ -31,7 +31,9 @@ # SLEEP_TIME = 60 * 60 * 24 # seconds # URL to fetch the data from -JSON_GET_URL = "https://jwst.nasa.gov/content/webbLaunch/flightCurrentState2.0.json?unique={}" +JSON_GET_URL = ( + "https://jwst.nasa.gov/content/webbLaunch/flightCurrentState2.0.json?unique={}" +) # Whether to fetch live data or use cached TEST_RUN = True @@ -99,11 +101,17 @@ def make_name_text(text, anchor_point, anchored_position, bg_color=LBL_BACKGROUN padding_right=4, padding_bottom=3, padding_top=3, - line_spacing=1.0 + line_spacing=1.0, ) -def make_value_text(anchor_point, anchored_position, custom_font=True, bg_color=0x000000, font_color=0xFFFFF): +def make_value_text( + anchor_point, + anchored_position, + custom_font=True, + bg_color=0x000000, + font_color=0xFFFFF, +): """ Create label object for showing data values. @@ -117,9 +125,17 @@ def make_value_text(anchor_point, anchored_position, custom_font=True, bg_color= else: _font = terminalio.FONT return bitmap_label.Label( - _font, text="", anchor_point=anchor_point, anchored_position=anchored_position, - line_spacing=1.0, padding_top=3, background_color=bg_color, color=font_color, - padding_right=4, padding_left=4, padding_bottom=4 + _font, + text="", + anchor_point=anchor_point, + anchored_position=anchored_position, + line_spacing=1.0, + padding_top=3, + background_color=bg_color, + color=font_color, + padding_right=4, + padding_left=4, + padding_bottom=4, ) @@ -132,11 +148,17 @@ def make_value_text(anchor_point, anchored_position, custom_font=True, bg_color= # value text initializations # top left. Hot side | Cold side temperature values -top_left_value = make_value_text(anchor_point=(0, 0), anchored_position=(0, 6), bg_color=0xBBBBBB, font_color=0x000000) +top_left_value = make_value_text( + anchor_point=(0, 0), + anchored_position=(0, 6), + bg_color=0xBBBBBB, + font_color=0x000000, +) # top right. Instrument temperature values top_right_value = make_value_text( - anchor_point=(1.0, 0), anchored_position=(display.width - 6, 6), + anchor_point=(1.0, 0), + anchored_position=(display.width - 6, 6), ) # bottom left timestamp @@ -159,7 +181,9 @@ def make_value_text(anchor_point, anchored_position, custom_font=True, bg_color= # center. Instrument temp labels inst_temp_labels = "NIRCam Bench\nNIRSpec Bench\nFGS Bench\nMIRI Bench\nFSM" top_center_name = make_name_text( - text=inst_temp_labels, anchor_point=(1.0, 0.0), anchored_position=(top_right_value.x - 2, 6) + text=inst_temp_labels, + anchor_point=(1.0, 0.0), + anchored_position=(top_right_value.x - 2, 6), ) main_group.append(middle_left_name)