Turns on the visibility of a given pipeline proxy in the given view. If pipeline proxy and/or view are not specified, active objects are used. :param proxy: The pipeline proxy to show. If not provided, uses the active source. :type proxy: Source proxy. :param view: The view proxy to
(proxy=None, view=None, representationType=None, **params)
| 113 | |
| 114 | # ----------------------------------------------------------------------------- |
| 115 | def Show(proxy=None, view=None, representationType=None, **params): |
| 116 | """Turns on the visibility of a given pipeline proxy in the given view. |
| 117 | If pipeline proxy and/or view are not specified, active objects are used. |
| 118 | |
| 119 | :param proxy: The pipeline proxy to show. If not provided, uses the active source. |
| 120 | :type proxy: Source proxy. |
| 121 | :param view: The view proxy to show the source proxy in. Optional, defaults |
| 122 | to the active view. |
| 123 | :type view: View proxy. |
| 124 | :param representationType: Name of the representation type to use. Optional, |
| 125 | defaults to a suitable representation for the source proxy and view. |
| 126 | :type representationType: str |
| 127 | :return: The representation proxy for the source proxy in the view. |
| 128 | :rtype: Representation proxy.:""" |
| 129 | if proxy == None: |
| 130 | proxy = GetActiveSource() |
| 131 | if ( |
| 132 | not hasattr(proxy, "GetNumberOfOutputPorts") |
| 133 | or proxy.GetNumberOfOutputPorts() == 0 |
| 134 | ): |
| 135 | raise RuntimeError("Cannot show a sink i.e. algorithm with no output.") |
| 136 | if proxy == None: |
| 137 | raise RuntimeError( |
| 138 | "Show() needs a proxy argument or that an active source is set." |
| 139 | ) |
| 140 | if not view: |
| 141 | # If there's no active view, controller.Show() will create a new preferred view. |
| 142 | # if possible. |
| 143 | view = GetActiveView() |
| 144 | controller = servermanager.ParaViewPipelineController() |
| 145 | rep = controller.Show(proxy, proxy.Port, view, representationType) |
| 146 | if rep == None: |
| 147 | raise RuntimeError( |
| 148 | "Could not create a representation object for proxy %s" |
| 149 | % proxy.GetXMLLabel() |
| 150 | ) |
| 151 | for param in params.keys(): |
| 152 | setattr(rep, param, params[param]) |
| 153 | return rep |
| 154 | |
| 155 | |
| 156 | # ----------------------------------------------------------------------------- |