On Thu, 27 Oct 2016, 1:29 PM likage <[email protected]> wrote:

> I re-post my message...
>
> @Marcus
> Thanks for the information! Glad to know that I am on track, to be honest,
> I was not able to find much info online, perhaps my searching skill was not
> that great in this aspect :p
>
> @Justin
> Thanks for the code. I have decided to use your format for my code.
>
> Even so, I have a few questions.
> 1. I tried writing a doc string, again I would like to have some insights
> if possible? Instead of writing it after the `init` function, I wrote it
> after the class statement, accordingly to what I have read online
>

I do the same. I document it at the class as opposed to docstrings on the
__init__


> 2. Is there any chance that I will need to add in an `else` statement
> should the self.state not conform to either `self.STATE_ROOT_SELS` or
> `self.STATE_USER_SELS`? Otherwise, I suppose I can stopped such from
> happening in the run_dialog function, right?
>

Can you raise a ValueError if they don't pass a valid constant?


> class HierarchyDialog(QtGui.QDialog):
>     """
>     Keywords:
>         state:
>             Denotes the selection case - 'root node selection' or 'user
> based selection'
>         STATE_ROOT_SELS :
>             States the case if the selection is Root Node
>         STATE_USER_SELS :
>
>             States the case if the selection is User-based
>     """
>
>
>
>
>     # Documenting states
>
>     STATE_ROOT_SELS = "root_sels"
>     STATE_USER_SELS = "user_sels"
>
>
>
>
>     def __init__(self, state, parent=None):
>         QtGui.QDialog.__init__(self, parent)
>         ...
>
>         self.state = state
>
>
>         if self.state == self.STATE_ROOT_SELS:
>             # Run function_A()
>         elif self.state == self.STATE_USER_SELS:
>             # Run function_B()
>
>
>         # Do I need to include in a bogus state if any of the above 2
> conditions are not met
>         else:
>             cmds.warning("Please have a valid selection")
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/f4a75603-ff76-4ff1-8161-0cfb5a088ebb%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/f4a75603-ff76-4ff1-8161-0cfb5a088ebb%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA32vSCPdgqj_3L%2B4hjGadW13HixEyMgnOT0G21iQjVk2w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to