startup logo added and dynamic weather layout

This commit is contained in:
Your Name 2022-01-20 18:58:27 +00:00
parent 77fb96e4dc
commit 9056c958e5
2 changed files with 27 additions and 13 deletions

View File

@ -44,7 +44,7 @@ ALLOWED_EXTENSIONS = {'csv', 'png'}
ticker = pexpect.spawn("sudo -E python3 stockTicker.py")
ticker.sendline('*') # run by default
time.sleep(1)
time.sleep(8)
ticker.sendline('A') # run by default
def allowed_file(filename):

View File

@ -1903,14 +1903,14 @@ class StockTicker():
img = img.crop((0,0,x_offset +wdir_img.size[0] + 4 ,32))
img.paste(location_img, (5,0))
img.paste(feels_img, (location_img.size[0] + 10, 0))
img.paste(date_img, (location_img.size[0] + feels_img.size[0] + 15, 0))
img = img.crop((0,0,max(x_offset +wdir_img.size[0] + 4, location_img.size[0] + feels_img.size[0] + 15 + date_img.size[0]) ,32))
imgs.append(img)
imgs.append(self.blank)
except Exception as e:
@ -1921,7 +1921,7 @@ class StockTicker():
self.logf.write('. line: ' + str(exc_tb.tb_lineno))
self.logf.write('. type: ' + str(exc_type))
self.logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
raise e
return self.stitchImage(imgs)
@ -2308,12 +2308,24 @@ class StockTicker():
img.paste(location_img, (0,0))
x_offset = location_img.size[0]+2
img.paste(weather_img, (0,12))
img.paste(temp_img, (34,9))
img.paste(deg_img, (55, 8))
img.paste(min_img, (61, 10))
img.paste(main_img, (31, 26))
img.paste(max_img, (61, 18))
img.paste(weather_img, (5,9))
x_offset = 5 + weather_img.size[0] + 1
img.paste(main_img, (x_offset, 26))
img.paste(temp_img, (x_offset + main_img.size[0]//2 - temp_img.size[0]//2,9))
img.paste(deg_img, (x_offset + main_img.size[0]//2 - temp_img.size[0]//2 + temp_img.size[0], 8))
x_offset += max( main_img.size[0], temp_img.size[0] + deg_img.size[0])
img.paste(min_img, (x_offset - 1, 12))
img.paste(max_img, (x_offset - 1, 21))
x_offset += max(min_img.size[0], max_img.size[0]) + 2
img.paste(date_img, (x_offset, 1))
x_offset += date_img.size[0]+2
@ -2348,6 +2360,8 @@ class StockTicker():
x_offset+= vis_img.size[0]+2
img.paste(vtext_img, (x_offset, 1))
x_offset += vtext_img.size[0] +2
crop_x = x_offset
#img.paste(uv_img, ( 96, 0))
#img.paste(utext_img, (109, 0))
#img.paste(wind_img, (96,0))
@ -2391,9 +2405,9 @@ class StockTicker():
img.paste(min_img, (x_offset + 25, 10))
img.paste(max_img, (x_offset + 25, 18))
x_offset += 40
x_offset += 43
img1 = img.crop((0,0,x_offset ,32))
img1 = img.crop((0,0,max(x_offset, crop_x) ,32))
imgs.append(img1)
imgs.append(self.blank)
# add the image text
@ -2721,7 +2735,7 @@ if __name__ == '__main__':
#stock_ticker.process_msg('G')
#stock_ticker.process_msg('f')
#stock_ticker.process_msg('W')
stock_ticker.process_msg('A')
#stock_ticker.process_msg('A')