Skip to content

Commit

Permalink
Improve logging when CustomTheme.py has problems.
Browse files Browse the repository at this point in the history
  • Loading branch information
wrzwicky committed Oct 10, 2017
1 parent c329141 commit fb4308a
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions fofix/core/GameEngine.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,19 +358,24 @@ def __init__(self, config = None):
log.warn("No stages\ folder found, forcing None setting for Animated Stage.")
self.config.set("game","animated_stage_folder", "None") #MFH: force "None" when Stages folder can't be found



try:
self.theme = None
fp, pathname, description = imp.find_module("CustomTheme",[themepath])
theme = imp.load_module("CustomTheme", fp, pathname, description)
self.theme = theme.CustomTheme(themepath, themename)
except ImportError as e:
log.error("Failed to load CustomTheme.py from %s" % pathname)
try:
theme = imp.load_module("CustomTheme", fp, pathname, description)
self.theme = theme.CustomTheme(themepath, themename)
except ImportError as e:
# Unable to load module; log it, but continue with default Theme.
log.error("Failed to load CustomTheme.py from %s" % pathname)
#self.theme = Theme(themepath, themename)
except ImportError:
# Not found; but that's OK. We'll use the default Theme class.
pass #self.theme = Theme(themepath, themename)

if not self.theme:
self.theme = Theme(themepath, themename)

self.task.addTask(self.theme)


self.input.addKeyListener(FullScreenSwitcher(self), priority = True)
self.input.addSystemEventListener(SystemEventHandler(self))

Expand Down

0 comments on commit fb4308a

Please sign in to comment.