diff --git a/csv/last_updates.json b/csv/last_updates.json index 8cb7894..e69de29 100644 --- a/csv/last_updates.json +++ b/csv/last_updates.json @@ -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"} \ No newline at end of file diff --git a/display_images/crypto_prof.ppm b/display_images/crypto_prof.ppm new file mode 100644 index 0000000..da09d89 Binary files /dev/null and b/display_images/crypto_prof.ppm differ diff --git a/display_images/forex_prof.ppm b/display_images/forex_prof.ppm new file mode 100644 index 0000000..27248b7 Binary files /dev/null and b/display_images/forex_prof.ppm differ diff --git a/display_images/future_games.ppm b/display_images/future_games.ppm new file mode 100644 index 0000000..201916e Binary files /dev/null and b/display_images/future_games.ppm differ diff --git a/display_images/live_games.ppm b/display_images/live_games.ppm new file mode 100644 index 0000000..0794ec9 Binary files /dev/null and b/display_images/live_games.ppm differ diff --git a/display_images/past_games.ppm b/display_images/past_games.ppm new file mode 100644 index 0000000..9133628 Binary files /dev/null and b/display_images/past_games.ppm differ diff --git a/display_images/stocks_prof.ppm b/display_images/stocks_prof.ppm new file mode 100644 index 0000000..b434a1a Binary files /dev/null and b/display_images/stocks_prof.ppm differ diff --git a/display_images/today_weather_prof.ppm b/display_images/today_weather_prof.ppm new file mode 100644 index 0000000..70f044d Binary files /dev/null and b/display_images/today_weather_prof.ppm differ diff --git a/feature_titles/__MACOSX/._sports_team_stats.png b/feature_titles/__MACOSX/._sports_team_stats.png new file mode 100644 index 0000000..35dfa96 Binary files /dev/null and b/feature_titles/__MACOSX/._sports_team_stats.png differ diff --git a/feature_titles/sports_future.png b/feature_titles/sports_future.png new file mode 100644 index 0000000..78ed218 Binary files /dev/null and b/feature_titles/sports_future.png differ diff --git a/feature_titles/sports_live.png b/feature_titles/sports_live.png new file mode 100644 index 0000000..b6f4101 Binary files /dev/null and b/feature_titles/sports_live.png differ diff --git a/feature_titles/sports_past.png b/feature_titles/sports_past.png new file mode 100644 index 0000000..c07f274 Binary files /dev/null and b/feature_titles/sports_past.png differ diff --git a/feature_titles/sports_team_stats.png b/feature_titles/sports_team_stats.png new file mode 100644 index 0000000..cb56437 Binary files /dev/null and b/feature_titles/sports_team_stats.png differ diff --git a/stockTicker.py b/stockTicker.py index 810b6c3..0986201 100644 --- a/stockTicker.py +++ b/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')