pyblish-base
pyblish-base copied to clipboard
add discover_gui (without introducing ui dependencies !)
Problem:
Pyblish base let's us register guis with pyblish.api.register_gui
, but not show them. 😞
Each dcc implementation of pyblish has a show function, but pyblish base does not. e.g. in pyblish-maya we can do:
import pyblish_maya
pyblish_maya.show()
but in pyblish-base we can't do:
import pyblish
pyblish.show()
show()
launches the registered UI, and on fail falls back to the next registered UI.
However this code is duplicated across each dcc implementation, and not available in pyblish base.
Moving this code to base would make it easier to make dcc implementations, and enable devs to use this functionality for non dcc plugins.
Solution
this PR implements the discover_gui method from pyblish_maya & pyblish_3dsmax in pyblish base, without creating a UI dependency
now we can do this
import pyblish.api
import pyblish.gui
pyblish.api.register_gui('pyblish_lite')
pyblish.gui.show()
Note
- it might even be worth movign the show function to pyblish so we can do
pyblish.show()
Pyblish base already allows us to show both default qml & lite explicitly.
import pyblish_qml
pyblish_qml .show()
import pyblish_lite
pyblish_lite.show()
I suppose we could do this; I'd say it's a backwards relationship. The GUI depends on base, but base should not depend on any GUI. But, consider we already do this via pyblish_maya.. it's dirt we've already accumulated so may as well continue shovelling it?
The only thing missing here is documentation for it. Can you add this new mechanic to the README of this project? We also need a test; not one that actually launches Pyblish QML or Lite, but something that calls some function such that you can confirm this actually works and tells us when it does not via the test suite.