pdk.Gui.Widgets.GridWidgets ($Date: 2002/12/11 09:38:17 $)
index
pdk/Gui/Widgets/GridWidgets.py

Custom grid widgets.

FOG 04.2002

 
Classes
            
pdk.Gui.Widgets.CoreWidgets.pdkWidget(pdk.Gui.WidgetStateManagers.StatefulWidget, pdk.Base.OptionHandler)
DataGrid(wxPython.grid.wxGrid, pdk.Gui.Widgets.CoreWidgets.pdkWidget)
TestDataGrid
DictionaryEditor(wxPython.windows.wxPanel, pdk.Gui.Widgets.CoreWidgets.pdkWidget)
ShapeGrid(wxPython.windows.wxPanel, pdk.Gui.Widgets.CoreWidgets.pdkWidget)
FieldSelectionGrid
wxPython.grid.wxGrid(wxPython.grid.wxGridPtr)
DataGrid(wxPython.grid.wxGrid, pdk.Gui.Widgets.CoreWidgets.pdkWidget)
TestDataGrid
wxPython.windows.wxPanel(wxPython.windows.wxPanelPtr)
DictionaryEditor(wxPython.windows.wxPanel, pdk.Gui.Widgets.CoreWidgets.pdkWidget)
ShapeGrid(wxPython.windows.wxPanel, pdk.Gui.Widgets.CoreWidgets.pdkWidget)
FieldSelectionGrid
wxPython.grid.wxPyGridTableBase(wxPython.grid.wxPyGridTableBasePtr)
DataGridTable
 
class DictionaryEditor(wxPython.windows.wxPanel, pdk.Gui.Widgets.CoreWidgets.pdkWidget)
     
Purpose:custom widget to edit the content of a dictionary
Detail:

Defines the following Widget options - "keyDataType": grid data type for the dictionary keys - "valueDataType": grid data type for the dictionary values - "headers" :labels at the top of columns for keys and values - "data" : initial data (a dictionary)

Value data types are

  • standard:

    wxGRID_VALUE_NUMBER for number values wxGRID_VALUE_STRING for string values wxGRID_VALUE_CHOICE for choice (categorical) values wxGRID_VALUE_BOOL for boolean values default: wxGRID_VALUE_STRING

  • custom:

    wxGRID_VALUE_DATETIME for date/time values wxGRID_VALUE_FILENAME for file name values

Note that there is no type conversion from number literals to actual numbers in the data returned by the .getData method; likewise, all data that are passed in with .setData should be strings.


 
  
Method resolution order:
DictionaryEditor
wxPython.windows.wxPanel
wxPython.windows.wxPanelPtr
wxPython.windows.wxWindowPtr
wxPython.windows.wxEvtHandlerPtr
wxPython.misc.wxObjectPtr
pdk.Gui.Widgets.CoreWidgets.pdkWidget
pdk.Gui.WidgetStateManagers.StatefulWidget
pdk.Base.OptionHandler

Methods defined here:
OnDelete(self, ev)
OnGridCellChanged(self, ev)
OnGridCellLeftClick(self, ev)
OnGridCellLeftDClick(self, ev)
OnGridCellSelect(self, ev)
OnGridRangeSelect(self, ev)
OnKillFocus(self, ev)
OnNew(self, ev)
OnSize(self, ev)
__getattr__(self, attr)
# we forward attribute requests to the grid, since this is really only # a thin customization wrapper around a grid:
__init__(self, parent, wxId, **optionD)
getData(self)
getGrid(self)
setData(self, dataD)

Data and non-method functions defined here:
WIDGETOPTIONS = {'data': {}, 'headers': ('Key', 'Value'), 'keyDataType': 'string', 'valueDataType': 'string'}
 
class FieldSelectionGrid(ShapeGrid)
       
  
Method resolution order:
FieldSelectionGrid
ShapeGrid
wxPython.windows.wxPanel
wxPython.windows.wxPanelPtr
wxPython.windows.wxWindowPtr
wxPython.windows.wxEvtHandlerPtr
wxPython.misc.wxObjectPtr
pdk.Gui.Widgets.CoreWidgets.pdkWidget
pdk.Gui.WidgetStateManagers.StatefulWidget
pdk.Base.OptionHandler

Methods defined here:
GetValue = getSelection(self)
OnLeftClick(self, ev)
SetValue = setSelection(self, selectedCellIndexL)
__init__(self, parent, wxId, **optionD)
draw(self)
getSelection(self)
setSelection(self, selectedCellIndexL)

Data and non-method functions defined here:
WIDGETOPTIONS = {'selectionDisplayStyle': ((255, 255, 255), (0, 0, 0), (0, 0, 0), 2)}
 
