return int(string)\r
\r
\r
+class FloatProperty (Property):\r
+ def __init__(self, **kwargs):\r
+ assert 'type' not in kwargs, kwargs\r
+ if 'default' not in kwargs:\r
+ kwargs['default'] = 0.0\r
+ super(FloatProperty, self).__init__(type='float', **kwargs)\r
+\r
+ def get_editor(self):\r
+ return wx.grid.GridCellFloatEditor()\r
+\r
+ def get_renderer(self):\r
+ return wx.grid.GridCellFloatRenderer()\r
+\r
+ def value_for_string(self, string):\r
+ return float(string)\r
+\r
+\r
+class ChoiceProperty (Property):\r
+ def __init__(self, choices, **kwargs):\r
+ assert 'type' not in kwargs, kwargs\r
+ if 'default' not in kwargs:\r
+ kwargs['default'] = choices[0]\r
+ super(ChoiceProperty, self).__init__(type='choice', **kwargs)\r
+ self._choices = choices\r
+\r
+ def get_editor(self):\r
+ return wx.grid.GridCellChoiceEditor(choices=self._choices)\r
+\r
+ def get_renderer(self):\r
+ return None\r
+ #return wx.grid.GridCellChoiceRenderer()\r
+\r
#class PyFilesProperty(wxpg.PyArrayStringProperty):\r
# def __init__(self, label, name = wxpg.LABEL_AS_NAME, value=[]):\r
# wxpg.PyArrayStringProperty.__init__(self, label, name, value)\r
default=5,\r
help='help for my int',\r
))\r
+ self.append_property(FloatProperty(\r
+ label='my float',\r
+ default=3.14159,\r
+ help='help for my float',\r
+ ))\r
+ self.append_property(ChoiceProperty(\r
+ choices=['choice A', 'choice B', 'choice C'],\r
+ label='my choice',\r
+ default='choice B',\r
+ help='help for my choice',\r
+ ))\r
\r
def GetRowLabelValue(self, col=0):\r
"""Retrieve the label for a particular column.\r