[Paraview] connecting buttons and python
Sebastien Jourdain
sebastien.jourdain at kitware.com
Thu Feb 22 11:18:03 EST 2018
An example is available here
https://github.com/Kitware/light-viz/blob/master/server/light_viz_protocols.py
On Thu, Feb 22, 2018 at 4:32 AM, Sgouros, Thomas <thomas_sgouros at brown.edu>
wrote:
> There appears to be one more missing piece, though, because my attempt
> provokes an assertion error that appears to be claiming that my protocol,
> derived from a LinkProtocol, is not actually a LinkProtocol:
>
> File "pvsvn.py", line 41, in initialize
>
> self.registerVtkWebProtocol(self.testbutton())
>
> File "/Applications/ParaView-5.4.1-1232-g1496380e37.app/Contents/
> Python/vtkmodules/web/wslink.py", line 63, in registerVtkWebProtocol
>
> self.registerLinkProtocol(protocol)
>
> File "/Applications/ParaView-5.4.1-1232-g1496380e37.app/Contents/Python/wslink/websocket.py",
> line 89, in registerLinkProtocol
>
> assert( isinstance(protocol, LinkProtocol))
>
> AssertionError
>
> At least I think that's what it's saying.
>
> Thank you,
>
> -Tom
>
> On Thu, Feb 22, 2018 at 6:25 AM, Sgouros, Thomas <thomas_sgouros at brown.edu
> > wrote:
>
>> Turns out you can't use capital letters for the protocol options (what
>> should I call them?), according to the discussion at this link. Some people
>> here might find it familiar: https://groups.googl
>> e.com/forum/#!topic/autobahnws/mkjF21Fb8ow
>>
>> -Tom
>>
>>
>>
>> On Wed, Feb 21, 2018 at 7:56 PM, Scott Wittenburg <
>> scott.wittenburg at kitware.com> wrote:
>>
>>> That actually looks ok to me. Why isn't pvpython happy with it? What
>>> version of ParaView are you running? If it's a recent ParaView and the
>>> problem is you can't import wslink, then setting up a virtualenv with the
>>> missing modules (wslink and its dependencies) might be what you need. See
>>> this blog post for more information on how to use pvpython but also bring
>>> in the modules in your virtualenv:
>>>
>>> https://blog.kitware.com/using-pvpython-and-virtualenv/
>>>
>>> If the problem is something else, we might need more details.
>>>
>>> Hope this helps.
>>>
>>> Cheers,
>>> Scott
>>>
>>>
>>>
>>> On Wed, Feb 21, 2018 at 5:44 PM, Sgouros, Thomas <
>>> thomas_sgouros at brown.edu> wrote:
>>>
>>>> Thank you that's very helpful. Where will I find how to define the
>>>> protocols on the python side? I've only found a wslink example that looks
>>>> like this:
>>>>
>>>> from wslink import register as exportRPC
>>>> from wslink.websocket import LinkProtocol
>>>>
>>>> class myProtocol(LinkProtocol):
>>>> def __init__(self):
>>>> super(myProtocol, self).__init__()
>>>>
>>>> @exportRPC("myprotocol.testButton")
>>>> def testButton(self, nothing):
>>>> print("******* HELP ********")
>>>>
>>>> Pvpython isn't happy with this, but I'm not sure where to look for the
>>>> right way to do it.
>>>>
>>>> Thank you,
>>>>
>>>> -Tom
>>>>
>>>> On Wed, Feb 21, 2018 at 6:55 PM, Scott Wittenburg <
>>>> scott.wittenburg at kitware.com> wrote:
>>>>
>>>>> Yes that link is old and broken, but if you navigate through the api
>>>>> docs links, that is working. Here's the direct link to the page you
>>>>> couldn't find though:
>>>>>
>>>>> https://kitware.github.io/paraviewweb/api/IO_WebSocket_ParaV
>>>>> iewWebClient.html
>>>>>
>>>>>
>>>>>
>>>>> On Wed, Feb 21, 2018 at 4:43 PM, Sgouros, Thomas <
>>>>> thomas_sgouros at brown.edu> wrote:
>>>>>
>>>>>> Hello all:
>>>>>>
>>>>>> Got some nice looking buttons and widgets, but I can't seem to find
>>>>>> examples of how to deliver the button press or other widget output to my
>>>>>> pvpython server. I imagine the steps are:
>>>>>>
>>>>>> 1. Create a protocol on the python side. Can I use wslink.register,
>>>>>> or is there paraviewweb functionality I should be using?
>>>>>>
>>>>>> 2. Create a matching protocol on the js side, with
>>>>>> ParaviewWebClient.createClient(), but I'm not seeing how to link the
>>>>>> protocol to a function that can be linked to a button press.
>>>>>>
>>>>>> Also, this page, found via a google search, seems potentially useful,
>>>>>> but gives me a 404.
>>>>>>
>>>>>> https://kitware.github.io/paraviewweb/api/ParaViewWebClient.html
>>>>>>
>>>>>> Many thanks,
>>>>>>
>>>>>> -Tom
>>>>>>
>>>>>> _______________________________________________
>>>>>> Powered by www.kitware.com
>>>>>>
>>>>>> Visit other Kitware open-source projects at
>>>>>> http://www.kitware.com/opensource/opensource.html
>>>>>>
>>>>>> Please keep messages on-topic and check the ParaView Wiki at:
>>>>>> http://paraview.org/Wiki/ParaView
>>>>>>
>>>>>> Search the list archives at: http://markmail.org/search/?q=ParaView
>>>>>>
>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>> https://public.kitware.com/mailman/listinfo/paraview
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Search the list archives at: http://markmail.org/search/?q=ParaView
>
> Follow this link to subscribe/unsubscribe:
> https://public.kitware.com/mailman/listinfo/paraview
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/paraview/attachments/20180222/a7a3bfb0/attachment.html>
More information about the ParaView
mailing list