• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

[Python Scripting] Busy states seem to not pump the main python thread?

Community Beginner ,
Nov 28, 2023 Nov 28, 2023

Copy link to clipboard

Copied

I have created a dynamic progress bar in my tool window, so I can update progress or enable/disable the progress bar as a busy indicator.

 

I am using event dispatch / listeners.  So for instance, if I receive a bust state change I can control the progressbar state:

 

    def _busy_listener(self, event_cls) -> Tuple[Callable, bool]:

        def _set_busy_state(event_cls) -> bool:

            self.busy = bool(event_cls.busy)
            _SBSP_LOGGER(sp_logging.INFO, self.name, f"BusyStatusChanged: {self.busy}")
            if not self.busy:
                self.progressbar_reset()
            else:
                self.progressbar_spin()
            return self.busy

        self.add_event_callback(event_cls, _set_busy_state)
        return _set_busy_state, self.busy

I also have project status listeners for what i'd call "Pre Busy Events", something like:

_pre_busy_cb = self._getting_busy_listener(sp_event.ProjectOpened)
_pre_busy_cb = self._getting_busy_listener(sp_event.ProjectCreated)
_pre_busy_cb = self._getting_busy_listener(sp_event.ProjectAboutToClose)
_pre_busy_cb = self._getting_busy_listener(sp_event.ProjectAboutToSave)

So I can in fact put the progressbar on my tool into a "busy state indicator" (spinning), however once the busy state is engaged when something like "opening a project" the progressbar halts.

 

And to be clear, I put a worker on a seperate thread to pump progress to the progressbar.

 

So it seems that some busy states are blocking, and either (or both?) the Qapp and main Python thread are not pumped during these application operations?

 

Any ideas on how I might be able to get around that in a fairly easy, straightforward manner?

 

If for instancer project loading is async (from what I read in the docs), wouldn't it be possible to occasionally pump Python to allow updates (so a UI doesn't appear completely frozen)? 

 

Idea No status
TOPICS
Discussion , Scripting

Views

74

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 Comment
Adobe Employee ,
Dec 01, 2023 Dec 01, 2023

Copy link to clipboard

Copied

LATEST

Hi,

Could you send us a version of your plugin, we could reproduce and figure out the issue.

Send it to sainteca@adobe.com

Kind Regards,

Geoffroy SC

Votes

Translate

Translate

Report

Report
Resources