\r
def _setup_toolbar(self, sizer):\r
self._c['toolbar'] = NavToolbar(self._c['canvas'])\r
+ self._c['x column'] = wx.Choice(\r
+ parent=self._c['toolbar'], choices=[])\r
+ self._c['x column'].SetToolTip(wx.ToolTip('x column'))\r
+ self._c['toolbar'].AddControl(self._c['x column'])\r
+ self._c['x column'].Bind(wx.EVT_CHOICE, self._on_x_column)\r
+ self._c['y column'] = wx.Choice(\r
+ parent=self._c['toolbar'], choices=[])\r
+ self._c['y column'].SetToolTip(wx.ToolTip('y column'))\r
+ self._c['toolbar'].AddControl(self._c['y column'])\r
+ self._c['y column'].Bind(wx.EVT_CHOICE, self._on_y_column)\r
+\r
self._c['toolbar'].Realize() # call after putting items in the toolbar\r
if wx.Platform == '__WXMAC__':\r
# Mac platform (OSX 10.3, MacPython) does not seem to cope with\r
#self.SetStatusText(coordinateString)\r
\r
def _on_x_column(self, event):\r
- pass\r
+ self._x_column = self._c['x column'].GetStringSelection()\r
+ self.update()\r
\r
def _on_y_column(self, event):\r
- pass\r
+ self._y_column = self._c['y column'].GetStringSelection()\r
+ self.update()\r
\r
def _resize_canvas(self):\r
w,h = self.GetClientSize()\r
super(PlotPanel, self).OnPaint(event)\r
self._c['canvas'].draw()\r
\r
- def set_curve(self, curve, config={}):\r
+ def set_curve(self, curve, config=None):\r
self._curve = curve\r
columns = set()\r
for data in curve.data:\r
self._x_column = self._columns[0]\r
if self._y_column not in self._columns:\r
self._y_column = self._columns[-1]\r
+ if 'x column' in self._c:\r
+ for i in range(self._c['x column'].GetCount()):\r
+ self._c['x column'].Delete(0)\r
+ self._c['x column'].AppendItems(self._columns)\r
+ self._c['x column'].SetStringSelection(self._x_column)\r
+ if 'y column' in self._c:\r
+ for i in range(self._c['y column'].GetCount()):\r
+ self._c['y column'].Delete(0)\r
+ self._c['y column'].AppendItems(self._columns)\r
+ self._c['y column'].SetStringSelection(self._y_column)\r
self.update(config=config)\r
\r
- def update(self, config={}):\r
+ def update(self, config=None):\r
+ if config == None:\r
+ config = self._config # use the last cached value\r
+ else:\r
+ self._config = config # cache for later refreshes\r
self._c['figure'].clear()\r
self._c['figure'].suptitle(\r
self._hooke_frame._file_name(self._curve.name),\r