Package schrodinger :: Module project :: Class ProjectRow
[hide private]
[frames] | no frames]

Class ProjectRow

object --+
         |
        ProjectRow
Known Subclasses:


ProjectRow allows access to the structure and properties of an entry
in the project.  It is an access mechanism and not a completely
self-contained object - project row objects should be treated as
transient, they may become invalid by subsequent project operations.

This class represents a project entry.

Each row is linked to one entry, but row != entry
Project entry index - project order, entry in project - NOT sorted and
                      NOT same as entry_id
Table row position - changes when table is sorted
Project entry ID - ID of the entry represented by this

Normally it won't be necessary to create an explicit ProjectRow object,
one will be returned by indexing into a ProjectTable object

Instance Methods [hide private]
 
__init__(self, pt, row_number)
Construct a ProjectRow for the given Project instance based on an entry index.
 
__repr__(self)
Return string representation
 
__eq__(self, other)
Test ProjectRow equality by project handle and entry index.
 
__ne__(self, other)
Test ProjectRow inequality by project handle and entry index.
 
getStructure(self, props=True, copy=True)
Returns: Structure: The entry's structure
 
_getStructure(self)
See docstring for structure property
 
setStructure(self, struct, props=True, copy=True)
Set the structure of the entry to the specified structure.
 
_setStructure(self, struct, copy=True)
See docstring for structure property
 
__getitem__(self, prop)
Return property value of C{prop} corresponding to ProjectRow object.
 
__setitem__(self, prop, value)
Set the C{value} for C{prop} in the ProjectRow object.
 
_setValue(self, data_name, data_type, value)
Private function to set a property value
 
__delitem__(self, prop)
Delete the property C{prop} from ProjectRow object.
 
inWorkspace(self)
Obsolete.
 
includeOnly(self)
Include this entry in the workspace and exclude all other entries.
 
_getTitle(self)
 
_setTitle(self, title)
 
_getProjectIndex(self)
The index property is not the same as Project Table row.
 
_getEntryID(self)
 
_getGroup(self)
 
_getEntryInWorkspace(self)
 
_setEntryInWorkspace(self, include)
 
_getEntryIsSelected(self)
 
_setEntryIsSelected(self, select)
 
_getEntryIsReadOnly(self)
 
_setEntryIsReadOnly(self, is_read_only)
 
_getEntryIsDeletable(self)
 
_setEntryIsDeletable(self, deletable)
 
_getCMSStructureReader(self)
If there is no associated cms file, then we return an empty iterator.
 
_getCMSFile(self)
Returns the file instead of the reader.
 
_getSurfaces(self)
Returns an iterator to the available surfaces
 
moveToGroup(self, group_name)
Move this entry to group.
 
ungroup(self)
Remove this entry from its current group.

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

Class Variables [hide private]
  doc = 'Inclusion state of the entry (NOT_IN_WORKSPACE/IN_WORKS...
Properties [hide private]
  structure
This attribute is obsolete.
  title
The title of the entry
  index
Project index of the row.
  entry_id
Entry ID of the row
  group
EntryGroup for the row
  in_workspace
Inclusion state of the entry (NOT_IN_WORKSPACE/IN_WORKSPACE/LOCKED_IN_WORKSPACE) WARNING: This property should NOT be treated as a boolean.
  is_selected
Whether the entry is selected
  read_only
Whether the entry is read only or not
  deletable
Whether the entry is deletable or not
  cms_structure_reader
Return StructureReader for associated CMS file or EmptyIterator if there is no associated file
  cms_file
Return associated CMS file or None if there is no associated file
  surfaces
Return an interator to the surface objects available for this entry

Inherited from object: __class__

Method Details [hide private]

__init__(self, pt, row_number)
(Constructor)

 

Construct a ProjectRow for the given Project instance based on an entry index.

Overrides: object.__init__

__repr__(self)
(Representation operator)

 

Return string representation

Overrides: object.__repr__

getStructure(self, props=True, copy=True)

 

Returns:
Structure:  The entry's structure

Arguments:
props:      True  - Associated properties are included
            in the returned Structure.
            False - Associated properties are excluded from
            the returne Structure.
copy:       True  - Makes and returns a duplicate of the entry's CT
            False - Returns the original CT for the entry

WARNING: The current default (copy=True) is to make a duplicate
of the entry's structure.  These will be marked for garbage
collection once they go out of scope in the calling code, but if,
for example, you are in a loop your memory usage will grow until
the loop is exited (and it may even take a while for it to drop
since garbage collection is not necessarily immediate).  This can
cause large memory usage if, for example,  you are iterating over
a large number entries.  In some cases you may want to
explicitly delete the returned Structure.  For example,
in a loop iterating over a large number of entries you may want to
delete the Structure while still in the loop (after you're
done processing the Structure) to prevent memory bloat.

setStructure(self, struct, props=True, copy=True)

 

Set the structure of the entry to the specified structure.

