Repository navigation
Add gallery and Properties-panel editing for MAT-files - #90
Merged
Merged
Conversation
…n the file, and create the one a tile names A MAT-file's Add used to make one plain variable at once. It now opens the gallery, showing the tiles of exactly the classes core says the file can take a new variable of (MatNode.getAllowedTypes): a plain variable, a structure, a string, and the Simulink classes core creates from MATLAB's own default objects, where the file's objects can be added to. The host sends that list with every repaint and repaints again when a gesture changes it, so a class core stops offering leaves the gallery with it; nothing is hard-coded here. The tiles are the dictionary gallery's Design Data ones, since a MAT-file has no sections: no Architectural Data tile, no enumeration, variant or configuration tile, no category left empty, no section badge, and an accessible name that names no section. A MATLAB String tile is the one only a MAT-file offers. A dictionary's gallery is the one it was, tile for tile, and a test pins all 28. A tile's class goes to core's addEntry as it is, so the variable gets the class's own default name and value; the rename after an unpinned add, the pinned run of adds, and undo are the dictionary's. A class core does not list for the file is refused with a message and adds nothing. The guard test creates every tile's variable through core in four files, one with no objects at all, and compares its class and glyph with the tile's.
…th edits: a string's text and a Parameter's Storage Class The tests said a string variable takes no value edit and a Parameter's Storage Class has no editor, which was the core this extension pins today. The core it will be released with writes both: a string's new text, and a Storage Class (the one property of a Parameter's CoderInfo a save writes). The edit test now changes the Storage Class and the Value and reads both back from the saved file, and keeps its refusal: the Header File, which belongs to the CoderInfo too and which no save writes, is refused in core's words, naming the variable and recording nothing. The setRows test says the view offers its gallery of classes rather than adding at once.
…ith no objects, and a read-only one For every class core lists for a MAT-file, a tile's add is one edit, a row of the class with its default name, Status New and its name editor; the save keeps every other variable as the bytes it was read from, and the saved file, opened in another tab, shows the same row and value. Undone and saved, the file holds no trace of it; redone and saved as another file, the copy holds it and the original stays as last saved. Two pinned adds of a class take two names and ask for no name editor. A new Bus takes two elements from its row's Add child and saves them, and loses one by a delete of its row. A Bus the file holds gains one and loses one, every other variable untouched. A file with no objects takes a Parameter and a string, and the save writes its first subsystem. A read-only file is told no classes and takes no add, and a class core does not list is refused. With DEX_GATE_OUT set, each saved file is kept with its original and a manifest for MATLAB's live gate; with DEX_GATE_FIXTURES too, every tile and a Bus element are added to each file of that folder, so the gate can judge files made from originals each MATLAB release wrote.
…s and Simulink objects Two user-facing lines under Unreleased: the Add gallery adds variables, strings and Simulink objects to a MAT-file, and a Bus's elements there can be added and removed.
…operty the table has no column for can be set The inspector was read-only in every editor: it raised an edit event nothing listened to. A user who added a NumericType to a MAT-file could not set its word length, and no Signal's sample time, Bus's data scope or Parameter's data type could be set either, although core takes each of those edits. The MAT-file editor now gives the inspector an edit channel. Shown with one, a row is editable exactly where core's property sheet says it is, and an edit carries the key core's editProperty takes. It is one gesture of the MAT-file editor, as a table edit is: one undo step through core's session, the variable's rows repainted from the tree, and the node shown again, so a NumericType's mode edit refreshes the rows it derives. A refusal is said in the inspector, in core's words and naming the variable, until the next node is shown, and records nothing. An edit of a node no longer on display is dropped. The dictionary and model views give no channel, so their inspector is read-only as before.
…ds: edited, saved and read back, undone, refused For the NumericType, Signal, Bus (and its element), AliasType, ValueType and Parameter the gallery adds, every row the inspector alone offers takes an edit, plus Data Type, which the table shows but does not edit: each one gesture, each shown as typed, and all of them in the saved file as core reads it back, the other variables kept as the bytes they were. A NumericType's fixed-point mode makes its word length editable and its slope follow the fraction length; the mode and fraction edits undo and redo in turn. An identifier set under the Auto storage class is refused with core's reason, naming the variable, and records no edit. The saved files go to the live gate with the same edits as MATLAB statements.
…ited in the Properties panel One more user-facing line under Unreleased.
… than that it could not be done When core's addEntry adds nothing, the editor now shows the reason core gives for it (addEntryRefusal): a class the file takes no new variable of, a file no save of which can be written, objects no new one can join, a name taken. The file is named in it as in every other message, and the gesture records no edit. The host no longer checks the class against the gallery's list itself: core's gate is the one gate, as it is for every other edit. Tested with two classes a MAT-file never takes, and with a variable created and deleted before a save, or created and undone: the save writes the file as it was read, byte for byte, and no subsystem for a file that had none.
…and hold the gallery to core's list of what an Add creates
An inspector edit was named by its property's key, 'Edit dataTypeMode', in VS Code's undo and
redo, and a refused Add with no reason from core by the gallery's class key ('MatlabStruct'). Each
is named as the user sees it now: the inspector's label for the property, the tile's label for the
class.
The guard test holds the gallery to MAT_CREATABLE_CLASSES, the export that replaced
CREATABLE_MCOS_CLASSES and lists exactly the classes an Add creates: every one has a tile, and no
file is told it can take a class outside them and the two plain ones.
…nd edits every property one shows The gallery, the Bus element rows and the Properties panel edits were built and tested against this core before its release; the pin now names the tag. The lockfile resolves v1.45.0 to 58b7289, and every lockfile resolution points at the public registry.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pins data-explorer-core v1.45.0 (mathworks/data-explorer-core#163), resolved to 58b7289.
What it does
varat once.Tests
Unit: 3,693 passed (against the v1.45.0 pin). A guard test creates every MAT tile through core and checks its class and glyph. The dictionary galleries' 28 tiles are pinned as they were.
Integration: 342 passing, 0 failing, 1 pending (against the v1.45.0 pin).
Live MATLAB: files this extension saved, judged in three releases:
The 10 files left out of the older releases come from one R2027a fixture holding a LookupTable. Those releases crash re-saving it even unedited.