professional diaplay update
This commit is contained in:
parent
5867b862c6
commit
768cfa72d0
@ -1 +0,0 @@
|
||||
{"stocks": "03/08/2021 13:14:11", "crypto": "03/08/2021 13:14:13", "news": "03/08/2021 13:14:15", "weather": "03/08/2021 13:14:14", "forex": "03/08/2021 19:14:18", "sports": "03/08/2021 13:14:16"}
|
BIN
display_images/crypto_prof.ppm
Normal file
BIN
display_images/crypto_prof.ppm
Normal file
Binary file not shown.
BIN
display_images/forex_prof.ppm
Normal file
BIN
display_images/forex_prof.ppm
Normal file
Binary file not shown.
BIN
display_images/future_games.ppm
Normal file
BIN
display_images/future_games.ppm
Normal file
Binary file not shown.
BIN
display_images/live_games.ppm
Normal file
BIN
display_images/live_games.ppm
Normal file
Binary file not shown.
BIN
display_images/past_games.ppm
Normal file
BIN
display_images/past_games.ppm
Normal file
Binary file not shown.
BIN
display_images/stocks_prof.ppm
Normal file
BIN
display_images/stocks_prof.ppm
Normal file
Binary file not shown.
BIN
display_images/today_weather_prof.ppm
Normal file
BIN
display_images/today_weather_prof.ppm
Normal file
Binary file not shown.
BIN
feature_titles/__MACOSX/._sports_team_stats.png
Normal file
BIN
feature_titles/__MACOSX/._sports_team_stats.png
Normal file
Binary file not shown.
BIN
feature_titles/sports_future.png
Normal file
BIN
feature_titles/sports_future.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 404 B |
BIN
feature_titles/sports_live.png
Normal file
BIN
feature_titles/sports_live.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 343 B |
BIN
feature_titles/sports_past.png
Normal file
BIN
feature_titles/sports_past.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 408 B |
BIN
feature_titles/sports_team_stats.png
Normal file
BIN
feature_titles/sports_team_stats.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 486 B |
131
stockTicker.py
131
stockTicker.py
@ -163,11 +163,7 @@ class StockTicker():
|
||||
|
||||
time.sleep(self.delay)
|
||||
kill = self.checkKilled()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if kill: break
|
||||
return kill
|
||||
|
||||
@ -383,7 +379,7 @@ class StockTicker():
|
||||
|
||||
update_process.join()
|
||||
i+=1
|
||||
|
||||
|
||||
def scrollMultiple(self, animation = 'down'):
|
||||
# scrolls trhough all functions with animation. Updates functions and remakes images when each function not being dispplayed
|
||||
|
||||
@ -1935,8 +1931,119 @@ class StockTicker():
|
||||
if kill:
|
||||
break
|
||||
|
||||
|
||||
|
||||
def scrollProfessionalAnimated(self, options, animation = 'on'):
|
||||
|
||||
# scrolls trhough all functions with animation. Updates functions and remakes images when each function not being dispplayed
|
||||
|
||||
|
||||
print(options[0:2])
|
||||
self.updateMultiple(options[0:2])
|
||||
|
||||
kill = False
|
||||
i1 = 0 # keep track of which image we are displaying
|
||||
i2 = 1 # keep track of which image we are displaying
|
||||
|
||||
self.double_buffer = self.matrix.CreateFrameCanvas()
|
||||
update_process = Process(target = self.updateMultiple, args = ([options[(max(i1,i2)+1) % len(options)]],))
|
||||
update_process.start()
|
||||
|
||||
image1 = self.openImage('./display_images/' + options[i1 % len(options)] +'.ppm')
|
||||
image1 = image1.convert('RGB')
|
||||
|
||||
print(options[i2 % len(options)])
|
||||
image2 = self.openImage('./display_images/' + options[i2 % len(options)] +'.ppm')
|
||||
image2 = image2.convert('RGB')
|
||||
|
||||
|
||||
|
||||
offset_x1 = 0
|
||||
offset_x2 = 0
|
||||
|
||||
offset_y1 = -16
|
||||
offset_y2 = 32
|
||||
|
||||
frame_skip = int((1/15)/self.delay) #controls how fast gifs run
|
||||
self.frame = 0
|
||||
|
||||
img_width1, img_height1 = image1.size
|
||||
img_width2, img_height2 = image2.size
|
||||
kill = False
|
||||
|
||||
delay_t1 = 0.02
|
||||
delay_t2 = 0.025
|
||||
update_t1 = time.time()
|
||||
update_t2 = time.time()
|
||||
while True:
|
||||
|
||||
if offset_x1 < -(img_width1+1):
|
||||
|
||||
i1 = max(i1, i2) + 1
|
||||
offset_x1 = 0
|
||||
offset_y1 = -16
|
||||
update_process.join()
|
||||
update_process = Process(target = self.updateMultiple, args = ([options[(max(i1,i2)+1) % len(options)]],))
|
||||
update_process.start()
|
||||
image1 = self.openImage('./display_images/' + options[i1 % len(options)] +'.ppm')
|
||||
image1 = image1.convert('RGB')
|
||||
img_width1, img_height1 = image1.size
|
||||
|
||||
|
||||
|
||||
if offset_x2 < -(img_width2+1):
|
||||
|
||||
i2 = max(i1, i2) + 1
|
||||
offset_x2 = 0
|
||||
offset_y2 = 32
|
||||
update_process.join()
|
||||
update_process = Process(target = self.updateMultiple, args = ([options[(max(i1,i2)+1) % len(options)]],))
|
||||
update_process.start()
|
||||
image2 = self.openImage('./display_images/' + options[i2 % len(options)] +'.ppm')
|
||||
image2 = image2.convert('RGB')
|
||||
img_width2, img_height2 = image2.size
|
||||
|
||||
if time.time() - update_t1 > delay_t1:
|
||||
update_t1 = time.time()
|
||||
if offset_y1 < 0:
|
||||
offset_y1+=1
|
||||
else:
|
||||
offset_x1 -= 1
|
||||
|
||||
if time.time() - update_t2 > delay_t2:
|
||||
update_t2 = time.time()
|
||||
if offset_y2 > 16:
|
||||
offset_y2-=1
|
||||
else:
|
||||
offset_x2 -= 1
|
||||
|
||||
if kill: break
|
||||
|
||||
#image = image.convert('RGB')
|
||||
|
||||
|
||||
|
||||
self.double_buffer.SetImage(image1, offset_x1, offset_y1)
|
||||
self.double_buffer.SetImage(image2, offset_x2, offset_y2)
|
||||
|
||||
buff = 0
|
||||
|
||||
# remove the ppixels behind the image, to stop trailing
|
||||
self.double_buffer = self.matrix.SwapOnVSync(self.double_buffer)
|
||||
for y in range(16):
|
||||
self.matrix.SetPixel(offset_x1 + img_width1 +1 , y , 0,0,0)
|
||||
self.matrix.SetPixel(offset_x1 + img_width1 , y , 0,0,0)
|
||||
for y in range(16,32):
|
||||
self.matrix.SetPixel(offset_x2 + img_width2 +1 , y , 0,0,0)
|
||||
self.matrix.SetPixel(offset_x2 + img_width2 , y , 0,0,0)
|
||||
|
||||
|
||||
|
||||
kill = self.checkKilled()
|
||||
|
||||
if kill: break
|
||||
|
||||
|
||||
if kill: break
|
||||
|
||||
def process_msg(self, msg):
|
||||
|
||||
if msg == 'S': # stocks
|
||||
@ -2007,10 +2114,10 @@ class StockTicker():
|
||||
self.scrollFunctionsAnimated(userSettings, animation = 'down')
|
||||
|
||||
elif msg == 'b':
|
||||
#userSettings = ['stocks_prof', 'crypto_prof', 'forex_prof', 'today_weather_prof']
|
||||
userSettings = ['stocks_prof', 'forex_prof', 'crypto_prof', 'today_weather_prof']
|
||||
|
||||
#self.scrollFunctionsAnimatedProf(userSettings)
|
||||
self.displayProfessional()
|
||||
self.scrollProfessionalAnimated(userSettings)
|
||||
#self.displayProfessional()
|
||||
|
||||
elif msg == '+':
|
||||
stock_ticker.scrollMultiple()
|
||||
@ -2031,7 +2138,7 @@ if __name__ == '__main__':
|
||||
|
||||
|
||||
#
|
||||
#stock_ticker.process_msg('G')
|
||||
|
||||
#stock_ticker.process_msg('G')
|
||||
#stock_ticker.process_msg('f')
|
||||
#stock_ticker.process_msg('W')
|
||||
|
Loading…
Reference in New Issue
Block a user