def _new_figure_manager_given_figure_impl(num: int, figure): """Create a new figure manager instance for the given figure. Forces all public and non-dunder method calls onto the QApplication thread. """ canvas = MantidFigureCanvas(figure) return force_method_calls_to_qapp_thread( FigureManagerWorkbench(canvas, num))
def test_force_method_calls_to_qapp_thread(self): class Impl: def public(self): pass def _private(self): pass public_only = force_method_calls_to_qapp_thread(Impl()) self.assertTrue(isinstance(public_only.public, QAppThreadCall)) self.assertFalse(isinstance(public_only._private, QAppThreadCall)) all_methods = force_method_calls_to_qapp_thread(Impl(), all_methods=True) self.assertTrue(isinstance(all_methods.public, QAppThreadCall)) self.assertTrue(isinstance(all_methods._private, QAppThreadCall))
def _wrappper(ws): return force_method_calls_to_qapp_thread(InstrumentViewPresenter(ws))