Tk-multi-publish : access dialog ui widget from collector

I’ve added a widget to the publisher dialog that I want to query the state of prior to running the collector.
Is it possible to access the app ui widgets from the collector hook?
I imagine something like self.parent.ui.my_widget should work?

1 Like

The AppDialog and GUI by default is obscured from the collector and publish plugin hooks. Here are some quick and dirty approaches:

  1. You can hack it by creating your own pre_publish hook that overrides the default show_dialog behaviour and storing the created, non-model dialog as self.parent.ui i.e.
    class PrePublishHook(HookBaseClass):
        def validate(self):
            app = self.parent
            app.ui = None
            display_name = app.get_setting("display_name")
            if super(PrePublishHook, self).validate():
                # start ui
                if app.modal:
                    app.engine.show_modal(display_name, app, AppDialog)
                    app.ui = app.engine.show_dialog(display_name, app, AppDialog)
                    "%s validate returned False -- abort publish."
                    % app.pre_publish_hook.__class__.__name__
            return False  # Used our own launch logic, so always return False to abort original logic
  2. Alternatively, you can try exploring the hook’s self.parent.engine.created_qt_dialogs to see if the Publish Dialog is in there somewhere

A more engineered suggestion will be to fork the tk-multi-publish2 app repository and setup a ui property (or dialogs if supporting multiple UIs) in