class DataGrid(wxPython.grid.wxGrid, pdk.Gui.Widgets.CoreWidgets.pdkWidget)
     
Purpose:an extended wxGrid for displaying of data tables
Detail:
  • all column accesses are by name (i.e., column names of the attached table, a pdk.DataClasses.Table instance) rather than by numeric index
  • allows defining and setting cell/row/columns display styles by name
  • allows storage of arbitrary information with individual columns

Note that a lot of the actual work is delegated to a plugin for the data, a DataGridTable instance.


 
  
Method resolution order:
DataGrid
wxPython.grid.wxGrid
wxPython.grid.wxGridPtr
wxPython.windows.wxScrolledWindowPtr
wxPython.windows.wxPanelPtr
wxPython.windows.wxWindowPtr
wxPython.windows.wxEvtHandlerPtr
wxPython.misc.wxObjectPtr
pdk.Gui.Widgets.CoreWidgets.pdkWidget
pdk.Gui.WidgetStateManagers.StatefulWidget
pdk.Base.OptionHandler

Methods defined here:
GetCellValue(self, row, column)
GetTable(self)
OnIdleColumnLabelWindow(self, ev)
OnLabelLeftClick(self, ev)
OnPaintColumnLabelWindow(self, ev)
SetCellValue(self, row, column, value)
__init__(self, parent, wxId, **optionD)
addCellStyle(self, styleName, cellAttributes)
addColumnStyle(self, styleName, cellAttributes)
addRowStyle(self, styleName, cellAttributes)
addStyle(self, styleType, styleName, cellAttributes)
adds a new attribute style. styleType is one of the GRID_STYLETYPES constants; styleName is used as the identifier for this style; and cellAttributes is a wxGridCellAttr instance carrying the attribute settings.
appendRecord(self, record)
append the pdk.DataClasses.Record record to the grid.
appendTable(self, table)
appends all records of the table pdk.DataClasses.Table table to the grid.
exportTable(self, exportFileNameOrStream, delimiter=None, header=None)
calls .export() on the underlying data grid table.
getColumnInfo(self, columnKeyOrIndex, infoKey=None)
returns the column information (a dictionary) for the column specified by columnKeyOrIndex (a string or an integer). If infoKey is not None, only the value for the specified key is returned.
importTable(self, table, sortBy=None, readOnly=0)
imports the data given in table, a pdk.DataClasses.Table instance, into the grid. If sortBy refers to a valid column key in table, it will be sorted first. If readOnly is True, all columns in the imported table will be marked as readonly.
setCellStyle(self, row, columnKeyOrIndex, styleName)
setColumnInfo(self, columnIndexOrKey, reset=0, **infoD)
associate information given in infoD with the grid column specified by columnIndexOrKey (a string or integer).
setColumnStyle(self, columnKeyOrIndex, styleName)
setRowStyle(self, row, styleName)
sort(self, columnKey)
sort the rows of the grid according to the values in column columnKey (a string).
updateColumnStyle(self, styleName, cellAttributes)
zap(self)
delete all rows of the grid (and the underlying table).

Data and non-method functions defined here:
WIDGETOPTIONS = {'alignment': <pdk.Base.Option object>, 'columnLabelSize': <pdk.Base.Option object>, 'enableDragColumns': <pdk.Base.Option object>, 'enableDragRows': <pdk.Base.Option object>, 'enableGridLines': <pdk.Base.Option object>, 'highlightPenWidth': <pdk.Base.Option object>, 'highlightROPenWidth': <pdk.Base.Option object>, 'margins': <pdk.Base.Option object>, 'rowLabelSize': <pdk.Base.Option object>, 'selectionBackground': <pdk.Base.Option object>, ...}
 
class DataGridTable(wxPython.grid.wxPyGridTableBase)
     
Purpose:allows to plug a table (i.e., instances of the pdk.DataClasses.Table class) into a wxGrid

 
  
Method resolution order:
DataGridTable
wxPython.grid.wxPyGridTableBase
wxPython.grid.wxPyGridTableBasePtr
wxPython.grid.wxGridTableBasePtr
wxPython.misc.wxObjectPtr

