Skip to content

Commit

Permalink
- removed minor details in save json functionality
Browse files Browse the repository at this point in the history
- started testing on save json methods
  • Loading branch information
nick-bessin committed May 13, 2021
1 parent b23752a commit 9213510
Show file tree
Hide file tree
Showing 22 changed files with 66 additions and 48 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
safeJson
saveJson
addColorFrame: aTreeNode
| jsonFrame |

Expand All @@ -7,7 +7,7 @@ addColorFrame: aTreeNode
with: #properties -> {
Dictionary
with: #name -> aTreeNode title
with: #value -> (aTreeNode targetMorph color) asString.
with: #value -> aTreeNode targetColorAsString.
}.

^ jsonFrame.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
safeJson
saveJson
addFrame: aTreeNode

^ { #Position -> [self addPositionFrame: aTreeNode].
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
safeJson
addMorphToJsonWith: aJsonStructure and: aTreeNode
saveJson
addMorphToJson: aJsonStructure with: aTreeNode
| frame MorphJson |

MorphJson := self createStartInformation: aTreeNode.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
safeJson
saveJson
addPositionFrame: aTreeNode
| jsonFrame |

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
safeJson
saveJson
addRotationFrame: aTreeNode
| jsonFrame |

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
safeJson
saveJson
addSizeFrame: aTreeNode
| jsonFrame |

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
safeJson
saveJson
createStartInformation: aTreeNode
| json originMorph |

Expand All @@ -9,19 +9,19 @@ createStartInformation: aTreeNode
with: #properties -> {
Dictionary
with: #name -> 'rotation'
with: #value -> self startRotationValue .
with: #value -> originMorph rotationDegrees.
Dictionary
with: #name -> 'positionX'
with: #value -> originMorph x .
with: #value -> originMorph x.
Dictionary
with: #name -> 'positionY'
with: #value -> originMorph y .
with: #value -> originMorph y.
Dictionary
with: #name -> 'width'
with: #value -> originMorph width .
with: #value -> originMorph width.
Dictionary
with: #name -> 'height'
with: #value -> originMorph height .
with: #value -> originMorph height.
Dictionary
with: #name -> 'color'
with: #value -> (originMorph color) asString
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
safeJson
createStructureWith: aStartTime and: anEndTime
saveJson
createStructure: aStartTime with: anEndTime
| jsonStructure |

jsonStructure := Dictionary
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
safeJson
saveJson
dictionaryToJson: aDictionary
^ String streamContents: [ :stream |
(STON writer on: stream)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ eventHandling
saveAnimations
self updateInformationText: 'Copied animation code to clipboard!'.
Clipboard clipboardText: self selectedTreeNode animationString.
self safeToJson: self selectedTreeNode.
self saveToJson: self selectedTreeNode.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
saveJson
saveToJson: aTreeNode
| jsonStructure jsonString |

jsonStructure := self createStructure: self propertyStartEnd startTime with: self propertyStartEnd endTime.
jsonStructure := self addMorphToJson: jsonStructure with: aTreeNode.

jsonString := self dictionaryToJson: jsonStructure.

self writeJsonToFile: jsonString.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
saveJson
writeJsonToFile: aJsonString
| outputStream fileName|

fileName := UIManager default request: 'Please, enter file name.'.
outputStream := StandardFileStream newFileNamed: fileName, '.json'.
aJsonString storeOn: outputStream.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"class" : {
"open" : "DM 8/4/2020 13:18" },
"instance" : {
"addColorFrame:" : "NB 5/12/2021 09:59",
"addColorFrame:" : "NB 5/13/2021 10:31",
"addFrame:" : "NB 5/12/2021 09:25",
"addMorphToJsonWith:and:" : "NB 5/12/2021 10:10",
"addMorphToJson:with:" : "NB 5/13/2021 10:25",
"addPositionFrame:" : "NB 5/12/2021 10:00",
"addRotationFrame:" : "NB 5/12/2021 10:00",
"addSelectedMorphFor:" : "DM 8/5/2020 21:11",
Expand All @@ -29,8 +29,8 @@
"createPositionPropertyFrom:" : "DM 8/6/2020 10:09",
"createRotationPropertyFrom:" : "DM 7/8/2020 14:29",
"createSizePropertyFrom:" : "DM 7/8/2020 14:29",
"createStartInformation:" : "NB 5/12/2021 10:00",
"createStructureWith:and:" : "NB 5/12/2021 09:59",
"createStartInformation:" : "NB 5/13/2021 10:26",
"createStructure:with:" : "NB 5/13/2021 10:25",
"defaultEmptyPanels" : "DM 8/7/2020 17:37",
"defaultPropertyPanelPosition" : "DM 8/6/2020 10:38",
"dictionaryToJson:" : "NB 5/12/2021 09:37",
Expand Down Expand Up @@ -61,18 +61,17 @@
"propertyTreeMorph" : "DM 6/22/2020 01:28",
"propertyTreeMorph:" : "DM 6/18/2020 08:59",
"resetTargetMorph" : "DM 8/5/2020 20:05",
"safeToJson:" : "NB 5/12/2021 10:49",
"saveAnimations" : "MH 5/10/2021 12:16",
"saveAnimations" : "NB 5/13/2021 09:35",
"saveToJson:" : "NB 5/13/2021 10:25",
"seedProperties" : "DM 8/5/2020 19:54",
"selectMorphByHand" : "DM 8/5/2020 20:07",
"selectedTreeNode" : "JIZ 5/27/2020 15:31",
"selectedTreeNode:" : "DM 8/5/2020 21:06",
"startRotationValue" : "NB 5/12/2021 09:34",
"timelines" : "DM 8/6/2020 10:31",
"timelines:" : "DM 8/6/2020 10:53",
"toolBuilder" : "JIZ 6/3/2020 17:00",
"toolBuilder:" : "JIZ 6/3/2020 16:59",
"updateInformationText:" : "DM 8/4/2020 16:18",
"windowReference" : "DM 8/4/2020 13:19",
"windowReference:" : "DM 8/4/2020 13:19",
"writeJsonToFile:with:" : "NB 5/12/2021 10:40" } }
"writeJsonToFile:" : "NB 5/13/2021 10:24" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
animationsEditor: anObject

animationsEditor := anObject.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
animationsEditor

^ animationsEditor
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
saveJson
setUp
self animationsEditor: AnimationsEditor open.
self animationsEditor addTargetMorph: Morph new.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
saveJson
testAddColorFrame
self animationsEditor selectedTreeNode: AnimationsEditorPropertyColor new.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"class" : {
},
"instance" : {
"animationsEditor" : "NB 5/13/2021 10:44",
"animationsEditor:" : "NB 5/13/2021 10:44",
"setUp" : "NB 5/13/2021 11:04",
"testAddColorFrame" : "NB 5/13/2021 11:02",
"testEmptyPanelsGetter" : "DM 8/7/2020 17:52",
"testEmptyPanelsSetter" : "DM 8/7/2020 17:37",
"testGetDeepestMorph" : "DM 8/4/2020 13:26",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
],
"commentStamp" : "",
"instvars" : [
],
"animationsEditor" ],
"name" : "AnimationsEditorTest",
"pools" : [
],
Expand Down

0 comments on commit 9213510

Please sign in to comment.