Toolkit Shell Intergration and apps

Hi

I have installed the tk-shell, but I can’t seem to find any documentation on how to start it or launch standalone apps like publisher or loader.

Cheers

Pritish

1 Like

To confirm when I run the following code, I get the engine

import sgtk
engine = sgtk.platform.current_engine()

I can also see it finds the pyside correctly when I do engine._has_qt.

1 Like

Hi Pritish – The following worked for me for launching the Publisher from the tk-shell engine:

import sys
sys.path.append("/sgtk/software/shotgun/goats/install/core/python")
import sgtk
tk = sgtk.sgtk_from_path("/sgtk/software/shotgun/goats")
ctx = tk.context_from_entity('Project', 135)

# get script user to authenticate
from tank_vendor.shotgun_authentication import ShotgunAuthenticator
cdm = sgtk.util.CoreDefaultsManager()
authenticator = ShotgunAuthenticator(cdm)
user = authenticator.create_script_user(api_script="Toolkit", api_key="<YOUR_SCRIPT_KEY>")
sgtk.set_authenticated_user(user)

engine=sgtk.platform.start_engine('tk-shell', tk, ctx)
engine.execute_command('Publish...', [])

You can see the execute_command() method in the ShellEngine object’s code here.

Hope that works for you! Let us know if you have any other questions.

1 Like

Awesome the publisher worked. But it didn’t seem to register the command for the loader or the panel.

Although I can see the apps.

>>> engine.apps.keys()
['tk-multi-publish2', 'tk-multi-loader2', 'tk-multi-shotgunpanel']

Here is traceback of the commands

>>> engine.commands.keys()
['Open Log Folder', 'Publish...']
2 Likes

Hi Pritish

I think I know what it is. Both the loader and the panel app run this check before registering a command:

        if not self.engine.has_ui:
            return

The shell engine checks for the existence of QT before saying if it has a UI or not:



So perhaps PySide can’t be found in your environment?

1 Like

As mentioned the publisher app get launched.

However in a shell enviroment there won’t be any qApp/QApplication instance which would would return a false value even if there is pyside is installed.

Looks like this was discussed a while ago too

1 Like

ah yes I remember that one now, good catch.
As a work around, you could create your own QApplication

from PySide import QtGui
import sys
app = QtGui.QApplication([])

... do some app launching

sys.exit(app.exec_())

Testing on my side that seems to work, although the styling does appear a bit off. I get a white background on the publisher for example.
Is this just for testing?

1 Like

Thanks for that. The loader got launched, but nothing is showing up. I tried to check if it is getting the right config, and that is not the issue.

We would do a deep dive why that is case.

1 Like

By default the Loader is not setup to run in a shell environment, as what would you load into?

That said it should be possible to get stuff to show up, even if I’m not sure what the loader would do in a standalone environment. How do you have it configured?

1 Like

It’s not such much we want to load something, but more about running action on published data

eg

  1. Archive the data.
  2. Sync the data to another branch.
  3. Supervisor approving published data.
  4. Previewing in RV or someother application

So it’s more about production management usage as opposed using in a DCC.

Browsing via the SGTK is faster than the website obviously.

3 Likes