refactoring for preofessional display
This commit is contained in:
parent
848fa2f5ac
commit
f294f61276
@ -1,4 +1,4 @@
|
||||
symbol,name,base,current,24hr change
|
||||
BTC,bitcoin,usd,39839,15.522273899016485
|
||||
ETH,ethereum,gbp,1723.02,10.088368027141781
|
||||
DOGE,dogecoin,usd,0.224764,13.954280560872759
|
||||
BTC,bitcoin,usd,40270,16.560179943187396
|
||||
ETH,ethereum,gbp,1750.78,11.871734531689802
|
||||
DOGE,dogecoin,usd,0.22635,14.743047682205162
|
||||
|
|
@ -1 +1 @@
|
||||
[{"main_weather": "Clouds", "description": "overcast clouds", "temp": 30.03, "min_temp": 29.58, "max_temp": 32.17, "feels_like": 37.03, "humidity": 83, "clouds": 100, "wind_speed": 0.45, "wind_direction": 265, "visibility": 10000, "uv": 0, "rain_chance": 0.33}, {"main_weather": "Clouds", "description": "overcast clouds", "temp": 22.64, "min_temp": 14.98, "max_temp": 24.62, "feels_like": 22.76, "humidity": 69, "clouds": 97, "wind_speed": 3.6, "wind_direction": 220, "visibility": 10000, "uv": 0.08, "rain_chance": 0.42}]
|
||||
[{"main_weather": "Clouds", "description": "overcast clouds", "temp": 29.61, "min_temp": 29.36, "max_temp": 32.34, "feels_like": 36.61, "humidity": 90, "clouds": 100, "wind_speed": 0.45, "wind_direction": 200, "visibility": 10000, "uv": 0, "rain_chance": 0.73}, {"main_weather": "Clouds", "description": "broken clouds", "temp": 21.11, "min_temp": 14.98, "max_temp": 24.47, "feels_like": 21.23, "humidity": 75, "clouds": 80, "wind_speed": 4.12, "wind_direction": 210, "visibility": 10000, "uv": 0, "rain_chance": 0.12}]
|
@ -1 +1 @@
|
||||
[[{"main_weather": "Rain", "description": "light rain", "min_temp": 29.58, "max_temp": 32.17}, {"main_weather": "Rain", "description": "light rain", "min_temp": 29.38, "max_temp": 31.23}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 28.89, "max_temp": 30.71}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 28.9, "max_temp": 29.81}, {"main_weather": "Rain", "description": "light rain", "min_temp": 28.43, "max_temp": 29.1}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 26.71, "max_temp": 28.93}, {"main_weather": "Rain", "description": "light rain", "min_temp": 26.72, "max_temp": 30.09}, {"main_weather": "Rain", "description": "light rain", "min_temp": 29.03, "max_temp": 31.86}], [{"main_weather": "Rain", "description": "light rain", "min_temp": 14.98, "max_temp": 24.62}, {"main_weather": "Rain", "description": "light rain", "min_temp": 16.14, "max_temp": 19.83}, {"main_weather": "Rain", "description": "light rain", "min_temp": 13.35, "max_temp": 20.32}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 12.58, "max_temp": 21.95}, {"main_weather": "Rain", "description": "light rain", "min_temp": 13.63, "max_temp": 17.52}, {"main_weather": "Rain", "description": "light rain", "min_temp": 13.42, "max_temp": 19.67}, {"main_weather": "Rain", "description": "light rain", "min_temp": 12.38, "max_temp": 17.85}, {"main_weather": "Rain", "description": "light rain", "min_temp": 12.59, "max_temp": 21.36}]]
|
||||
[[{"main_weather": "Rain", "description": "light rain", "min_temp": 29.36, "max_temp": 32.34}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 29.45, "max_temp": 31.59}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 29.04, "max_temp": 30.82}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 28.75, "max_temp": 29.42}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 27.77, "max_temp": 28.47}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 27.04, "max_temp": 28.25}, {"main_weather": "Rain", "description": "light rain", "min_temp": 27.27, "max_temp": 30.37}, {"main_weather": "Rain", "description": "light rain", "min_temp": 29.15, "max_temp": 31.87}], [{"main_weather": "Rain", "description": "light rain", "min_temp": 14.98, "max_temp": 24.47}, {"main_weather": "Rain", "description": "light rain", "min_temp": 15.59, "max_temp": 20.24}, {"main_weather": "Rain", "description": "light rain", "min_temp": 13.65, "max_temp": 20.3}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 12.01, "max_temp": 20.01}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 13.09, "max_temp": 20.15}, {"main_weather": "Rain", "description": "light rain", "min_temp": 13.43, "max_temp": 21.97}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 12.99, "max_temp": 22.6}, {"main_weather": "Rain", "description": "light rain", "min_temp": 14.44, "max_temp": 21.85}]]
|
@ -1 +0,0 @@
|
||||
{"stocks": "26/07/2021 14:35:34", "crypto": "26/07/2021 14:31:37", "news": "26/07/2021 14:31:39", "weather": "26/07/2021 14:31:38", "forex": "26/07/2021 20:31:42", "sports": "26/07/2021 14:31:40"}
|
40
csv/news.csv
40
csv/news.csv
@ -1,21 +1,21 @@
|
||||
headline,source,date,time
|
||||
Niuean hepatitis figures 'amazing' - Otago Daily Times,Otago Daily Times,2021-07-26,16:30:00Z
|
||||
Mimi movie review and release LIVE UPDATES: Kriti Sanon movie is now streaming on Netflix^ Jio Cinema - The Indian Express,The Indian Express,2021-07-26,16:26:05Z
|
||||
Theatres^ concert halls in Northern Ireland to reopen as mask requirement dropped in places of worship - Irish Examiner,Irish Examiner,2021-07-26,16:25:00Z
|
||||
Coffee prices surge as freezing temperatures destroy Brazil’s crops - Fortune,Fortune,2021-07-26,16:16:33Z
|
||||
Texas Longhorns^ Oklahoma Sooners tell Big 12 they will not renew grant of media rights - ESPN,ESPN,2021-07-26,16:15:48Z
|
||||
Loch Lomond: calls for safety measures after four people drown - The Guardian,The Guardian,2021-07-26,16:13:00Z
|
||||
After Covid jab^ BioNTech sets sights on malaria vaccine - Jacaranda FM,Jacarandafm.com,2021-07-26,16:08:00Z
|
||||
COVID-19 live updates: Quebec registers 298 cases^ 1 death since Friday - Montreal Gazette,Montreal Gazette,2021-07-26,16:07:25Z
|
||||
Duterte’s final SONA: Triumphs^ wishlist^ ad libs - INQUIRER.net,Inquirer.net,2021-07-26,16:06:00Z
|
||||
UnionBank profit surges to P8.3 billion in first half - Philstar.com,Philippine Star,2021-07-26,16:00:00Z
|
||||
Dev Patel and David Lowery give Arthurian legend a new coat of A24 dread in The Green Knight - The A.V. Club,The A.V. Club,2021-07-26,16:00:00Z
|
||||
BREAKING: Biafra: Nnamdi Kanu will soon be free – Lawyer - Daily Post Nigeria,Daily Post Nigeria,2021-07-26,15:58:24Z
|
||||
COVID-19: UK reports 24^950 new coronavirus cases - sixth consecutive daily fall - Sky News,Sky.com,2021-07-26,15:53:49Z
|
||||
PIERS MORGAN: America's anti-vaxxers are snatching covid defeat from the jaws of vaccinated victory - Daily Mail,Daily Mail,2021-07-26,15:53:09Z
|
||||
Reading stabbing: Two guilty of Olly Stephens murder - BBC News,BBC News,2021-07-26,15:40:42Z
|
||||
Tesco Bank to close all current accounts from end of November - The Guardian,The Guardian,2021-07-26,15:40:00Z
|
||||
Americans are 'mixing and matching' Covid vaccines over concerns about the delta variant - CNBC,CNBC,2021-07-26,15:38:00Z
|
||||
NASA's Hubble Space Telescope has discovered water vapor on Jupiter's ocean moon Ganymede for the first time - Business Insider,Business Insider,2021-07-26,15:37:06Z
|
||||
More air quality alerts issued as smoke^ over 140 forest fires plague northwestern Ontario - CBC.ca,CBC News,2021-07-26,15:36:44Z
|
||||
Watch highlights from Day 3 of the Tokyo 2020 Olympics: Swimming^ softball^ gymnastics - KCRA Sacramento,KCRA Sacramento,2021-07-26,15:28:00Z
|
||||
Green Bay Packers GM Brian Gutekunst 'remains hopeful' for positive resolution with QB Aaron Rodgers - ESPN,ESPN,2021-07-26,18:32:46Z
|
||||
Is 25C too hot? How we decide what qualifies as a heatwave - Stuff.co.nz,Stuff.co.nz,2021-07-26,18:29:00Z
|
||||
COVID-19: More testing sites and self-isolation exemption list in England expanded in bid to ease 'pingdemic' - Sky News,Sky.com,2021-07-26,18:28:11Z
|
||||
12 times iPhones beat Androids - The Nation Newspaper ,The Nation Newspaper ,2021-07-26,18:20:37Z
|
||||
Large meteor lights up skies in Norway - CTV News,Ctvnews.ca,2021-07-26,18:14:16Z
|
||||
Summer Olympics 2021: What to Watch for on Day 4 in Tokyo - Bleacher Report,Bleacher Report,2021-07-26,18:11:43Z
|
||||
COVID-19 live updates: Savannah reinstates masks indoors^ Orlando in 'crisis mode' - ABC News,ABC News,2021-07-26,18:06:00Z
|
||||
Tunisia’s Democracy Verges on Dissolution as President Moves to Take Control - The New York Times,New York Times,2021-07-26,18:04:29Z
|
||||
Tokyo Olympics DAY 4 India Results: Bad day at office - InsideSport,InsideSport,2021-07-26,18:03:34Z
|
||||
Kanye West’s New Album Donda Will Be Released August 6^ A Rep Confirms - Pitchfork,Pitchfork,2021-07-26,17:57:12Z
|
||||
Psaki: Biden doesn't want to 'fight' Fox after Trump 'destroyed trust in media' - Business Insider,Business Insider,2021-07-26,17:56:13Z
|
||||
Scientists including India astronomers spot unique Gamma-ray burst using NASA’s space telescope - Times of India,The Times of India,2021-07-26,17:53:00Z
|
||||
Manchester United in final negotiations to sign Raphaël Varane for around £40m - The Guardian,The Guardian,2021-07-26,17:49:00Z
|
||||
#UnrestSA: West Rand politician Bruce Nimmerhoudt charged with terrorism - News24,News24,2021-07-26,17:47:52Z
|
||||
SA women plan class action lawsuit over implant used to treat incontinence - News24,News24,2021-07-26,17:47:46Z
|
||||
Coronavirus: 11 new COVID-19 cases in Manitoba^ Winnipeg's test positivity rate below two per cent - CTV News Winnipeg,Ctvnews.ca,2021-07-26,17:46:29Z
|
||||
Tokyo 2020: Mona McSharry’s achievement a paradigm shift for Irish swimming - The Irish Times,The Irish Times,2021-07-26,17:44:27Z
|
||||
Mount Sinai researchers use cerebral organoids to study frontotemporal dementia - News-Medical.Net,News-Medical.Net,2021-07-26,17:44:00Z
|
||||
Texas^ Oklahoma Indicate They'll Leave the Big 12 for the SEC - The New York Times,New York Times,2021-07-26,17:40:26Z
|
||||
How ‘Baba Ijesha’ defiled my foster daughter while watching cartoons — Princess - The Nation Newspaper ,The Nation Newspaper ,2021-07-26,17:38:26Z
|
||||
|
|
@ -1,4 +1,4 @@
|
||||
name,current,opening
|
||||
MSFT,289.115,289
|
||||
NFLX,514.99,514.85
|
||||
GOOG,2774.34,2764.03
|
||||
MSFT,289.33,289
|
||||
NFLX,517.2,514.85
|
||||
GOOG,2783.82,2764.03
|
||||
|
|
308
stockTicker.py
308
stockTicker.py
@ -58,8 +58,12 @@ class StockTicker():
|
||||
self.matrix = RGBMatrix(options = options)
|
||||
self.points = True # display crypto change in points or percent
|
||||
self.functions = {'stocks': self.getStockImage, 'crypto': self.getCryptoImage, 'forex': self.getForexImage,
|
||||
'daily_weather':self.getDailyWeatherImage, 'today_weather': self.getTodayWeatherImage, 'league_table': self.getLeagueTableImage,
|
||||
'league_games': self.getLeagueImage, 'news':self.getNewsImage, 'text': self.getUserText, 'display_image': self.getUserImage, 'display_gif':self.getUserGIF} #put this somewhere else
|
||||
'daily_weather':self.getDailyWeatherImage, 'today_weather': self.getTodayWeatherImage,
|
||||
'league_table': self.getLeagueTableImage, 'league_games': self.getLeagueImage, 'news':self.getNewsImage,
|
||||
'text': self.getUserText, 'display_image': self.getUserImage, 'display_gif':self.getUserGIF,
|
||||
|
||||
'stocks_prof': self.getStockProfessional, 'crypto_prof': self.getCryptoProfessional, 'forex_prof': self.getForexProfessional,
|
||||
'today_weather_prof': self.getTodayWeatherProfessional, 'news_prof':self.getNewsProfessional} #put this somewhere else
|
||||
|
||||
|
||||
def openImage(self, image_file):
|
||||
@ -104,31 +108,63 @@ class StockTicker():
|
||||
(r, g, b) = pixels[x, y]
|
||||
self.matrix.SetPixel(x + offset_x, y + offset_y, r*self.brightness, g*self.brightness, b*self.brightness)
|
||||
|
||||
def scrollImage(self, image, offset_x = 0, offset_y = 0):
|
||||
def scrollImage(self, image, double_buffer, offset_x = 0, offset_y = 0, frame_skip = 10, gif = False):
|
||||
img_width, img_height = image.size
|
||||
|
||||
|
||||
double_buffer = self.matrix.CreateFrameCanvas()
|
||||
image = image.convert('RGB')
|
||||
kill = False
|
||||
while offset_x > -img_width:
|
||||
offset_x -= 1
|
||||
|
||||
double_buffer.SetImage(image, offset_x, offset_y)
|
||||
double_buffer = self.matrix.SwapOnVSync(double_buffer)
|
||||
# remove the ppixels behind the image, to stop trailing
|
||||
for x in range(offset_x + img_width, 128):
|
||||
for y in range(self.matrix.height):
|
||||
|
||||
|
||||
self.matrix.SetPixel(x , y , 0,0,0)
|
||||
|
||||
# for animation in gifs
|
||||
if offset_x%frame_skip == 0:
|
||||
self.incrementGIF(image)
|
||||
|
||||
#image = image.convert('RGB')
|
||||
offset_x -= 1
|
||||
|
||||
#self.setImage(image.convert('RGB'), offset_x = offset_x, offset_y = offset_y)
|
||||
if gif:
|
||||
double_buffer.SetImage(image, offset_x, offset_y)
|
||||
else:
|
||||
|
||||
double_buffer.SetImage(image.convert('RGB'), offset_x, offset_y)
|
||||
|
||||
kill = self.checkKilled()
|
||||
if kill:
|
||||
break
|
||||
|
||||
buff = 0
|
||||
|
||||
# remove the ppixels behind the image, to stop trailing
|
||||
double_buffer = self.matrix.SwapOnVSync(double_buffer)
|
||||
for y in range(self.matrix.height):
|
||||
self.matrix.SetPixel(offset_x + img_width , y , 0,0,0)
|
||||
self.matrix.SetPixel(offset_x + img_width +1 , y , 0,0,0)
|
||||
self.matrix.SetPixel(offset_x + img_width +2 , y , 0,0,0)
|
||||
|
||||
time.sleep(self.delay)
|
||||
kill = self.checkKilled()
|
||||
if kill: break
|
||||
return kill
|
||||
|
||||
|
||||
def scrollImageY(self, image, double_buffer, direction = 1, offset_x = 0, offset_y = 0, frame_skip = 10, gif = False):
|
||||
kill = False
|
||||
while offset_y != 0:
|
||||
|
||||
# for animation in gifs
|
||||
if offset_y%frame_skip == 0:
|
||||
|
||||
self.incrementGIF(image)
|
||||
|
||||
offset_y += direction
|
||||
|
||||
if gif:
|
||||
double_buffer.SetImage(image, offset_x, offset_y)
|
||||
else:
|
||||
double_buffer.SetImage(image.convert('RGB'), offset_x, offset_y)
|
||||
|
||||
double_buffer = self.matrix.SwapOnVSync(double_buffer)
|
||||
|
||||
time.sleep(self.delay)
|
||||
kill = self.checkKilled()
|
||||
if kill: break
|
||||
|
||||
return kill
|
||||
|
||||
def scrollImageStacked(self, image, offset_x = 0, offset_y = 0):
|
||||
img_width, img_height = image.size
|
||||
@ -146,66 +182,6 @@ class StockTicker():
|
||||
time.sleep(self.delay)
|
||||
return kill
|
||||
|
||||
def scrollImageTransition(self, image_files, offset_x = 0, offset_y = 0, stocks = True):
|
||||
# use two image files and switch between them with a seemless transition
|
||||
current_img = 1
|
||||
image1 = self.openImage(image_files[0]).convert('RGB')
|
||||
image2 = self.openImage(image_files[1]).convert('RGB')
|
||||
|
||||
double_buffer = self.matrix.CreateFrameCanvas()
|
||||
kill = False
|
||||
while True:
|
||||
|
||||
if current_img == 1:
|
||||
|
||||
if stocks:
|
||||
update_process = Process(target = self.getFullStockImage, args = (1,))
|
||||
update_process.start()
|
||||
image1 = self.openImage(image_files[0]).convert('RGB')
|
||||
image2 = self.openImage(image_files[1]).convert('RGB')
|
||||
|
||||
elif current_img == 2:
|
||||
|
||||
if stocks:
|
||||
update_process = Process(target = self.getFullStockImage, args = (2,))
|
||||
update_process.start()
|
||||
|
||||
image1 = self.openImage(image_files[1]).convert('RGB')
|
||||
image2 = self.openImage(image_files[0]).convert('RGB')
|
||||
|
||||
img_width, img_height = image1.size
|
||||
|
||||
|
||||
while offset_x > -img_width:
|
||||
offset_x -= 1
|
||||
|
||||
double_buffer.SetImage(image1, offset_x, offset_y)
|
||||
|
||||
|
||||
if offset_x + img_width < self.matrix.width: # if the image is ending
|
||||
double_buffer.SetImage(image2, offset_x, offset_y)
|
||||
|
||||
double_buffer = self.matrix.SwapOnVSync(double_buffer)
|
||||
|
||||
time.sleep(self.delay)
|
||||
kill = self.checkKilled()
|
||||
if kill: break
|
||||
|
||||
if stocks:
|
||||
image1.close()
|
||||
image2.close()
|
||||
|
||||
if kill: break
|
||||
|
||||
if stocks:
|
||||
update_process.join()
|
||||
if current_img == 1:
|
||||
current_img = 2
|
||||
elif current_img == 2:
|
||||
current_img = 1
|
||||
offset_x = 0
|
||||
|
||||
|
||||
def updateMultiple(self, options):
|
||||
|
||||
for option in options:
|
||||
@ -213,7 +189,14 @@ class StockTicker():
|
||||
if option not in ['display_gif']: # aving the gif like this kills the animation
|
||||
img = self.functions[option]()
|
||||
img.save('./display_images/'+ option+ '.ppm')
|
||||
|
||||
|
||||
def incrementGIF(self, image):
|
||||
try:
|
||||
image.seek(self.frame)
|
||||
except EOFError:
|
||||
self.frame = 0
|
||||
image.seek(self.frame)
|
||||
self.frame +=1
|
||||
|
||||
def checkKilled(self):
|
||||
|
||||
@ -268,110 +251,25 @@ class StockTicker():
|
||||
offset_y = 0
|
||||
#first scroll image in from bottom
|
||||
|
||||
frames = 10 #controls how fast gifs run
|
||||
frame = 0
|
||||
|
||||
frame_skip = 10 #controls how fast gifs run
|
||||
self.frame = 0
|
||||
|
||||
pause_frames = int(0.5/self.delay)
|
||||
if animation == 'up':
|
||||
offset_y = 33
|
||||
|
||||
|
||||
while offset_y > 0:
|
||||
|
||||
# for animation in gifs
|
||||
if offset_y%frames == 0:
|
||||
|
||||
try:
|
||||
image.seek(frame)
|
||||
|
||||
except EOFError:
|
||||
|
||||
frame = 0
|
||||
image.seek(frame)
|
||||
frame +=1
|
||||
|
||||
|
||||
offset_y -= 1
|
||||
|
||||
if options[i % len(options)] != 'display_gif':
|
||||
double_buffer.SetImage(image, offset_x, offset_y)
|
||||
else:
|
||||
double_buffer.SetImage(image.convert('RGB'), offset_x, offset_y)
|
||||
|
||||
double_buffer = self.matrix.SwapOnVSync(double_buffer)
|
||||
|
||||
time.sleep(self.delay)
|
||||
kill = self.checkKilled()
|
||||
if kill: break
|
||||
|
||||
while pause_frames > 0:
|
||||
if pause_frames%frames == 0:
|
||||
|
||||
try:
|
||||
|
||||
image.seek(frame)
|
||||
|
||||
except EOFError:
|
||||
|
||||
frame = 0
|
||||
image.seek(frame)
|
||||
frame +=1
|
||||
|
||||
pause_frames -=1
|
||||
if options[i % len(options)] != 'display_gif':
|
||||
double_buffer.SetImage(image, offset_x, offset_y)
|
||||
else:
|
||||
double_buffer.SetImage(image.convert('RGB'), offset_x, offset_y)
|
||||
|
||||
double_buffer = self.matrix.SwapOnVSync(double_buffer)
|
||||
|
||||
time.sleep(self.delay)
|
||||
kill = self.checkKilled()
|
||||
if kill: break
|
||||
|
||||
direction = -1
|
||||
elif animation == 'down':
|
||||
|
||||
direction = 1
|
||||
offset_y = -33
|
||||
while offset_y < 0:
|
||||
# for animation in gifs
|
||||
if offset_y%frames == 0:
|
||||
|
||||
try:
|
||||
|
||||
image.seek(frame)
|
||||
|
||||
except EOFError:
|
||||
|
||||
frame = 0
|
||||
image.seek(frame)
|
||||
frame +=1
|
||||
|
||||
offset_y += 1
|
||||
if options[i % len(options)] != 'display_gif':
|
||||
double_buffer.SetImage(image, offset_x, offset_y)
|
||||
else:
|
||||
double_buffer.SetImage(image.convert('RGB'), offset_x, offset_y)
|
||||
|
||||
double_buffer = self.matrix.SwapOnVSync(double_buffer)
|
||||
|
||||
time.sleep(self.delay)
|
||||
kill = self.checkKilled()
|
||||
if kill: break
|
||||
|
||||
|
||||
if kill: break
|
||||
self.scrollImageY(image, double_buffer, direction = direction, offset_x = offset_x, offset_y = offset_y, frame_skip = frame_skip, gif = options[i % len(options)] != 'display_gif')
|
||||
offset_y = 0
|
||||
|
||||
|
||||
if animation in ['up', 'down']:
|
||||
while pause_frames > 0:
|
||||
if pause_frames%frames == 0:
|
||||
try:
|
||||
|
||||
image.seek(frame)
|
||||
|
||||
except EOFError:
|
||||
|
||||
frame = 0
|
||||
image.seek(frame)
|
||||
frame +=1
|
||||
if pause_frames%frame_skip == 0:
|
||||
self.incrementGIF(image)
|
||||
|
||||
pause_frames -=1
|
||||
if options[i % len(options)] != 'display_gif':
|
||||
@ -384,49 +282,17 @@ class StockTicker():
|
||||
time.sleep(self.delay)
|
||||
kill = self.checkKilled()
|
||||
if kill: break
|
||||
|
||||
|
||||
if kill: break
|
||||
|
||||
|
||||
if kill: break
|
||||
while offset_x > -img_width:
|
||||
|
||||
# for animation in gifs
|
||||
if offset_x%frames == 0:
|
||||
try:
|
||||
print(frame)
|
||||
image.seek(frame)
|
||||
|
||||
except EOFError:
|
||||
|
||||
frame = 0
|
||||
|
||||
image.seek(frame)
|
||||
frame +=1
|
||||
|
||||
#image = image.convert('RGB')
|
||||
offset_x -= 1
|
||||
|
||||
#self.setImage(image.convert('RGB'), offset_x = offset_x, offset_y = offset_y)
|
||||
if options[i % len(options)] != 'display_gif':
|
||||
double_buffer.SetImage(image, offset_x, offset_y)
|
||||
else:
|
||||
|
||||
double_buffer.SetImage(image.convert('RGB'), offset_x, offset_y)
|
||||
|
||||
buff = 0
|
||||
|
||||
# remove the ppixels behind the image, to stop trailing
|
||||
double_buffer = self.matrix.SwapOnVSync(double_buffer)
|
||||
for y in range(self.matrix.height):
|
||||
self.matrix.SetPixel(offset_x + img_width , y , 0,0,0)
|
||||
self.matrix.SetPixel(offset_x + img_width +1 , y , 0,0,0)
|
||||
self.matrix.SetPixel(offset_x + img_width +2 , y , 0,0,0)
|
||||
|
||||
time.sleep(self.delay)
|
||||
kill = self.checkKilled()
|
||||
if kill: break
|
||||
|
||||
kill = self.scrollImage(image, double_buffer, offset_x = offset_x, offset_y = offset_y, frame_skip = frame_skip, gif = options[i % len(options)] != 'display_gif')
|
||||
|
||||
if kill: break
|
||||
|
||||
|
||||
|
||||
update_process.join()
|
||||
i+=1
|
||||
|
||||
@ -1968,9 +1834,7 @@ class StockTicker():
|
||||
stock_ticker.scrollImageTransition(['display_images/teams.ppm', 'display_images/teams.ppm'], stocks = False)
|
||||
|
||||
elif msg == 'A': #everything
|
||||
|
||||
|
||||
|
||||
|
||||
userSettings = ['display_gif', 'text', 'display_image', 'stocks', 'crypto', 'forex', 'today_weather', 'daily_weather', 'league_table', 'league_games', 'news'] # these wil be read from csv, just for demo
|
||||
#userSettings = [ 'daily_weather']
|
||||
#userSettings = ['crypto', 'stocks'] # these wil be read from csv, just for demo
|
||||
@ -1979,7 +1843,9 @@ class StockTicker():
|
||||
self.scrollFunctionsAnimated(userSettings, animation = 'down')
|
||||
|
||||
elif msg == 'b':
|
||||
self.displayProfessional()
|
||||
userSettings = ['stocks_prof', 'crypto_prof', 'forex_prof', 'today_weather_prof']
|
||||
|
||||
self.scrollFunctionsAnimatedProf(userSettings)
|
||||
|
||||
elif msg == 'K': # kill
|
||||
self.resetMatrix()
|
||||
|
Loading…
Reference in New Issue
Block a user