def requestUpdateProfile(self, profileRoi): """Request to update a specific profile ROI. :param ~core.ProfileRoiMixIn profileRoi: """ if profileRoi.computeProfile is None: return threadPool = silxGlobalThreadPool() # Clean up deprecated runners for runner in list(self._pendingRunners): if not inspect.isValid(runner): self._pendingRunners.remove(runner) continue if runner.getRoi() is profileRoi: if threadPool.tryTake(runner): self._pendingRunners.remove(runner) item = self.getPlotItem() if item is None or not isinstance(item, profileRoi.ITEM_KIND): # This item is not compatible with this profile profileRoi._setPlotItem(None) profileWindow = profileRoi.getProfileWindow() if profileWindow is not None: profileWindow.setProfile(None) return profileRoi._setPlotItem(item) runner = _RunnableComputeProfile(threadPool, item, profileRoi) runner.runnerFinished.connect(self.__cleanUpRunner) runner.resultReady.connect(self.__displayResult) self._pendingRunners.append(runner) threadPool.start(runner)
def test(self): """Test functions of silx.gui.qt.inspect module""" self.assertIsNotNone(qt_inspect) parent = qt.QObject() self.assertTrue(qt_inspect.isValid(parent)) self.assertTrue(qt_inspect.createdByPython(parent)) self.assertTrue(qt_inspect.ownedByPython(parent)) obj = qt.QObject(parent) self.assertTrue(qt_inspect.isValid(obj)) self.assertTrue(qt_inspect.createdByPython(obj)) self.assertFalse(qt_inspect.ownedByPython(obj)) del parent self.assertFalse(qt_inspect.isValid(obj))
def colormapDialog(qapp, qapp_utils): dialog = ColormapDialog.ColormapDialog() dialog.setAttribute(qt.Qt.WA_DeleteOnClose) yield weakref.proxy(dialog) qapp.processEvents() from silx.gui.qt import inspect if inspect.isValid(dialog): dialog.close() qapp.processEvents()