That looks good then, you’re in the right place. I can see the Maya option has now disappeared. You can go ahead and add that back in, it was just a test to make sure that the right files were being edited.
As for the logs, it looks like your app is not showing up as your app contains an error:
2020-06-08 07:22:46,669 [16113 ERROR sgtk.env.project.tk-shotgun] App /Users/mharris/pipeline/toolkit/apps/dvs-shotgun-download_versions failed to initialize. It will not be loaded.
Traceback (most recent call last):
File "/Users/mharris/Library/Caches/Shotgun/sgsite/p92c216.basic.shotgun/cfg/install/core/python/tank/platform/engine.py", line 2792, in __load_apps
app.init_app()
File "/Users/mharris/pipeline/toolkit/apps/dvs-shotgun-download_versions/app.py", line 40, in init_app
self.logger = sgtk.platform.get_logger(__name__)
AttributeError: can't set attribute
That makes sense as to why that would stop loading. I was adding the logger for a simple log output just to make sure my code was actually working. I copied the logger line from the dialog.py of the tk-multi-starterapp. That seems to work fine. What would be the proper way to initialize a logger into this app? I just want to put a simple print statement to show what the selected ids are when my app is invoked.
It depends where you want to add the logger. In the starter app it is not adding it as a property to the Application instance, it is just creating a variable in the module.
The Application instance already has the logger property so you can just use that: self.logger.info("Hello")
Alright, so removing that line the menu item is back and it is actually running to log the selected Versions. Now, how can I get this menu item to only appear for Versions? It is showing in all entity types that are part of the Enable Pipeline Toolkit/File Publishes on this entity list.
This is where you need to branch your environment files. As I mentioned the pick_environment.py hook is what picks which environment file to use when given a context. So you will need to modify that and create an environment file for Version entities that contains the tk-shotgun engine, which in turn has your custom app registered against it.
I’m checking with our team to see if we have any documentation around this.