SDS2 Parametric API
 All Classes Namespaces Functions Variables Pages
List of all members
sds2.lockable.ConnectionLocks Class Reference

Interface to connection design locks on a connection component on a member's end. More...

Methods defined here:

def __contains__
def __enter__
def __eq__
def __exit__
def __getitem__
def __init__
def __len__
def __ne__
def __reduce__
def __repr__
def __setitem__
def __str__
def commit
def has_key
def has_key_with_prefix
def has_key_with_subtring
def items
def keys
def lockables_with_prefix
def lockables_with_substring
def locked_lockables
def update
def values

Data and other attributes defined here:

int __instance_size__ = 184

Data descriptors inherited from Boost.Python.instance:

def __dict__
def __weakref__

Data and other attributes inherited from Boost.Python.instance:

def __new__

Detailed Description

Interface to connection design locks on a connection component on a member's end.

When instantiated, it generates a dictionary of LockableValues that possess the same values and validations as connection design locks member edit.

In order to commit LockableValues to connection design locks, this class must be instantiated as a context manager (using the 'with' keyword).

When not instantiated as a context manager, interaction with the dictionary of LockableValues is still permitted.


|ConnectionLocks tutorial

Standalone Instantiation:

    import sds2.lockable

    ''' Get ConnectionLocks from member 1's left end. '''
    mn = sds2.lockable.ConnectionLocks(1,0)

    ''' Get the LockableValue associated with op_top_op_type. '''
    lk = mn['op_top_op_type']

    ''' Get member edit label corresponding to this LockableValue. '''
    print lk.get_screen_label()

    ''' Modify the LockableValue on the ConnectionLocks object. '''
    lk.set_lock(True)

    '''Try to commit the change to the connection component.
       Since this ConnectionLocks instance was not created as a context manager,
       this operation will throw an exception.'''
    mn.commit()

    '''Assuming a variable spacing LockableValue exists, and it has a key 'spa':
       Try to set it to zero.
       Note: Most spacing fields on member edit do not permit non-positive values.
             Hence, this attempt at setting zero will validate and throw an
             exception.'''
    mn['spa'].set(0)

Instantiation as a context manager:

There are only two differences between a context manager instance of ConnectionLocks and a regular instance:

  1. The member and connection component associated with the ConnectionLocks instance are locked and not externally modifiable until the instance loses scope.
  1. The context manager instance is permitted to modify and write the connection component out to disk.

    import sds2.lockable

    ''' Get ConnectionLocks from member 1's left end, set the top and bottom end preparations to 'Cope plain' and commit the connection component to disk.''' with sds2.lockable.ConnectionLocks(1,0) as mn:

        # dict style update of multiple LockableValues.
        mn.update(op_top_op_type='Cope plain', op_btm_op_type='Cope plain')
        mn.commit()
    

Method resolution order

ConnectionLocks
Boost.Python.instance
builtin.object

Constructor & Destructor Documentation

def sds2.lockable.ConnectionLocks.__init__ (   arg1,
  member_number,
  end_number 
)
Returns
Instance of type None

Member Function Documentation

def sds2.lockable.ConnectionLocks.__contains__ (   self,
  key 
)
Returns
Instance of type bool
def sds2.lockable.ConnectionLocks.__dict__ (   args)
def sds2.lockable.ConnectionLocks.__enter__ (   self)
Returns
Instance of type ConnectionLocks
def sds2.lockable.ConnectionLocks.__eq__ (   arg1,
  arg2 
)
Returns
Instance of type bool
def sds2.lockable.ConnectionLocks.__exit__ (   self,
  ex_type,
  ex_value,
  ex_obj 
)
Returns
Instance of type None
def sds2.lockable.ConnectionLocks.__getitem__ (   self,
  key 
)
Returns
Instance of type LockableValue
def sds2.lockable.ConnectionLocks.__len__ (   self)
Returns
Instance of type int
def sds2.lockable.ConnectionLocks.__ne__ (   arg1,
  arg2 
)
Returns
Instance of type bool
def sds2.lockable.ConnectionLocks.__new__ (   args)
T.__new__(S, ...) -> a new object with type S, a subtype of T
 __new__ = <built-in method __new__ of Boost.Python.class object>
def sds2.lockable.ConnectionLocks.__reduce__ (   args)
 __reduce__ = <unnamed Boost.Python function>(args)
def sds2.lockable.ConnectionLocks.__repr__ (   arg1)
Returns
Instance of type object
def sds2.lockable.ConnectionLocks.__setitem__ (   arg1,
  arg2,
  self 
)
Returns
Instance of type None
def sds2.lockable.ConnectionLocks.__str__ (   arg1)
Returns
Instance of type object
def sds2.lockable.ConnectionLocks.__weakref__ (   args)
def sds2.lockable.ConnectionLocks.commit (   self)
Returns
Instance of type bool
     Apply LockableValues to the associated connection component
     and write it out to disk.
def sds2.lockable.ConnectionLocks.has_key (   self,
  key 
)
Returns
Instance of type bool
     Check if the ConnectionLocks instance has 'key'
def sds2.lockable.ConnectionLocks.has_key_with_prefix (   self,
  prefix 
)
Returns
Instance of type bool
     Check if the ConnectionLocks instance has a key with the specified prefix
def sds2.lockable.ConnectionLocks.has_key_with_subtring (   self,
  substr 
)
Returns
Instance of type bool
     Check if the ConnectionLocks instance has a key with the given substring.
def sds2.lockable.ConnectionLocks.items (   self)
Returns
Instance of type list
def sds2.lockable.ConnectionLocks.keys (   self)
Returns
Instance of type list
def sds2.lockable.ConnectionLocks.lockables_with_prefix (   self,
  prefix 
)
Returns
Instance of type dict
     Returns a subset dictionary with keys having the given prefix.
def sds2.lockable.ConnectionLocks.lockables_with_substring (   self,
  substr 
)
Returns
Instance of type dict
     Returns a subset dictionary with keys having the given substring.
def sds2.lockable.ConnectionLocks.locked_lockables (   self)
Returns
Instance of type dict
     Get a dictionary that contains user-visible locked lockables.
def sds2.lockable.ConnectionLocks.update (   args)
 object update(tuple args, dict kwds) :
     Update a connection's LockableValues with args, kwds if valid.
def sds2.lockable.ConnectionLocks.values (   self)
Returns
Instance of type list

Member Data Documentation

int sds2.lockable.ConnectionLocks.__instance_size__ = 184
staticprivate