Hello! I’m writing a plugin that needs to do some computationally-heavy or otherwise time-intensive processing behind a UI implemented in vanilla. I have two bottlenecks right now:
I need to run updates on large portions (all Uppercase to Uppercase pairs, for example) of the
Glyphs.font.kerningdictionary fairly regularly. Iterating across all these pairs takes a prohibitively long time – especially if the UI is blocked during these updates and I can’t show a progress indicator.
I need to make a small-to-medium number of network requests from inside the plugin (say no more than 50), and the network latency waiting for my server to complete its processing and respond is also a bottleneck – again, especially if the UI is blocked and I can’t show a progress indicator.
With those constraints in mind, I have two questions that I’d like advice on:
I’m wondering what my options are for parallelizing kerning table updates and network requests are in Glyphs + pyobjc + python 2.7. I’ve tried working with the multiprocessing module, but I can’t share the kerning table across multiple processes, so updates are still constrained to Glyphs process. How do batch updates to kerning work in the core application?
I’m wondering how to display an updating progress bar during a sequence of network requests, or a set of updates to the kerning table. I’ve tried simply setting the vanilla ProgressBar object during iteration, but the UI never updates. I think this is because control is never released to the UI thread during the work of iteration.
Does anyone have any advice for me in parallizing heavy workloads and display progress during work? I’d really appreciate it!