Package mrv :: Package maya :: Package automation :: Module qa :: Class QAMELMixin
[hide private]
[frames] | no frames]

Class QAMELMixin

source code

object --+
         |
        QAMELMixin

Base class allowing to process MEL baesd plugs as created by our metaclass

Configuration:

The following variables MUST be used to setup this class once you have derived from it:

  • mel_index_proc:
    produdure name with signature func( ) returning string array in following format:

    [n*3+0] = checkname : the name of the check, use CamelCase names or names_with_underscore The checkname is also used as id to identify the check lateron [n*3+1] = description: Single sentence desciption of the check targeted at the end user [n*3+2] = can_fix: Boolean value indicating whether the check can also fix the issue

  • mel_check_proc:
    procedure called to actually process the given check, signature is:

    func( check_name, should_fix ) returning list of strings as follows:

    [0] = x number of fixed items [1] = header [1:1+x] = x fixed items [2+x:n] = n invalid items

    items are either objects or in general anything you check for. The check is considered to be failed if there is at least one invalid item.

    If you fixed items, all previously failed items should now be returned as valid items

static_mel_plugs:
Please note that your class must implemnent plugs and extend the super class result by the result of listMELChecks to dynamically retrieve the available checks

Note: this class assumes it is used on a process

Nested Classes [hide private]
  __metaclass__
Metaclass allowing to create plugs based on a MEL implementation, allowing to decide whether checks are Python or MEL implemented, but still running natively in python
    Configuration
  check_plug_cls
Specialized version of the QACheck allowing to use our own MEL attribute contianiing more information
Instance Methods [hide private]
 
listMELChecks(self)
Returns: list all checks ( Plugs ) available on this class that are implemented in MEL
source code
 
isMELCheck(self, check)
Returns: True if the given check plug is implemented in MEL and can be handled there accordingly
source code
 
_rval_to_checkResult(self, string_array, **kwargs)
Returns: check result as parsed fom string array
source code
 
handleMELCheck(self, check, mode)
Called to handle the given check in the given mode
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]
 
melChecks(cls, predicate=lambda p: True)
Returns: list of MEL checks ( plugs ) representing checks defined by MEL
source code
Class Variables [hide private]
    Configuration
  mel_index_proc = None
hash(x)
  mel_check_proc = None
hash(x)
  static_mel_plugs = True
  check_result_cls = QACheckResult
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

listMELChecks(self)

source code 
Returns:
list all checks ( Plugs ) available on this class that are implemented in MEL

isMELCheck(self, check)

source code 
Returns:
True if the given check plug is implemented in MEL and can be handled there accordingly

_rval_to_checkResult(self, string_array, **kwargs)

source code 
Parameters:
  • kwargs - will be given to initializer of check result instance
Returns:
check result as parsed fom string array

melChecks(cls, predicate=lambda p: True)
Class Method

source code 
Parameters:
  • predicate - only return plug if predicate( item ) yield True
Returns:
list of MEL checks ( plugs ) representing checks defined by MEL

handleMELCheck(self, check, mode)

source code 
Called to handle the given check in the given mode
Returns:
QACheckResult of the result generated by MEL
Raises:
  • RuntimeError - If MEL throws an error