====================== SplineEditor (hwx.gui) ====================== Compsite widget to edit a math.Spline Contains: - A Table on the left to enter the X, Y values - A Plot on the left to visualize and drag the values - Buttons on the top of the table to add/insert/remove values and read/write csv Like other widgets you can specify a command parameter that is a method that gets called when the spline changes. Inherits: - :ref:`Frame (hwx.gui)` ---------- Properties ---------- +----------------------+----------------------+----------------------+ | interpolationMethod_ | interpolationNpts_ | spline_ | +----------------------+----------------------+----------------------+ -------------- Public Methods -------------- +--------------------------------------------------------------+ | clearSelection_ (self) | +--------------------------------------------------------------+ | createContents_ (self) | +--------------------------------------------------------------+ | decorateContents_ (self) | +--------------------------------------------------------------+ | deleteSelected_ (self) | +--------------------------------------------------------------+ | enableDragAndDrop_ (self, *widgets) | +--------------------------------------------------------------+ | getSelectedRows_ (self) | +--------------------------------------------------------------+ | layoutContents_ (self) | +--------------------------------------------------------------+ | okToDrop_ (self, fname) | +--------------------------------------------------------------+ | onDrop_ (self, fname) | +--------------------------------------------------------------+ | onPlotSelected_ (self, points) | +--------------------------------------------------------------+ | onSplineModified_ (self, selectRow=None, fitPlot='selected') | +--------------------------------------------------------------+ | onTableSelected_ (self, rows) | +--------------------------------------------------------------+ | readCsv_ (self, fname=None) | +--------------------------------------------------------------+ | selectRow_ (self, row) | +--------------------------------------------------------------+ | setSpline_ (self, spline, clearSelection=True, fitPlot=True) | +--------------------------------------------------------------+ | writeCsv_ (self, fname=None) | +--------------------------------------------------------------+ ---------------- Property Details ---------------- .. _interpolationMethod: .. method:: interpolationMethod The interpolation method. .. _interpolationNpts: .. method:: interpolationNpts The number of samples to generate. .. _spline: .. method:: spline The spline object. -------------- Method Details -------------- .. _clearSelection: .. method:: clearSelection(self) Unselects all table rows and plot points. .. _createContents: .. method:: createContents(self) Creates the contents for the SplineEditor. .. _decorateContents: .. method:: decorateContents(self) Called when cells from the table are selected so we can disable the the delete button if needed. .. _deleteSelected: .. method:: deleteSelected(self) Called if the user hits the key or clicks the delete button to delete the selected points. .. _enableDragAndDrop: .. method:: enableDragAndDrop(self, *widgets) Enables dragging and dropping of csv file into the SplineEditor. :param widgets: The widgets to be enabled drag and drop. :type widgets: collection .. _getSelectedRows: .. method:: getSelectedRows(self) Returns a list of indices of the selected rows. .. _layoutContents: .. method:: layoutContents(self) Creates the layout for the SplineEditor. .. _okToDrop: .. method:: okToDrop(self, fname) Returns if the file dropped is a csv file. :param fname: CSV file path. :type fname: str :returns: True if the file to dropped is a csv file, otherwise False :rtype: bool .. _onDrop: .. method:: onDrop(self, fname) Reads the csv file on drop. :param fname: CSV file path. :type fname: str .. _onPlotSelected: .. method:: onPlotSelected(self, points) Called when user selects points in the plot to select the corresponding table rows. :param points: The selected from user points in the plot. :type points: Union[Point, list[Point]] .. _onSplineModified: .. method:: onSplineModified(self, selectRow=None, fitPlot='selected') Called when the the spline changes, that happens when: - A table cell value was changed. - A plot point was modified (mouse up, not drag). - One of the buttons was clicked. :param selectRow: The row index to select the modified spline from the table. :type selectRow: int :param fitPlot: The points of the plot to fit. :type fitPlot: str .. _onTableSelected: .. method:: onTableSelected(self, rows) Called when user selects cells in the table to select the corresponding plot points. :param rows: The selected row or list of row indices from the table. :type rows: Union[int, list[int]] .. _readCsv: .. method:: readCsv(self, fname=None) Reads spline data from a csv file. :param fname: The CSV file path. :type fname: str .. _selectRow: .. method:: selectRow(self, row) Selects the table row and plot point for the specified row. :param row: A single index of the table or list of indices. :type row: Union[int, list] .. _setSpline: .. method:: setSpline(self, spline, clearSelection=True, fitPlot=True) Sets the specified spline in SplineEditor table and plot. :param spline: The spline containing x/y values to be set. :type spline: Spline :param clearSelection: Determines whether to remove selection from the SplineEditor. :type clearSelection: bool, optional :param fitPlot: Determines whether to fit the plot inside SplineEditor plot. :type fitPlot: bool, optional .. _writeCsv: .. method:: writeCsv(self, fname=None) Writes a csv file containing the values. :param fname: CSV file path. :type fname: str