Arguments:
struct (required) - Set the entry to this Structure object
copy   (optional, default True) -
                    If True, a copy of the Structure (CT) is
                    made and that copy is used to set the entry.

                    If False, the original Structure, struct,
                    is placed into the project table.  Doing this
                    hands off control of struct and you should no
                    longer use struct.

props  (option, default True) -
                    If True, update properties in the entry.
                    If False, properties are ignored.

__getitem__(self, prop)
(Indexing operator)

 

Return property value of C{prop} corresponding to ProjectRow object.
Return None if the property doesn't exist. C{prop} acts as the key.

For example,
    title = proj_row['Title']

__setitem__(self, prop, value)
(Index assignment operator)

 

Set the C{value} for C{prop} in the ProjectRow object.
C{prop} acts as the key of the property.

For example,
    proj_row['Title'] = "Karthik"

__delitem__(self, prop)
(Index deletion operator)

 

Delete the property C{prop} from ProjectRow object.
In addition, this clears the cell in the project table.

For example,
    del proj_row["Title"]

inWorkspace(self)

 

Obsolete. Use ProjectRow.in_workspace property instead.

_getProjectIndex(self)

 

The index property is not the same as Project Table row. This property indicates what order entries were added to the project. This can change when an entry in the project is deleted.

_getCMSStructureReader(self)

 

If there is no associated cms file, then we return an empty iterator. This allows you to always just write a loop:

  for i in cms_structure_reader:

and avoid checking if cms_structure_reader exists. If it does not, the loop will do nothing.

If there is an associated cms file, then we return a StructureReader that allows one to retrieve the data by iterating.

_getCMSFile(self)

 

Returns the file instead of the reader. This is more convenient to use than the reader in some cases. If there is no associated cms file, then we return None.

moveToGroup(self, group_name)

 

Move this entry to group. If group does not exist it will be created.

Parameters:
  • group_name (string) - name of group, which this entry is moved

Class Variable Details [hide private]

doc

Value:
'''Inclusion state of the entry (NOT_IN_WORKSPACE/IN_WORKSPACE/LOCKED_\
IN_WORKSPACE)
WARNING: This property should NOT be treated as a boolean.'''

Property Details [hide private]

structure


This attribute is obsolete. Please use ProjectRow.getStructure() and
ProjectRow.setStructure() instead.

Reference for the entry Structure.  Associated properties are not included.
Properties can be accessed directly from the project via getPropertyNames()

If you wish to update a structure in the project, you may work on that
structure directly. Do something like:

for row in pt.selected_rows:
  for atom in row.structure.atom
    atom.color = 44 #blue

You must be careful that the project entry you modify is not also
currently included in the Workspace.  When that entry is excluded
from the Workspace, its updated contents will be placed into the
entry in the project, potentially overwriting any direct changes
you made to the project entry.

If you want to pass the returned structure to another operation, make a
copy of it first as follows:
    st = row.structure.copy()

The Structure returned by row.structure will be invalid after the entry is
edited by Maestro or after setting row.structure to another structure.

WARNING: If you are working with large numbers of entries, you
may experience high memory usage.  This typically happens when
retrieving structures while iterating over large number of entries,
but will increase for every structure you retrieve. So if your
cumulative total of retrieved structurs is large then your memory
foot print is likely to be large as well.   This is because
the returned structures are configured not to be garbage collected.
You may wish to explicitly delete each Structure once you've finished
processing it in order to minimize memory usage.

Get Method:
_getStructure(self) - See docstring for structure property
Set Method:
_setStructure(self, struct, copy=True) - See docstring for structure property

title

The title of the entry

Get Method:
_getTitle(self)
Set Method:
_setTitle(self, title)

index

Project index of the row. This is different from Project Table row number.

Get Method:
_getProjectIndex(self) - The index property is not the same as Project Table row.

entry_id

Entry ID of the row

Get Method:
_getEntryID(self)

group

EntryGroup for the row

Get Method:
_getGroup(self)

in_workspace

Inclusion state of the entry (NOT_IN_WORKSPACE/IN_WORKSPACE/LOCKED_IN_WORKSPACE) WARNING: This property should NOT be treated as a boolean.

Get Method:
_getEntryInWorkspace(self)
Set Method:
_setEntryInWorkspace(self, include)

is_selected

Whether the entry is selected

Get Method:
_getEntryIsSelected(self)
Set Method:
_setEntryIsSelected(self, select)

read_only

Whether the entry is read only or not

Get Method:
_getEntryIsReadOnly(self)
Set Method:
_setEntryIsReadOnly(self, is_read_only)

deletable

Whether the entry is deletable or not

Get Method:
_getEntryIsDeletable(self)
Set Method:
_setEntryIsDeletable(self, deletable)

cms_structure_reader

Return StructureReader for associated CMS file or EmptyIterator if there is no associated file

Get Method:
_getCMSStructureReader(self) - If there is no associated cms file, then we return an empty iterator.

cms_file

Return associated CMS file or None if there is no associated file

Get Method:
_getCMSFile(self) - Returns the file instead of the reader.

surfaces

Return an interator to the surface objects available for this entry

Get Method:
_getSurfaces(self) - Returns an iterator to the available surfaces