This function is used to apply the domains so that queries for specific values like range min and max retrieve something useful.
(self, parentProxy, proxy_id)
| 2650 | # Taken directly from helper.py, applies domains so we can see real values. |
| 2651 | # -------------------------------------------------------------------------- |
| 2652 | def applyDomains(self, parentProxy, proxy_id): |
| 2653 | """ |
| 2654 | This function is used to apply the domains so that queries for |
| 2655 | specific values like range min and max retrieve something useful. |
| 2656 | """ |
| 2657 | proxy = self.mapIdToProxy(proxy_id) |
| 2658 | |
| 2659 | # Call recursively on each sub-proxy if any |
| 2660 | for property_name in proxy.ListProperties(): |
| 2661 | prop = proxy.GetProperty(property_name) |
| 2662 | if prop.IsA("vtkSMProxyProperty"): |
| 2663 | try: |
| 2664 | if len(prop.Available) and prop.GetNumberOfProxies() == 1: |
| 2665 | listdomain = prop.FindDomain("vtkSMProxyListDomain") |
| 2666 | if listdomain: |
| 2667 | for i in range(listdomain.GetNumberOfProxies()): |
| 2668 | internal_proxy = listdomain.GetProxy(i) |
| 2669 | self.applyDomains( |
| 2670 | parentProxy, internal_proxy.GetGlobalIDAsString() |
| 2671 | ) |
| 2672 | except: |
| 2673 | exc_type, exc_obj, exc_tb = sys.exc_info() |
| 2674 | print("Unexpected error:", exc_type, " line: ", exc_tb.tb_lineno) |
| 2675 | |
| 2676 | # Reset all properties to leverage domain capabilities |
| 2677 | for prop_name in proxy.ListProperties(): |
| 2678 | if prop_name == "Input": |
| 2679 | continue |
| 2680 | try: |
| 2681 | skipReset = False |
| 2682 | prop = proxy.GetProperty(prop_name) |
| 2683 | iter = prop.NewDomainIterator() |
| 2684 | iter.Begin() |
| 2685 | while not iter.IsAtEnd(): |
| 2686 | domain = iter.GetDomain() |
| 2687 | iter.Next() |
| 2688 | |
| 2689 | try: |
| 2690 | if domain.IsA("vtkSMBoundsDomain"): |
| 2691 | domain.SetDomainValues( |
| 2692 | parentProxy.GetDataInformation().GetBounds() |
| 2693 | ) |
| 2694 | except AttributeError as attrErr: |
| 2695 | skipReset = True |
| 2696 | print( |
| 2697 | "Caught exception setting domain values in apply_domains:" |
| 2698 | ) |
| 2699 | print(attrErr) |
| 2700 | |
| 2701 | if not skipReset: |
| 2702 | prop.ResetToDefault() |
| 2703 | |
| 2704 | # Need to UnRegister to handle the ref count from the NewDomainIterator |
| 2705 | iter.UnRegister(None) |
| 2706 | except: |
| 2707 | exc_type, exc_obj, exc_tb = sys.exc_info() |
| 2708 | print("Unexpected error:", exc_type, " line: ", exc_tb.tb_lineno) |
| 2709 |
no test coverage detected