fixed decimal point issues

This commit is contained in:
Neythen Treloar 2022-02-22 20:34:04 +00:00
parent 8753fdd454
commit 8904b329be

View File

@ -939,6 +939,7 @@ class StockTicker():
percent_change = str(abs(percent_change))
point_change = str(abs(point_change))
current = str(current)
if not all_crypto_settings['percent']:
percent_change = False
@ -953,7 +954,7 @@ class StockTicker():
logo = self.openImage(os.path.join(logos_path, ticker + '.png'))
stitchedStock = self.stitchImage([logo,midFrame])
except:
except Exception as e:
stitchedStock = midFrame
else:
@ -964,6 +965,7 @@ class StockTicker():
image_list.append(self.blank)
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
self.logf.write(str(e))
@ -1072,7 +1074,7 @@ class StockTicker():
current = float(forex_settings[sb]['current'])
change = float(forex_settings[sb]['24hr_change'])
percent_change = str(abs(forex_settings[sb]['percent_change'])) +'%'
percent_change = str(abs(float(forex_settings[sb]['percent_change']))) +'%'
point_change = str(abs(change))
@ -1086,7 +1088,7 @@ class StockTicker():
current = '%.3f' % current
current = str(current)
midFrame = self.textToImage(base+ '(' + symbol + ')', current, arrow, percent_change, point_change) #IMAGE THE TEXT
@ -1115,6 +1117,7 @@ class StockTicker():
image_list.append(self.blank)
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
self.logf.write(str(e))
@ -1163,7 +1166,7 @@ class StockTicker():
if all_forex_settings["percent"]:
# convert percent to points
change = abs(forex_settings[sb]['percent_change'])/current * 100
change = abs(float(forex_settings[sb]['percent_change']))
change = str(change) + '%'
else:
@ -1325,6 +1328,8 @@ class StockTicker():
if all_stocks_settings["percent"]:
change = str(abs(float(info['percent_change']))) + '%'
else:
change = str(abs(change))
current = str(float(info['current'])) #TEXT
@ -1781,7 +1786,7 @@ class StockTicker():
img = img.crop((0,0,x_offset ,32))
imgs.append(img)
except Exception as e:
raise e
exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
self.logf.write(str(e))
@ -2750,7 +2755,7 @@ if __name__ == '__main__':
#stock_ticker.process_msg('-')
#stock_ticker.process_msg('W')
#stock_ticker.process_msg('A')
stock_ticker.process_msg('A')