On Tue, Feb 16, 2016 at 10:34 PM Mahmoodreza Aarabi <madoo...@gmail.com>
wrote:

> Justin, got it, i'm on your boat, but i mean if there is a situation that
> give me wrong result i like to know. why not!
>

No problem :-) That's why I gave you a situation that gives a wrong result.
Just lookin out for you, my friend!


>
> thanks man
>
> On Tue, Feb 16, 2016 at 12:38 PM, Justin Israel <justinisr...@gmail.com>
> wrote:
>
>>
>>
>> On Tue, Feb 16, 2016 at 8:32 PM md <accou...@mdonovan.com> wrote:
>>
>>> Ok ... so thanks to everyone for the help ...
>>>
>>> *Eric *... I did need to have (*args) in the function definition that
>>> shows my window.
>>>
>>> *Justin *... I did end up restructuring my window creation/parenting as
>>> follows ...
>>>
>>>     def __init__(self, parent=None):
>>>         if parent is None:
>>>             parent = maya_main_window()
>>>             super(smRealCameras, self).__init__(parent)
>>>
>>> *Mahmoodreza *... you post made me realize that I need to have
>>> a specific function to call from usersetup.py (  def window_show(*args): )
>>>
>>> The only issue I am running into now is that even though i am doing a
>>> try/except to check to see if the window is already created, when I call
>>> the script from my menu, it ignores the test and allows me to create
>>> multiple instances of the windows. Here is the function to test and show
>>> the window.
>>>
>>> def sm_real_cam_show(*args):
>>>     try:
>>>         cam_win.deleteLater()
>>>     except:
>>>         pass
>>>
>>>     cam_win = smRealCameras()
>>>
>>>     try:
>>>         cam_win.create()
>>>         cam_win.show()
>>>     except:
>>>         cam_win.deleteLater()
>>>         traceback.print_exc()
>>>
>>>  Aside from that issue its working.
>>>
>>
>> As much as I hate suggesting globals... the reason this isn't working as
>> expected is because you are always working with a local "cam_win" variable
>> and doing a naked exception handling, so you don't see the real error. If
>> you were to save the object in a global, then you would end up being able
>> to delete the previous one and create a new unique one:
>>
>> _CAM_WIN = None
>>
>> def sm_real_cam_show(*args):
>>     global _CAM_WIN
>>
>>     if _CAM_WIN is not None:
>>         try:
>>             _CAM_WIN.deleteLater()
>>         except RuntimeError:
>>             pass
>>
>>     _CAM_WIN = smRealCameras()
>>
>>
>>
>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Python Programming for Autodesk Maya" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to python_inside_maya+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/python_inside_maya/339bbd0f-6498-4c87-905e-793baf1658c6%40googlegroups.com
>>> <https://groups.google.com/d/msgid/python_inside_maya/339bbd0f-6498-4c87-905e-793baf1658c6%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Python Programming for Autodesk Maya" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to python_inside_maya+unsubscr...@googlegroups.com.
>>
> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3nWWLYoee7UJiQ9DZ1Osv_Z5WMnrFz%2BN%3DJvq6xjo1i5g%40mail.gmail.com
>> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3nWWLYoee7UJiQ9DZ1Osv_Z5WMnrFz%2BN%3DJvq6xjo1i5g%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>
>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
>
>
> Bests,
> madoodia
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/CADvbQw%2BsStz-Pf6G-FNSpWqsXR6UWCLm5YqbX%3Db9R0GwgzzH0w%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CADvbQw%2BsStz-Pf6G-FNSpWqsXR6UWCLm5YqbX%3Db9R0GwgzzH0w%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0ofeY97s1cC%3DitobkNwN_481j6uPkLXSnMCET6V8sKkA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to