schrodinger.infra.table module¶
A pythonic wrapper to an mmlibs mmtable object.
Note that column and row indices start at 1.
Copyright Schrodinger, LLC. All rights reserved.
-
class
schrodinger.infra.table.
TableRow
(table, row)¶ Bases:
object
This class represents a table row–what you get by indexing a Table.
Note that a TableRow should not outlive its corresponding Table.
-
class
schrodinger.infra.table.
Table
(table_file='', table_handle=None, manage=True)¶ Bases:
schrodinger.infra.mmobject.MmObject
Class to handle mmtables. This is largely a wrapper to the underlying C library which stores all the state information.
-
static
setDebug
(state)¶ Enable or disable debug output. Use False or True. Sets this for the class, i.e. affects all instances, current and future.
-
static
initialize
(error_handler=None)¶ Initialize necessary mmlibs (which will also implicitly initialize all the dependent mmlibs)
-
static
terminate
()¶ Terminate various mmlibs (which also implicitly terminates all the libraries they are dependent upon)
-
cellClearData
(row, column)¶ Clears any data in the given cell
-
cellHasData
(row, column)¶ Indicates whether or not the given cell has data
-
columnGetDataName
(column)¶ Returns the data name for the given column
-
columnGetDataType
(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
-
columnGetName
(column)¶ Returns the user name for the given column
-
columnGetPersistent
(column)¶ Returns whether or not the given column is persistent. Only persistent columns will be written to disk.
-
columnGetProperty
(column, prop)¶ Returns the value of the given property for the column
-
columnGetVisible
(column)¶ Returns the visible property for the given column
-
columnGetWidth
(column)¶ Returns the width in characters of the given column
-
columnSetName
(column, name)¶ Sets the user name for the given column
-
columnSetPersistent
(column, persistent)¶ Sets whether or not the given row is persistent. Only persistent columns will be written to disk.
-
columnSetProperty
(column, prop, value)¶ Sets the value of the given property for the column
-
columnSetVisible
(column, visible)¶ Sets the visible property for the given column
-
columnSetWidth
(column, width)¶ Sets the width in characters for the given column
-
deleteAllRows
()¶ Deletes all rows from the table
-
deleteColumn
(column)¶ Delets the given column
-
deleteRow
(row)¶ Deletes the given row
-
getColumnIndex
(name)¶ Returns the column index for the given user or data name
-
getColumnNames
()¶ Return a list of the column data names in this table
-
getColumnTotal
()¶ Returns the number of columns in the table
-
getFirstSelectedRow
()¶ Returns the first selected row–throws an error if no rows are selected.
-
getOrAddColumn
(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.
-
getSelectedRows
()¶ Returns a bitset containing the selected rows
-
getSelectedRowTotal
()¶ Return the total number of selected rows
-
getVisibleColumnTotal
()¶ Returns the number of visible columns
-
getVisibleColumnIndex
(column)¶ Converts an index from the visible columns into the full set of columns
-
getVisibleRowIndex
(row)¶ Converts an index from the visible rows into the full set of rows
-
getVisibleRowTotal
()¶ Returns the number of visible rows
-
insertColumn
(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
(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.
-
isRowSelected
(row)¶ Returns True if the given row is selected, or False otherwise
-
keys
()¶ Returns the column data names
-
makeNestedRowVisible
(row)¶ Expands and makes visible all parents of the given row. Also makes the given row visible, but does not expand it.
-
moveColumn
(from_column, to_column)¶ Moves the given column to the destination column
-
moveRows
(from_rows, to_row)¶ Moves the given rows to the destination row
-
rowGetExpanded
(row)¶ Indicates whether or not the given row is expanded
-
rowGetVisible
(row)¶ Returns the visible property for the given row
-
rowSetExpanded
(row, expanded)¶ Sets the expanded property for the given row. The row can also be set to mm.MMTABLE_ALL_ROWS.
-
rowSetVisible
(row, visible)¶ Sets the visible property for the given row. The row can also be set to mm.MMTABLE_ALL_ROWS.
-
selectAddRows
(rows)¶ This function selects the given rows without deselecting any other rows.
-
selectRows
(rows)¶ This function selects only the given rows.
-
sortRows
(column, ascending)¶ Sorts the rows by the given column in either ascending or descending order
-
unselectRows
(rows)¶ This function unselects the given rows
-
static