@@ -38,12 +38,8 @@ def set_viewport_size(self, driver: webdriver.Chrome) -> None:
38
38
inner_height = int (html .get_attribute ("clientHeight" ) or "0" )
39
39
40
40
# "Internal width you want to set+Set "outer frame width" to window size
41
- target_width = self .cfg .IMAGE_WIDTH + (
42
- current_window_size ["width" ] - inner_width
43
- )
44
- target_height = self .cfg .IMAGE_HEIGHT + (
45
- current_window_size ["height" ] - inner_height
46
- )
41
+ target_width = self .cfg .IMAGE_WIDTH + (current_window_size ["width" ] - inner_width )
42
+ target_height = self .cfg .IMAGE_HEIGHT + (current_window_size ["height" ] - inner_height )
47
43
48
44
driver .set_window_rect (width = target_width , height = target_height )
49
45
@@ -60,9 +56,7 @@ def get_screenshot(self, path_to_server_image: str) -> None:
60
56
# Try to automatically locate chromedriver, source: https://github.com/fdmarcin/MagInkDash-updated
61
57
try :
62
58
chromedriver_path = (
63
- subprocess .check_output (["which" , "chromedriver" ])
64
- .decode ("utf-8" )
65
- .strip ()
59
+ subprocess .check_output (["which" , "chromedriver" ]).decode ("utf-8" ).strip ()
66
60
)
67
61
self .logger .info (f"Found chromedriver at: { chromedriver_path } " )
68
62
except (subprocess .SubprocessError , FileNotFoundError ):
@@ -77,9 +71,7 @@ def get_screenshot(self, path_to_server_image: str) -> None:
77
71
for path in possible_paths :
78
72
if os .path .exists (path ) and os .access (path , os .X_OK ):
79
73
chromedriver_path = path
80
- self .logger .info (
81
- f"Found chromedriver at default location: { chromedriver_path } "
82
- )
74
+ self .logger .info (f"Found chromedriver at default location: { chromedriver_path } " )
83
75
break
84
76
85
77
if not chromedriver_path :
@@ -99,9 +91,7 @@ def get_screenshot(self, path_to_server_image: str) -> None:
99
91
driver .get_screenshot_as_file (self .currPath + "/dashboard.png" )
100
92
driver .get_screenshot_as_file (path_to_server_image )
101
93
driver .quit () # Make sure to quit the driver to free resources
102
- self .logger .debug (
103
- f"Screenshot captured and saved to file { path_to_server_image } ."
104
- )
94
+ self .logger .debug (f"Screenshot captured and saved to file { path_to_server_image } ." )
105
95
except Exception as e :
106
96
self .logger .error (f"Error taking screenshot: { str (e )} " )
107
97
raise
@@ -140,15 +130,11 @@ def process_inputs(
140
130
# Some clients set the location to empty string
141
131
if "location" in event and event ["location" ] != "" :
142
132
cal_events_text += (
143
- '<span class="event-location"> at '
144
- + event ["location" ]
145
- + "</span>"
133
+ '<span class="event-location"> at ' + event ["location" ] + "</span>"
146
134
)
147
135
if self .cfg .SHOW_CALENDAR_NAME and event ["calendarName" ] is not None :
148
136
cal_events_text += (
149
- '<span class="event-calendar-name"> ('
150
- + event ["calendarName" ]
151
- + ")</span>"
137
+ '<span class="event-calendar-name"> (' + event ["calendarName" ] + ")</span>"
152
138
)
153
139
cal_events_text += "</div>\n "
154
140
if d == current_date :
@@ -172,9 +158,7 @@ def process_inputs(
172
158
if self .cfg .SHOW_ADDITIONAL_WEATHER :
173
159
additional_infos = []
174
160
if round (current_weather ["temp" ]) != round (current_weather ["feels_like" ]):
175
- additional_infos .append (
176
- f"Feels Like { round (current_weather ['feels_like' ])} °"
177
- )
161
+ additional_infos .append (f"Feels Like { round (current_weather ['feels_like' ])} °" )
178
162
if (current_weather ["sunrise" ] < current_weather ["dt" ]) and (
179
163
current_weather ["dt" ] < current_weather ["sunset" ]
180
164
):
@@ -197,9 +181,7 @@ def process_inputs(
197
181
cal_days = cal_events_days ,
198
182
cal_days_events = cal_events_list ,
199
183
# I'm choosing to show the forecast for the next hour instead of the current weather
200
- current_weather_text = string .capwords (
201
- current_weather ["weather" ][0 ]["description" ]
202
- ),
184
+ current_weather_text = string .capwords (current_weather ["weather" ][0 ]["description" ]),
203
185
current_weather_id = current_weather ["weather" ][0 ]["id" ],
204
186
current_weather_temp = f"{ round (current_weather ['temp' ])} °" ,
205
187
current_weather_add_info = weather_add_info ,
@@ -242,9 +224,7 @@ def get_short_time(cls, datetimeObj: dt.datetime, is24hour: bool = False) -> str
242
224
return datetime_str
243
225
244
226
@classmethod
245
- def extend_list (
246
- cls , my_list : List [str ], new_length : int , default_value : str
247
- ) -> None :
227
+ def extend_list (cls , my_list : List [str ], new_length : int , default_value : str ) -> None :
248
228
return my_list .extend ([default_value ] * (new_length - len (my_list )))
249
229
250
230
@classmethod
0 commit comments