Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helpers ought to auto-generate documentation #4

Open
theodox opened this issue Mar 29, 2014 · 5 comments
Open

helpers ought to auto-generate documentation #4

theodox opened this issue Mar 29, 2014 · 5 comments

Comments

@theodox
Copy link
Owner

theodox commented Mar 29, 2014

right now it just says 'auto-generated', but if we copy all of the flags into help it might make it easier to work with.

@bob-white
Copy link
Collaborator

Were you thinking something along these lines?

class Button(Control):
    """
    Wrapper class for cmds.button
    =============================
    
    Read Only:
    ----------
    - isObscured
    - popupMenuArray
    - numberOfPopupMenus

    Editable:
    ---------
    - actionIsSubstitute
    - actOnPress
    - align
    - label2
    - recomputeSize
    - annotation
    - backgroundColor
    - defineTemplate
    - docTag
    - enable
    - enableBackground
    - exists
    - fullPathName
    - height
    - manage
    - noBackground
    - numberOfPopupMenus
    - parent
    - popupMenuArray
    - preventOverride
    - useTemplate
    - visible
    - visibleChangeCommand
    - width

    Callbacks:
    ----------
    - command
    - dragCallback
    - dropCallback
    - visibleChangeCommand
    """
    CMD = cmds.button
    _ATTRIBS = ['actionIsSubstitute', 'actOnPress', 'align', 'label', 'recomputeSize']
    _CALLBACKS = ['command']

@bob-white
Copy link
Collaborator

Or would we want to go one step further and try to add the command documentation?

class Button(Control):
    """
    Wrapper class for cmds.button
    =============================
    
    Read Only:
    ----------
    - isObscured
        Return whether the control can actually be seen by the user. The control will be obscured if its state is invisible, if it is blocked (entirely or partially) by some other control, if it or a parent layout is unmanaged, or if the control's window is invisible or iconified.
    - popupMenuArray
        Return the names of all the popup menus attached to this control.
    - numberOfPopupMenus
        Return the number of popup menus attached to this control.

    Editable:
    ---------
    - actionIsSubstitute
        This flag is obsolete and should no longer be used.
    - actOnPress
        If true then the command specified by the command flag will be executed when a mouse button is pressed. If false then that command will be executed after the mouse button is released. The default value is false.
    - align
        This flag is obsolete and should no longer be used. The button label will always be center-aligned.
    - label
        The label text. The default label is the name of the control.
    - recomputeSize
        If true then the control will recompute it's size to just fit the size of the label. If false then the control size will remain fixed as you change the size of the label. The default value of this flag is true.
    - annotation
        Annotate the control with an extra string value.
    - backgroundColor
        The background color of the control. The arguments correspond to the red, green, and blue color components. Each component ranges in value from 0.0 to 1.0. 
        When setting backgroundColor, the background is automatically enabled, unless enableBackground is also specified with a false value.
    - defineTemplate
        Puts a command in a mode where any other flags and args are parsed and added to the command template specified in the argument. They will be used as default arguments in any subsequent invocations of the command when templateName is set as the current template.
    - docTag
        Add a documentation flag to the control. The documentation flag has a directory structure like hierarchy. Eg. -dt render/multiLister/createNode/material
    - enable
        The enable state of the control. By default, this flag is set to true and the control is enabled. Specify false and the control will appear dimmed or greyed-out indicating it is disabled.
    - enableBackground
        Enables the background color of the control.
    - exists
        Returns true|false depending upon whether the specified object exists. Other flags are ignored.
    - fullPathName
        Return the full path name of the widget, which includes all the parents
    - height
        The height of the control. The control will attempt to be this size if it is not overruled by parent layout conditions.
    - manage
        Manage state of the control. An unmanaged control is not visible, nor does it take up any screen real estate. All controls are created managed by default.
    - noBackground
        Clear/reset the control's background. Passing true means the background should not be drawn at all, false means the background should be drawn. The state of this flag is inherited by children of this control.
    - parent
        The parent layout for this control.
    - preventOverride
        If true, this flag disallows overriding the control's attribute via the control's right mouse button menu.
    - useTemplate
        Force the command to use a command template other than the current one.
    - visible
        The visible state of the control. A control is created visible by default. Note that a control's actual appearance is also dependent on the visible state of its parent layout(s).
    - width
        The width of the control. The control will attempt to be this size if it is not overruled by parent layout conditions.

    Callbacks:
    ----------
    - command
        Command executed when the control is pressed.
    - dragCallback
    - dropCallback
    - visibleChangeCommand
        Command that gets executed when visible state of the control changes.

    """
    CMD = cmds.button
    _ATTRIBS = ['actionIsSubstitute', 'actOnPress', 'align', 'label', 'recomputeSize']
    _CALLBACKS = ['command']

@bob-white
Copy link
Collaborator

That second option would require a bit more work, as we'd need to parse and reformat the existing documentation.
We'd probably also need to come up with some way of denoting which version of Maya we scraped this info from, as new flags have appeared recently in services packs, and not just in major version updates.

@theodox
Copy link
Owner Author

theodox commented Nov 24, 2016 via email

@theodox
Copy link
Owner Author

theodox commented Jul 29, 2017

maybe the best thing to do is to add a static help() method that just calls the help command on an objects widget? If you're looking at code you have all of the fields (though not their types). Even the maya help doesn't say what things do.. Maybe it's not worth pursuing...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants