Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeAtHPI committed Apr 8, 2024
1 parent 64e961a commit 4325e66
Show file tree
Hide file tree
Showing 15 changed files with 98 additions and 89 deletions.
1 change: 0 additions & 1 deletion packages/Sandblocks-Babylonian/Object.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ Object >> sbWatchValueMorphFor: aSBWatchValue sized: aSBMorphResizer [
"Objects can choose if they want to apply a changed extent"

^ (SBWatchValue newContainerMorphFor: aSBWatchValue)
"addMorphBack: (SBIcon iconFor: aSBWatchValue watchedValueIdentityHash) asMorph;"
addMorphBack: self asMorph;
yourself
]
2 changes: 1 addition & 1 deletion packages/Sandblocks-Babylonian/SBCluster.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ SBCluster >> visualize [
self newTopRowFrom: (matrix atRow: 1) allButFirst. "ignore placeholder morph"
self newContainerMorph
listDirection: #leftToRight;
cellInset: 5@(-30);
cellInset: 3@3;
addAllMorphsBack: {
self newLeftColumnFrom: (matrix atColumn: 1) allButFirst. "ignore placeholder morph"
SBGrid newDisplaying:
Expand Down
4 changes: 2 additions & 2 deletions packages/Sandblocks-Babylonian/SBCorrelationView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ SBCorrelationView >> buildVariantSelection [
displayPrefixOnly
]

{ #category : #'as yet unclassified' }
{ #category : #accessing }
SBCorrelationView >> buttons [

^ super buttons, {self buildSelectionOptions}
Expand Down Expand Up @@ -130,7 +130,7 @@ SBCorrelationView >> ensureVariantSelectionIn: aMorph [
aMorph addMorph: variantSelection.

selectedVariants
ifNil: [selectedVariants := {} asOrderedCollection]
ifNil: [selectedVariants := {variantSelection object} asOrderedCollection]
ifNotNil: [selectedVariants := selectedVariants select: [:aVariant | self multiverse variants includes: aVariant]].

]
Expand Down
1 change: 1 addition & 0 deletions packages/Sandblocks-Babylonian/SBDiffTabView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ SBDiffTabView >> initialize [

super initialize.

wantsTabCountChanges := true.
isShowingDiff := false.
self hResizing: #spaceFill.
]
Expand Down
13 changes: 10 additions & 3 deletions packages/Sandblocks-Babylonian/SBExample.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,11 @@ SBExample >> run [
self scheduleLastError: nil.
currentProcess := nil.
processRunning := false.
Project current addDeferredUIMessage: [self sendFinishNotification]] forkAt: Processor userBackgroundPriority.
Project current addDeferredUIMessage: [
returnValue reportValues: {returned asSBWatchValue} sized: SBMorphResizer newThumbmail.
returnValue updateDisplay.
self sendFinishNotification]
] forkAt: Processor userBackgroundPriority.

^ currentProcess
]
Expand All @@ -415,7 +419,8 @@ SBExample >> runSetup [

errorDecorator ifNotNil: #detach.
errorDecorator := nil.
traceSize := 0
traceSize := 0.
returnValue clear.
]

{ #category : #execution }
Expand Down Expand Up @@ -444,13 +449,14 @@ SBExample >> self: aBlock args: aCollectionBlock label: aString [
removeAllMorphs;
addMorphBack: (icon := SBIcon iconPause
small;
color: (Color r: 1 g: 1 b: 1);
color: (Color white);
on: #click send: #toggleRunning to: self);
addMorphBack: (nameInput := SBTextBubble new contents: aString);
addMorphBack: (SBStringMorph new contents: 'self:');
addMorphBack: aBlock;
addMorphBack: (SBStringMorph new contents: 'args:');
addMorphBack: aCollectionBlock;
addMorphBack: (returnValue := SBExampleWatchView new);
updateIcon
]

Expand Down Expand Up @@ -517,6 +523,7 @@ SBExample >> stopRunning [

self stopSteppingSelector: #run.
active := false.
returnValue clear.
self updateIcon.

self sandblockEditor allMorphsDo: [:morph | (morph isSandblock and: [morph listensToExamples]) ifTrue: [morph exampleStopped: self]]
Expand Down
4 changes: 2 additions & 2 deletions packages/Sandblocks-Babylonian/SBExampleValueDisplay.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ SBExampleValueDisplay >> initialize [
cellGap: 2;
layoutInset: 2@3;
addAllMorphsBack: {
label := SBStringMorph new visible: false.
label := SBStringMorph new.
statusLabel := SBStringMorph new contents: ''.
self newChangeVizButton};
yourself);
Expand Down Expand Up @@ -136,7 +136,7 @@ SBExampleValueDisplay >> reportValues: aCollectionOfWatchValues name: aString si

display reportValues: aCollectionOfWatchValues sized: aSBMorphResizer.
label contents: aString.
label visible: false.
label visible: aString notEmpty.
hadValue := true
]

Expand Down
6 changes: 4 additions & 2 deletions packages/Sandblocks-Babylonian/SBExampleWatch.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ SBExampleWatch >> initialize [
hResizing: #spaceFill;
listCentering: #bottomRight;
addMorphBack: dimensionOptions;
addMorphBack: modifyExpression
yourself};
yourself
]
Expand Down Expand Up @@ -447,7 +448,8 @@ SBExampleWatch >> modifyExpression [
SBExampleWatch >> modifyExpression: aBlock [

modifyExpression ifNotNil: #delete.
modifyExpression := aBlock
modifyExpression := aBlock.
self addMorphBack: modifyExpression.
]

{ #category : #accessing }
Expand All @@ -464,7 +466,7 @@ SBExampleWatch >> outOfWorld: aWorld [
self class unregisterWatch: self
]

{ #category : #'as yet unclassified' }
{ #category : #testing }
SBExampleWatch >> preventOcclusion [

^ false
Expand Down
32 changes: 7 additions & 25 deletions packages/Sandblocks-Babylonian/SBExploriants.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,8 @@ SBExploriants >> artefactSaved: aMethodBlock [
SBExploriants >> asTabButton: aNamedBlock [

| button |
button := SBButton new
label: aNamedBlock nameToDisplay do: [self setActive: aNamedBlock];
cornerStyle: #squared;
hResizing: #spaceFill;
changeTableLayout;
makeSmall;
listDirection: #leftToRight.

aNamedBlock = self active ifTrue: [button makeBold].
button := super asTabButton: aNamedBlock.
button when: #doubleClicked send: #value to: [].

^ button
]
Expand All @@ -85,20 +78,15 @@ SBExploriants >> binding: aString for: block class: aClass ifPresent: aBlock [
]

{ #category : #ui }
SBExploriants >> buildTabs [
SBExploriants >> buildView [

self addMorphBack: (SBRow new
addAllMorphsBack: (self namedBlocks collect: [:block | self asTabButton: block]);
name: #tabs;
changeTableLayout;
listDirection: #leftToRight;
hResizing: #shrinkWrap)
self addMorphBack: (self activeBlock hResizing: #shrinkWrap)
]

{ #category : #ui }
SBExploriants >> buildView [
{ #category : #accessing }
SBExploriants >> buttonClass [

self addMorphBack: (self activeBlock hResizing: #shrinkWrap)
^ SBButton
]

{ #category : #testing }
Expand Down Expand Up @@ -195,12 +183,6 @@ SBExploriants >> selector [
^ nil
]

{ #category : #accessing }
SBExploriants >> tabs [

^ (self submorphNamed: #tabs) submorphs
]

{ #category : #actions }
SBExploriants >> tryToUpdateInBackgroundAfterChangeIn: aMethodBlock [

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,6 @@ SBInactiveExampleWatch >> originalIdentifier: aNumber [
SBInactiveExampleWatch >> saveObjectsActivePermutations [

"Force morphs to persist their permutation even when on the UI process"
"exampleToValues associationsDo: [:anExampleValuesPair |
anExampleValuesPair value do: [:aWatchValue |
aWatchValue watchedValue allMorphsDo: [:aSubMorph |
SBExploriants objectToPermutation
at: aSubMorph
put: SBActiveVariantPermutation value]]]."
exampleToDisplay associationsDo: [:anExampleDisplayPair |
anExampleDisplayPair value displayedWatchValueBlocks do: [:aValueMorph |
aValueMorph lastSubmorph allMorphsDo: [:aSubMorph |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ SBInactiveExampleWatch >> listensToExamples [
SBInactiveExampleWatch >> saveObjectsActivePermutations [

"Force morphs to persist their permutation even when on the UI process"
"exampleToValues associationsDo: [:anExampleValuesPair |
anExampleValuesPair value do: [:aWatchValue |
aWatchValue watchedValue allMorphsDo: [:aSubMorph |
SBExploriants objectToPermutation
at: aSubMorph
put: SBActiveVariantPermutation value]]]."
exampleToDisplay associationsDo: [:anExampleDisplayPair |
anExampleDisplayPair value displayedWatchValueBlocks do: [:aValueMorph |
aValueMorph lastSubmorph allMorphsDo: [:aSubMorph |
Expand Down
56 changes: 36 additions & 20 deletions packages/Sandblocks-Babylonian/SBLiveView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ Class {
{ #category : #building }
SBLiveView >> buildAllPossibleResults [

self multiverse watches ifEmpty: [^ self].
self multiverse universes do: [:aUniverse | self buildPreviewFor: aUniverse]
self multiverse universes do: [:aUniverse | self buildPreviewFor: aUniverse activePermutation]
]

{ #category : #building }
Expand All @@ -32,19 +31,37 @@ SBLiveView >> buildBrodcaster [
]

{ #category : #building }
SBLiveView >> buildPreviewFor: aUniverse [
SBLiveView >> buildPreviewFor: aPermutation [

| preview |
preview := self newRegisteredListenerFor: aUniverse.
preview := self newRegisteredListenerFor: aPermutation.
gridContainer addMorphBack: (self containerRow cellPositioning: #center;
addAllMorphsBack: {
self containerRow listDirection: #topToBottom;
addAllMorphsBack: {
(SBPermutationLabel newDisplaying: aUniverse activePermutation) wrapFlag: false.
self newPermutationButtonRowFor: aUniverse showing: preview.
(SBPermutationLabel newDisplaying: aPermutation) wrapFlag: false.
self newPermutationButtonRowFor: aPermutation showing: preview.
preview}}).
]

{ #category : #building }
SBLiveView >> buildSetUpRow [

self block addMorphBack: (SBRow new
changeTableLayout;
hResizing: #spaceFill;
wrapCentering: #center;
listCentering: #center;
cellPositioning: #center;
name: #setup;
cellGap: 8 * self scalingFactor;
addMorphBack: (SBIcon iconSpinner
balloonText: 'Toggle stepping';
on: #click send: #toggleStepping to: self);
addMorphBack: (SBStringMorph new contents: 'Setup:');
addMorphBack: ([Morph new] asSandblock width: 200))
]

{ #category : #building }
SBLiveView >> buttons [

Expand Down Expand Up @@ -77,6 +94,7 @@ SBLiveView >> initialize [
super initialize.

self name: 'Playground'.
self buildSetUpRow.


]
Expand All @@ -98,30 +116,28 @@ SBLiveView >> listeners [
]

{ #category : #building }
SBLiveView >> newPermutationButtonRowFor: aUniverse showing: aPreview [
SBLiveView >> newPermutationButtonRowFor: aPermutation showing: aPreview [

^ self containerRow
layoutInset: 0;
cellInset: 0;
addAllMorphsBack: {
SBButton newApplyPermutationFor: aUniverse activePermutation.
self rebuildButtonIn: aPreview applying: aUniverse.
self rebuildButtonIn: aPreview applying: aPermutation.
self synchronizeButtonIn: aPreview}
]

{ #category : #initialization }
SBLiveView >> newRegisteredListenerFor: aUniverse [
SBLiveView >> newRegisteredListenerFor: aPermutation [

| listener value container watch |
self flag: #todo. "for multiple watch values"
watch := aUniverse watches first.
value := watch exampleToValues values first first watchedValue.
listener := value veryDeepCopy asMorph.
| listener container |
SBActiveVariantPermutation value: aPermutation.
listener := self evaluateSetUp.
container := broadcaster addListener: listener.

listener allMorphsDo: [:aSubMorph |
SBExploriants objectToPermutation at: aSubMorph put: watch createdWithPermutation].
SBExploriants objectToPermutation at: aSubMorph put: aPermutation].

SBActiveVariantPermutation value: nil.
^ container

]
Expand Down Expand Up @@ -209,6 +225,7 @@ SBLiveView >> snapshot [
^ self containerRow
listDirection: #topToBottom;
addAllMorphsBack: {
ImageMorph new newForm: (self block submorphNamed: 'setup') imageForm.
ImageMorph new newForm: gridContainer imageForm}
]

Expand Down Expand Up @@ -246,14 +263,13 @@ SBLiveView >> toggleStepping [
{ #category : #actions }
SBLiveView >> visualize [

^ self.
"self clean.
self clean.

self buildBrodcaster.
self buildButtonRow.
self block addMorphBack: gridContainer.
self buildAllPossibleResults.

self listeners ifNotEmpty: [broadcaster extent: self listeners last extent. ].
self concludeContainerWidth. "
broadcaster extent: self listeners last extent.
self concludeContainerWidth.
]
1 change: 0 additions & 1 deletion packages/Sandblocks-Babylonian/SBPlainResultsView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ SBPlainResultsView >> buildAllPossibleResults [
SBPlainResultsView >> buildPermutationFor: aSBUniverse [

self block addAllMorphsBack: {(SBPermutationLabel newDisplaying: aSBUniverse activePermutation) wrapFlag: false.
SBButton newApplyPermutationFor: aSBUniverse activePermutation.
(self containerRow listDirection: #leftToRight)
addAllMorphsBack: aSBUniverse watches.
LineMorph from: 0@0 to: 50@0 color: Color black width: 2}
Expand Down
Loading

0 comments on commit 4325e66

Please sign in to comment.