Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Jul 13, 2020

Description of the Pull Request

Major refactoring of the model.ts file. Multiple signals in the widget.ts file replaced with a single more general signal. Name changed from CSVTabularDataEditor to Tabular Data Editor.

Issue being fixed:

None.

Changes proposed:

  1. In model.ts created an interface ICoordinates which defines an object with a row and a column
    In model.ts, created method sliceOut which removes the entry at a given Coordinate.
  2. In model.ts created method insertAt which adds a value to a given Coordinate.
  3. In model.ts created methods to assist the work of sliceOut and insertAt
  4. In model.ts modified setData, addRow,... to utilize sliceOut and insertAt.
  5. In model.ts removed setField as it's function can be handled by applications of sliceOut and then insertAt.
  6. In widget.ts, bundled signals _addRow, _addColumn,... into a single signal _changeModel
  7. In index.ts changed contextMenu commands to use _changeModel.

@ghost ghost requested a review from thegooman July 13, 2020 20:34
@ghost
Copy link
Author

ghost commented Jul 13, 2020

Something I forgot to mention in the description: We can avoid the hassle of shifting when calling getOffsetIndex entirely by seeking indices towards then end first. So for example, if we are removing a column, rather than having to do
for(row=1; row <=model.rowCount('body'); row++) { //some annoying shifting stuff
we just do
for(row=model.rowCount('body'); row>0; row--) { // nice clean code

@thegooman thegooman assigned ghost Jul 13, 2020
@thegooman thegooman changed the title Refactor Model.ts refactor Jul 13, 2020
thegooman
thegooman previously approved these changes Jul 13, 2020
Copy link
Member

@thegooman thegooman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Iterating backward to avoid needing to shift is a genius idea. Good thought!

@thegooman thegooman merged commit 6c003c4 into jupytercalpoly:master Jul 13, 2020
@thegooman thegooman added the refactoring Refactoring, organization, and non-functional improvements label Jul 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring Refactoring, organization, and non-functional improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants