collaboration.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. r"""collaboration is a helper module useful for handling synchronisation
  2. in multi-client configuration as well as providing other collaboration
  3. related methods
  4. A simple example:
  5. from paraview import collaboration
  6. collaboration.processServerEvents()
  7. """
  8. #==============================================================================
  9. #
  10. # Program: ParaView
  11. # Module: collaboration.py
  12. #
  13. # Copyright (c) Kitware, Inc.
  14. # All rights reserved.
  15. # See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
  16. #
  17. # This software is distributed WITHOUT ANY WARRANTY; without even
  18. # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  19. # PURPOSE. See the above copyright notice for more information.
  20. #
  21. #==============================================================================
  22. import paraview, re, types, sys, vtk
  23. from paraview import servermanager
  24. def processServerEvents():
  25. """Update the local state based on the notifications received from the server
  26. that have been generated by other clients."""
  27. if servermanager.ActiveConnection:
  28. session = servermanager.ActiveConnection.Session
  29. if session.IsMultiClients() and session.IsNotBusy():
  30. while servermanager.vtkProcessModule.GetProcessModule().GetNetworkAccessManager().ProcessEvents(100):
  31. pass