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

Support qt toolkit name for Qt5 and Qt4 #1436

Merged
merged 2 commits into from
Apr 1, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion traits/etsconfig/etsconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def _get_kiva_backend(self):
self._kiva_backend = (
"quartz" if sys.platform == "darwin" else "image"
)
elif self.toolkit == "qt4":
elif self.toolkit.startswith("qt"):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we stick to a whitelist of toolkits we allow? (Probably just "qt4" and "qt".) Otherwise we risk having to support everything starting with "qt" for evermore.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Though I guess it's a moot point, because the fall-through branch will pick "image" anyway.)

self._kiva_backend = "image"
else:
self._kiva_backend = "image"
Expand Down
4 changes: 4 additions & 0 deletions traits/etsconfig/tests/test_etsconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ def test_toolkit_default_kiva_backend(self):
self.ETSConfig.toolkit = "qt4"
self.assertEqual(self.ETSConfig.kiva_backend, "image")

def test_default_backend_for_qt5_toolkit(self):
self.ETSConfig.toolkit = "qt"
self.assertEqual(self.ETSConfig.kiva_backend, "image")

def test_toolkit_explicit_kiva_backend(self):
self.ETSConfig.toolkit = "wx.celiagg"
self.assertEqual(self.ETSConfig.kiva_backend, "celiagg")
Expand Down