Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throws Error when attempting to define more than one default display #376

Merged
merged 5 commits into from
Jun 30, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ Authors & Contributors

* Brian Madden <brian@missionpinball.org>
* Quinn Capen <qcapen@gmail.com>
* Brian Williams <brian.williams0019@gmail.com>
10 changes: 7 additions & 3 deletions mpfmc/uix/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,18 @@ def _display_created(self, *args) -> None:
self.size = self.native_size
Clock.schedule_once(self._display_created, 0)
return

# Add this display to the list of all available displays
self.mc.displays[self.name] = self

# If this display is configured as the default, set it
# If this display is configured as the default, set it.
# If this display would overwrite an existing default, raise an AssertionError.
try:
if self.config['default']:
self.mc.targets['default'] = self
if 'default' not in self.mc.targets:
self.mc.targets['default'] = self
else:
raise AssertionError('Multiple displays have been set as the default. Please choose a single \
display to default to (\"{}\" is currently set as the default).'.format(self.mc.targets['default'].name))
except KeyError:
pass

Expand Down