Methods defined here:
AppendCols(self, numCols=1)
AppendRows(self, numRows=1)
DeleteCols(self, pos=0, numCols=1)
DeleteRows(self, pos=0, numRows=1)
GetColLabelValue(self, col)
GetNumberCols(self)
GetNumberRows(self)
GetRowLabelValue(self, row)
GetValue(self, row, col)
InsertCols(self, pos=0, numCols=1)
InsertRows(self, pos=0, numRows=1)
IsEmptyCell(self, row, col)
SetValue(self, row, col, value)
__init__(self)
export(self, exportFileNameOrStream, delimiter, header)
exports the table attached to this grid to the file exportFileName. delimiter and header specify the field delimiter and the top header line, respectively.
get(self)
returns the wrapped pdk.DataClasses.Table attached to this grid.
getColumnIndex(self, columnKey)
delegated to the wrapped pdk.DataClasses.Table.
getColumnKey(self, columnIndex)
delegated to the wrapped pdk.DataClasses.Table.
getColumnKeys(self)
delegated to the wrapped pdk.DataClasses.Table.
set(self, table)
attaches the pdk.DataClasses.Table instance %table to this grid table.
sort(self, columnKey, mode)
sorts the wrapped table attached to this grid by the column columnKey and with mode mode (any values accepted by the pdk.DataClasses.Table.sort method).
 
class ShapeGrid(wxPython.windows.wxPanel, pdk.Gui.Widgets.CoreWidgets.pdkWidget)
     
Purpose:base class for grids with custom DCs

 
  
Method resolution order:
ShapeGrid
wxPython.windows.wxPanel
wxPython.windows.wxPanelPtr
wxPython.windows.wxWindowPtr
wxPython.windows.wxEvtHandlerPtr
wxPython.misc.wxObjectPtr
pdk.Gui.Widgets.CoreWidgets.pdkWidget
pdk.Gui.WidgetStateManagers.StatefulWidget
pdk.Base.OptionHandler

Methods defined here:
OnIdle(self, ev)
OnMotion(self, ev)
OnPaint(self, ev)
OnSize(self, ev)
__init__(self, parent, wxId, **optionD)
colorCellRegions(self, regionL)
colors the cell regions given in regionL with the currently selected display style (see .setDisplayStyle method).
colorCellRegionsFromDC(self, regionL, dc, sourceOffset=None, refresh=1)
colors the regions given in %regionL% from the DC %dc%.
colorCells(self, cellIndices=None)
colors the cells given in cellIndexTL using the currently selected display style (see .setDisplayStyle method). If cellIndexTL is None, all cells are colored.
colorCellsFromDC(self, cellIndexTL, dc, refresh=1)
colors the cells given in %cellIndexTL% from the DC %dc%.
convertCellToPixel(self, row, column)
convert the grid index given by row,`column` to x,y grid pixel coordinates.
convertPixelToCell(self, x, y)
convert return x,y in row,col coords
draw(self)
draws the cell grid in the "default" display style. Overwrite this to implement the display of cells with different styles.
editDisplayStyle(self, styleAttribute, value)
changes the style attribute specified by styleAttribute in the currectly selected cell display style to value.
getCellWidth(self)
returns the width of a well in pixels. Note that this is always a function of the pixel size and the number of rows and columns.
getDcType(self)
returns the current DC type.
getDisplayStyle(self)
returns the current cell display style.
getGridSize(self)
returns the grid size in rows x columns.
setDcType(self, dcType)
sets the current DC type.
setDefaultDisplayStyle(self, displayStyleT)
sets the default display style (i.e., the style to use _before_ any other DC`s paint routines get called).
setDisplayStyle(self, displayStyleT)
sets the current cell display style.
setGridSize(self, nRows, nColumns)
sets the grid size to %nRows% rows and %nColumns% columns.

Data and non-method functions defined here:
WIDGETOPTIONS = {'defaultDisplayStyle': ((255, 255, 255), (255, 255, 255), (0, 0, 0), 2), 'shapeExtent': 0.90000000000000002, 'shapeType': 'circle', 'size': (12, 8)}
 
class TestDataGrid(DataGrid)
       
  
Method resolution order:
TestDataGrid
DataGrid
wxPython.grid.wxGrid
wxPython.grid.wxGridPtr
wxPython.windows.wxScrolledWindowPtr
wxPython.windows.wxPanelPtr
wxPython.windows.wxWindowPtr
wxPython.windows.wxEvtHandlerPtr
wxPython.misc.wxObjectPtr
pdk.Gui.Widgets.CoreWidgets.pdkWidget
pdk.Gui.WidgetStateManagers.StatefulWidget
pdk.Base.OptionHandler

Methods defined here:
onPyInit(self)

Data and non-method functions defined here:
WIDGETOPTIONS = {'rowLabelSize': 0}
 
Data
             GRID_STYLETYPES = [0, 1, 2]
wxGRID_VALUE_DATETIME = 109
wxGRID_VALUE_FILENAME = 110
 
Author
            
$Author: gathmann $