real time updating during continuous scrolling added
This commit is contained in:
parent
3f13931f13
commit
18841c817f
@ -9,7 +9,7 @@ sandboxAPIkey = "sandbox_c24qddqad3ickpckgg8g"
|
||||
finnhubClient = finnhub.Client(api_key=APIkey)
|
||||
|
||||
NY_zone = pytz.timezone('America/New_York')
|
||||
NY_time = datetime.now(NY_zone)
|
||||
|
||||
|
||||
opening = NY_time.replace(hour=9, minute=30, second=0, microsecond=0)
|
||||
closing = NY_time.replace(hour=16, minute=0, second=0, microsecond=0)
|
||||
@ -19,6 +19,8 @@ closing = NY_time.replace(hour=16, minute=0, second=0, microsecond=0)
|
||||
|
||||
|
||||
def getStockPrices():
|
||||
NY_time = datetime.now(NY_zone)
|
||||
|
||||
|
||||
if opening < NY_time < closing:
|
||||
apiCalledError = False
|
||||
|
@ -106,11 +106,15 @@ class StockTicker():
|
||||
while True:
|
||||
|
||||
if current_img == 1:
|
||||
self.getFullStockImage(1)
|
||||
image1 = self.openImage(image_files[0])
|
||||
image2 = self.openImage(image_files[1])
|
||||
elif current_img == 2:
|
||||
self.getFullStockImage(2)
|
||||
image1 = self.openImage(image_files[1])
|
||||
image2 = self.openImage(image_files[0])
|
||||
|
||||
|
||||
|
||||
img_width, img_height = image1.size
|
||||
print('wh:', self.matrix.width, self.matrix.height)
|
||||
@ -226,7 +230,7 @@ class StockTicker():
|
||||
self.matrix.SetPixel(x , y , 0,0,0)
|
||||
|
||||
#Connect all the pieces togeather creating 1 long final stock image
|
||||
def getFullStockImage(self):
|
||||
def getFullStockImage(self, updated_img):
|
||||
|
||||
image_list = []
|
||||
|
||||
@ -263,7 +267,11 @@ class StockTicker():
|
||||
image_list.append(stitchedStock)
|
||||
|
||||
finalDisplayImage = self.stitchImage(image_list)
|
||||
finalDisplayImage.save('final.ppm')
|
||||
|
||||
if updated_img == 1:
|
||||
finalDisplayImage.save('final.ppm')
|
||||
elif updated_img == 2:
|
||||
finalDisplayImage.save('final1.ppm')
|
||||
|
||||
#Send the final stitched image to the display for set amount of time
|
||||
def displayMatrix(self):
|
||||
@ -331,7 +339,7 @@ class StockTicker():
|
||||
def process_msg(self, msg):
|
||||
|
||||
if msg == 'S':
|
||||
self.getFullStockImage()
|
||||
self.getFullStockImage(1)
|
||||
self.displayMatrix()
|
||||
|
||||
|
||||
@ -361,16 +369,16 @@ if __name__ == '__main__':
|
||||
speed, brightness = row
|
||||
|
||||
print(speed, brightness)
|
||||
stock_ticker.process_msg(brightness)
|
||||
stock_ticker.process_msg(speed)
|
||||
#stock_ticker.process_msg(brightness)
|
||||
#stock_ticker.process_msg(speed)
|
||||
|
||||
|
||||
|
||||
#t = time.time()
|
||||
#api_caller = pexpect.spawn("sudo -E python3 api_caller.py")
|
||||
#print('time to call api', time.time()-t)
|
||||
#stock_ticker.getFullStockImage()
|
||||
#stock_ticker.displayMatrix()
|
||||
stock_ticker.getFullStockImage(1)
|
||||
stock_ticker.displayMatrix()
|
||||
|
||||
|
||||
while True:
|
||||
|
Loading…
Reference in New Issue
Block a user