executing code when scripted module becomes visible

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

executing code when scripted module becomes visible

Tiziano D'Albis
Dear Slicer experts,

I am writing a Slicer Python scripted module. I would like to have a
function to be executed whenever my module becomes visible/invisible
(the user selects/deselects my module from the menu).
How could I do that?

Thanks a lot
Tiziano
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
Reply | Threaded
Open this post in threaded view
|

Re: executing code when scripted module becomes visible

Kikinis, Ron,M.D.
Hi,
Edit/Application Settings allows you to decide which modules are
initialized at start time. It does require restarting slicer. The
alternative would be to create a python based workflow (see for instance
the DWI to full brain tractography). If you want to go that route, you
should switch to the slicer developer mailing list.
Ron

On 2/20/13 8:53 AM, Tiziano D'Albis wrote:

> Dear Slicer experts,
>
> I am writing a Slicer Python scripted module. I would like to have a
> function to be executed whenever my module becomes visible/invisible
> (the user selects/deselects my module from the menu).
> How could I do that?
>
> Thanks a lot
> Tiziano
> _______________________________________________
> slicer-users mailing list
> [hidden email]
> http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
> To unsubscribe: send email to [hidden email] with unsubscribe as the subject
>

_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject

Screen Shot 2013-02-20 at 9.03.24 AM.png (61K) Download Attachment
Screen Shot 2013-02-20 at 9.05.26 AM.png (184K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: executing code when scripted module becomes visible

Andrey Fedorov
Tiziano,

You need to implement enter() function in your module. It will be
called when module is activated (example:
https://github.com/Slicer/Slicer/blob/master/Modules/Scripted/Scripts/Editor.py#L73)

If I understood your question correctly, this discussion should be
moved to the developer list.

AF



On Wed, Feb 20, 2013 at 9:07 AM, Ron Kikinis <[hidden email]> wrote:

> Hi,
> Edit/Application Settings allows you to decide which modules are initialized
> at start time. It does require restarting slicer. The alternative would be
> to create a python based workflow (see for instance the DWI to full brain
> tractography). If you want to go that route, you should switch to the slicer
> developer mailing list.
> Ron
>
>
> On 2/20/13 8:53 AM, Tiziano D'Albis wrote:
>>
>> Dear Slicer experts,
>>
>> I am writing a Slicer Python scripted module. I would like to have a
>> function to be executed whenever my module becomes visible/invisible
>> (the user selects/deselects my module from the menu).
>> How could I do that?
>>
>> Thanks a lot
>> Tiziano
>> _______________________________________________
>> slicer-users mailing list
>> [hidden email]
>> http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
>> To unsubscribe: send email to
>> [hidden email] with unsubscribe as the
>> subject
>>
>
>
> _______________________________________________
> slicer-users mailing list
> [hidden email]
> http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
> To unsubscribe: send email to [hidden email]
> with unsubscribe as the subject
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
Reply | Threaded
Open this post in threaded view
|

Re: executing code when scripted module becomes visible

Julien Finet
In reply to this post by Kikinis, Ron,M.D.
Hi,

From your widget, you can implement the "enter" and "exit" methods:

Hope this helps,
Julien.


On Wed, Feb 20, 2013 at 9:07 AM, Ron Kikinis <[hidden email]> wrote:
Hi,
Edit/Application Settings allows you to decide which modules are initialized at start time. It does require restarting slicer. The alternative would be to create a python based workflow (see for instance the DWI to full brain tractography). If you want to go that route, you should switch to the slicer developer mailing list.
Ron


On 2/20/13 8:53 AM, Tiziano D'Albis wrote:
Dear Slicer experts,

I am writing a Slicer Python scripted module. I would like to have a
function to be executed whenever my module becomes visible/invisible
(the user selects/deselects my module from the menu).
How could I do that?

Thanks a lot
Tiziano
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject



_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
Reply | Threaded
Open this post in threaded view
|

Re: executing code when scripted module becomes visible

Tiziano D'Albis
Hi,

Thanks a lot Julien that worked well! I saw the file you linked but I was not sure if and how I could override C++ methods from Python, given that  my widget does not look to inherit from anything in Python code.

Best
Tiziano

On 02/20/2013 03:26 PM, Julien Finet wrote:
Hi,

From your widget, you can implement the "enter" and "exit" methods:

Hope this helps,
Julien.


On Wed, Feb 20, 2013 at 9:07 AM, Ron Kikinis <[hidden email]> wrote:
Hi,
Edit/Application Settings allows you to decide which modules are initialized at start time. It does require restarting slicer. The alternative would be to create a python based workflow (see for instance the DWI to full brain tractography). If you want to go that route, you should switch to the slicer developer mailing list.
Ron


On 2/20/13 8:53 AM, Tiziano D'Albis wrote:
Dear Slicer experts,

I am writing a Slicer Python scripted module. I would like to have a
function to be executed whenever my module becomes visible/invisible
(the user selects/deselects my module from the menu).
How could I do that?

Thanks a lot
Tiziano
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject



_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject



_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
Reply | Threaded
Open this post in threaded view
|

Re: executing code when scripted module becomes visible

Jean-Christophe Fillion-Robin
Hi Tiziano, 

Julien pointer you to the class named "qSlicerSCRIPTEDLoadableModule" that is in charge of bridging the C++ Slicer framework with any python class implementing the "loadable" module interface.

In other word, within python, if you add a method "enter" or "exit", these ones will be called when appropriate.

Hth
Jc


On Wed, Feb 20, 2013 at 9:32 AM, Tiziano D'Albis <[hidden email]> wrote:
Hi,

Thanks a lot Julien that worked well! I saw the file you linked but I was not sure if and how I could override C++ methods from Python, given that  my widget does not look to inherit from anything in Python code.

Best
Tiziano

On 02/20/2013 03:26 PM, Julien Finet wrote:
Hi,

From your widget, you can implement the "enter" and "exit" methods:

Hope this helps,
Julien.


On Wed, Feb 20, 2013 at 9:07 AM, Ron Kikinis <[hidden email]> wrote:
Hi,
Edit/Application Settings allows you to decide which modules are initialized at start time. It does require restarting slicer. The alternative would be to create a python based workflow (see for instance the DWI to full brain tractography). If you want to go that route, you should switch to the slicer developer mailing list.
Ron


On 2/20/13 8:53 AM, Tiziano D'Albis wrote:
Dear Slicer experts,

I am writing a Slicer Python scripted module. I would like to have a
function to be executed whenever my module becomes visible/invisible
(the user selects/deselects my module from the menu).
How could I do that?

Thanks a lot
Tiziano
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject



_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject



_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject



--
+1 919 869 8849

_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject