Package schrodinger :: Package infra :: Module table :: Class Table
[hide private]
[frames] | no frames]

Class Table

       object --+    
                |    
mmobject.MmObject --+
                    |
                   Table

Class to handle mmtables. This is largely a wrapper to the underlying C library which stores all the state information.

Instance Methods [hide private]
 
__init__(self, table_file='', table_handle=None, manage=True)
Construct a Table class object either by reading a table file or using a handle to an existing mmtable.
 
_delete(self)
A function to delete this object.
 
__repr__(self)
Return representation suitable for use as a Python expression
 
__str__(self)
Return string representation
 
__int__(self)
Return mmtable handle.
 
__len__(self)
Return the number of rows in the table
 
__getitem__(self, item)
Returns Table Row (if item is an integer) or table property (if item is a string)
 
__setitem__(self, item, value)
This function sets a table-level property
 
__iter__(self)
Return an iterator object
 
cellClearData(self, row, column)
Clears any data in the given cell
 
cellHasData(self, row, column)
Indicates whether or not the given cell has data
 
columnGetDataName(self, column)
Returns the data name for the given column
 
columnGetDataType(self, column)
Returns the data type for the given column
 
columnGetName(self, column)
Returns the user name for the given column
 
columnGetPersistent(self, column)
Returns whether or not the given column is persistent.
 
columnGetProperty(self, column, prop)
Returns the value of the given property for the column
 
columnGetVisible(self, column)
Returns the visible property for the given column
 
columnGetWidth(self, column)
Returns the width in characters of the given column
 
columnSetName(self, column, name)
Sets the user name for the given column
 
columnSetPersistent(self, column, persistent)
Sets whether or not the given row is persistent.
 
columnSetProperty(self, column, prop, value)
Sets the value of the given property for the column
 
columnSetVisible(self, column, visible)
Sets the visible property for the given column
 
columnSetWidth(self, column, width)
Sets the width in characters for the given column
 
deleteAllRows(self)
Deletes all rows from the table
 
deleteColumn(self, column)
Delets the given column
 
deleteRow(self, row)
Deletes the given row
 
getColumnIndex(self, name)
Returns the column index for the given user or data name
 
getColumnNames(self)
Return a list of the column data names in this table
 
getColumnTotal(self)
Returns the number of columns in the table
 
getFirstSelectedRow(self)
Returns the first selected row--throws an error if no rows are selected.
 
getOrAddColumn(self, name, visible)
Finds or adds the given column via data name.
 
getSelectedRows(self)
Returns a bitset containing the selected rows
 
getSelectedRowTotal(self)
Return the total number of selected rows
 
getVisibleColumnTotal(self)
Returns the number of visible columns
 
getVisibleColumnIndex(self, column)
Converts an index from the visible columns into the full set of columns
 
getVisibleRowIndex(self, row)
Converts an index from the visible rows into the full set of rows
 
getVisibleRowTotal(self)
Returns the number of visible rows
 
insertColumn(self, column, name)
Adds the given column before the specified column.
 
insertRow(self, row, file_index)
Adds a row.
 
isRowSelected(self, row)
Returns True if the given row is selected, or False otherwise
 
keys(self)
Returns the column data names
 
makeNestedRowVisible(self, row)
Expands and makes visible all parents of the given row.
 
moveColumn(self, from_column, to_column)
Moves the given column to the destination column
 
moveRows(self, from_rows, to_row)
Moves the given rows to the destination row
 
rowGetExpanded(self, row)
Indicates whether or not the given row is expanded
 
rowGetVisible(self, row)
Returns the visible property for the given row
 
rowSetExpanded(self, row, expanded)
Sets the expanded property for the given row.
 
rowSetVisible(self, row, visible)
Sets the visible property for the given row.
 
selectAddRows(self, rows)
This function selects the given rows without deselecting any other rows.
 
selectRows(self, rows)
This function selects only the given rows.
 
sortRows(self, column, ascending)
Sorts the rows by the given column in either ascending or descending order
 
unselectRows(self, rows)
This function unselects the given rows

Inherited from mmobject.MmObject: __del__

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

Static Methods [hide private]
 
setDebug(state)
Enable or disable debug output.
 
_printDebug(*args)
Print debugging output if enabled
 
initialize(error_handler=None)
Initialize necessary mmlibs (which will also implicitly initialize all the dependent mmlibs)
 
terminate()
Terminate various mmlibs (which also implicitly terminates all the libraries they are dependent upon)
Class Variables [hide private]
  _instances = {}
  _debug = False
hash(x)
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

setDebug(state)
Static Method

 

Enable or disable debug output. Use False or True. Sets this for the class, i.e. affects all instances, current and future.

__init__(self, table_file='', table_handle=None, manage=True)
(Constructor)

 

Construct a Table class object either by reading a table file or using a handle to an existing mmtable.

If a table file is given via table_file, then we read the given mmtable file. If a table handle for an existing table is passed in (via the table_handle argument), then we use that. If neither are given, then we create a new table object owned by this table. Specifying both is an error.

Passing in a table file causes manage=True. When a managed instance goes out of scope or is deleted, garbage collection is performed. One side effect is that the table is deleted.

Passing in a table handle causes manage=False. When a non-managed instance goes out of scope or is deleted the table is left around.

Overrides: object.__init__

_delete(self)

 

A function to delete this object. Required for MmObject interface.

__repr__(self)
(Representation operator)

 

Return representation suitable for use as a Python expression

Overrides: object.__repr__

__str__(self)
(Informal representation operator)

 

Return string representation

Overrides: object.__str__

__int__(self)

 

Return mmtable handle. Can be used with mmtable functions.

Overrides: mmobject.MmObject.__int__

__iter__(self)

 

Return an iterator object

Allows iteration over the selected rows.

To iterate over all rows use: 'for row in range(1, len(table)+1)'

columnGetDataType(self, column)

 

Returns the data type for the given column

Possibilities are: mm.M2IO_BOOLEAN_TYPE, mm.M2IO_INT_TYPE, mm.M2IO_REAL_TYPE, or mm.M2IO_STRING_TYPE

columnGetPersistent(self, column)

 

Returns whether or not the given column is persistent. Only persistent columns will be written to disk.

columnSetPersistent(self, column, persistent)

 

Sets whether or not the given row is persistent. Only persistent columns will be written to disk.

getOrAddColumn(self, name, visible)

 

Finds or adds the given column via data name.

visible indicates whether or not the column should be visible if it is added.

insertColumn(self, column, name)

 

Adds the given column before the specified column. Specify column 1 to insert at the far left of the table (first column) Specify mm.MMTABLE_END to add to the right of the table

insertRow(self, row, file_index)

 

Adds a row.

Set row to 1 to insert at the top of the table or mm.MMTABLE_END to add to the bottom of the table.

If the table has an M2IO_DATA_FILE_INDEX column, the cell's value will be set to file_index (if file_index != 0), or to a unique value if file_index == 0.

makeNestedRowVisible(self, row)

 

Expands and makes visible all parents of the given row. Also makes the given row visible, but does not expand it.

rowSetExpanded(self, row, expanded)

 

Sets the expanded property for the given row. The row can also be set to mm.MMTABLE_ALL_ROWS.

rowSetVisible(self, row, visible)

 

Sets the visible property for the given row. The row can also be set to mm.MMTABLE_ALL_ROWS.