mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-17 17:42:20 +03:00
dashboard: Remove print_exc use (logger.exception instead)
# Conflicts: # dashboard.py
This commit is contained in:
parent
fd19ac337a
commit
137c66048a
18
dashboard.py
18
dashboard.py
@ -5,9 +5,6 @@ from os.path import isdir, isfile, join, getsize
|
|||||||
from sys import platform
|
from sys import platform
|
||||||
import time
|
import time
|
||||||
|
|
||||||
if __debug__:
|
|
||||||
from traceback import print_exc
|
|
||||||
|
|
||||||
from config import appcmdname, appname, config
|
from config import appcmdname, appname, config
|
||||||
|
|
||||||
if getenv("EDMC_NO_UI"):
|
if getenv("EDMC_NO_UI"):
|
||||||
@ -32,7 +29,7 @@ else:
|
|||||||
# Status.json handler
|
# Status.json handler
|
||||||
class Dashboard(FileSystemEventHandler):
|
class Dashboard(FileSystemEventHandler):
|
||||||
|
|
||||||
_POLL = 1 # Fallback polling interval
|
_POLL = 1 # Fallback polling interval
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
FileSystemEventHandler.__init__(self) # futureproofing - not need for current version of watchdog
|
FileSystemEventHandler.__init__(self) # futureproofing - not need for current version of watchdog
|
||||||
@ -144,17 +141,20 @@ class Dashboard(FileSystemEventHandler):
|
|||||||
try:
|
try:
|
||||||
with open(join(self.currentdir, 'Status.json'), 'rb') as h:
|
with open(join(self.currentdir, 'Status.json'), 'rb') as h:
|
||||||
data = h.read().strip()
|
data = h.read().strip()
|
||||||
if data: # Can be empty if polling while the file is being re-written
|
|
||||||
|
if data: # Can be empty if polling while the file is being re-written
|
||||||
entry = json.loads(data)
|
entry = json.loads(data)
|
||||||
|
|
||||||
# Status file is shared between beta and live. So filter out status not in this game session.
|
# Status file is shared between beta and live. So filter out status not in this game session.
|
||||||
if (timegm(time.strptime(entry['timestamp'], '%Y-%m-%dT%H:%M:%SZ')) >= self.session_start and
|
if (
|
||||||
self.status != entry):
|
timegm(time.strptime(entry['timestamp'], '%Y-%m-%dT%H:%M:%SZ')) >= self.session_start
|
||||||
|
and self.status != entry
|
||||||
|
):
|
||||||
self.status = entry
|
self.status = entry
|
||||||
self.root.event_generate('<<DashboardEvent>>', when="tail")
|
self.root.event_generate('<<DashboardEvent>>', when="tail")
|
||||||
|
|
||||||
except Exception:
|
except Exception as e:
|
||||||
logger.exception('Reading Status.json')
|
logger.exception('Processing Status.json')
|
||||||
|
|
||||||
# singleton
|
# singleton
|
||||||
dashboard = Dashboard()
|
dashboard = Dashboard()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user