Skip to content

Commit

Permalink
All that was shown in the demo
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeAtHPI committed Apr 8, 2024
1 parent 9c4549d commit 64e961a
Show file tree
Hide file tree
Showing 22 changed files with 200 additions and 107 deletions.
4 changes: 2 additions & 2 deletions packages/Sandblocks-Babylonian/SBCluster.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ SBCluster >> initialize [
listDirection: #topToBottom;
vResizing: #shrinkWrap;
hResizing: #shrinkWrap;
cellInset: 0@10
cellInset: 0@2
]

{ #category : #accessing }
Expand Down Expand Up @@ -145,7 +145,7 @@ SBCluster >> visualize [
self newTopRowFrom: (matrix atRow: 1) allButFirst. "ignore placeholder morph"
self newContainerMorph
listDirection: #leftToRight;
cellInset: 5@(-10);
cellInset: 5@(-30);
addAllMorphsBack: {
self newLeftColumnFrom: (matrix atColumn: 1) allButFirst. "ignore placeholder morph"
SBGrid newDisplaying:
Expand Down
20 changes: 4 additions & 16 deletions packages/Sandblocks-Babylonian/SBCorrelationView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ SBCorrelationView >> buildForExample: anExample watching: aWatch [
addAllMorphsBack: {
SBOwnTextMorph new contents: (
'{1}{2}' format: {"anExample label" ''.
(aWatch cleanedExpression sourceString)}).
(aWatch cleanedExpression sourceString withoutLineEndings)}).
self containerRow
listDirection: #topToBottom;
cellPositioning: #rightCenter;
cellInset: 0@10;
addAllMorphsBack: ((self buildGridsFor: anExample watching: aWatch) flatten)}})
]

Expand Down Expand Up @@ -71,7 +72,7 @@ SBCorrelationView >> buildSelectionOptions [
selectedVariants
ifEmpty: [ selectedString := selectedString, 'None' ]
ifNotEmpty: [ selectedString := selectedString, ((selectedVariants collect: #name) fold: [:a :b | a, ', ', Character cr, b ])].
container addMorphBack: selectedString asMorph.
container addMorphBack: selectedString withoutLineEndings asMorph.
^ container

]
Expand Down Expand Up @@ -121,19 +122,6 @@ SBCorrelationView >> collectAllPermutationsOfSelectedVariants [
^ allPermutations
]

{ #category : #building }
SBCorrelationView >> ensureVariantSelection [

self multiverse variants ifEmpty: [selectedVariants := OrderedCollection new. ^ self].
variantSelection := self buildVariantSelection.
self block addMorph: variantSelection.

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

]

{ #category : #building }
SBCorrelationView >> ensureVariantSelectionIn: aMorph [

Expand All @@ -142,7 +130,7 @@ SBCorrelationView >> ensureVariantSelectionIn: aMorph [
aMorph addMorph: variantSelection.

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

]
Expand Down
2 changes: 1 addition & 1 deletion packages/Sandblocks-Babylonian/SBCustomView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ SBCustomView >> buildViewOptions [
prefix: 'Current Grid View: ';
labels: (options collect: #name);
values: options ;
object: options first;
object: options third;
when: #selectionChanged send: #switchView to: self
]

Expand Down
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.
label := SBStringMorph new visible: false.
statusLabel := SBStringMorph new contents: ''.
self newChangeVizButton};
yourself);
Expand Down
31 changes: 26 additions & 5 deletions packages/Sandblocks-Babylonian/SBExampleWatch.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Class {
'dimensionOptions',
'modifyExpression',
'exampleToDisplay',
'exampleToValues'
'exampleToValues',
'ignoreReports'
],
#classVars : [
'Registry'
Expand Down Expand Up @@ -79,9 +80,9 @@ SBExampleWatch class >> report: aValue for: aSymbol modifying: aBlock [

| watchers example |
example := SBExecutionEnvironment value ifNil: [^ aValue].

watchers := self registry select: [:watcher | watcher notNil
and: [watcher identifier = aSymbol]
and: [watcher ignoreReports not]
and: [watcher isActive]].
watchers do: [:watcher | watcher reportValue: aValue asSBWatchValue for: example].

Expand Down Expand Up @@ -130,7 +131,8 @@ SBExampleWatch >> asInactiveCopy [
originalIdentifier: self identifier;
expression: (SBTextBubble new contents: self cleanedExpression sourceString);
modifyExpression: self modifyExpression veryDeepCopy;
dimensionOptions: self dimensionOptions veryDeepCopy.
dimensionOptions: self dimensionOptions veryDeepCopy;
createdWithPermutation: SBActiveVariantPermutation value.

exampleToValues keys do: [:anExample |
copy exampleStarting: anExample;
Expand All @@ -141,8 +143,7 @@ SBExampleWatch >> asInactiveCopy [
(copy exampleToDisplay at: anExample) display
selectedDisplayIndex: (exampleToDisplay at: anExample) display selectedDisplayIndex].

exampleToValues keys do: [:anExample | copy exampleFinished: anExample].

exampleToValues keys do: [:anExample | copy exampleFinished: anExample].

^ copy
saveObjectsActivePermutations;
Expand Down Expand Up @@ -247,6 +248,7 @@ SBExampleWatch >> exampleFinished: anExample [
SBExampleWatch >> exampleStarting: anExample [

exampleToValues at: anExample put: OrderedCollection new.
self ignoreReports: false.

(exampleToDisplay at: anExample ifAbsentPut: [self buildDefaultDisplayFor: anExample])
exampleStarting: anExample;
Expand Down Expand Up @@ -324,6 +326,18 @@ SBExampleWatch >> identifier: aSymbol [
self world ifNotNil: [self class registerWatch: self]
]

{ #category : #accessing }
SBExampleWatch >> ignoreReports [

^ ignoreReports
]

{ #category : #accessing }
SBExampleWatch >> ignoreReports: aBoolean [

ignoreReports := aBoolean
]

{ #category : #initialization }
SBExampleWatch >> initialize [

Expand All @@ -334,6 +348,7 @@ SBExampleWatch >> initialize [
exampleToDisplay := IdentityDictionary new.
exampleToValues := IdentityDictionary new.
watchedExpression := SBStMessageSend new.
ignoreReports := false.
dimensionOptions := SBComboBox new
prefix: 'Preview size: ';
labels: (options collect: #label);
Expand Down Expand Up @@ -449,6 +464,12 @@ SBExampleWatch >> outOfWorld: aWorld [
self class unregisterWatch: self
]

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

^ false
]

{ #category : #printing }
SBExampleWatch >> printOn: aStream [

Expand Down
16 changes: 11 additions & 5 deletions packages/Sandblocks-Babylonian/SBExploriants.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ SBExploriants >> evaluationReceiver [
{ #category : #accessing }
SBExploriants >> ignoreUpdate [

^ ignoreUpdate ifNil: [false]
^ ignoreUpdate
]

{ #category : #accessing }
Expand All @@ -136,6 +136,8 @@ SBExploriants >> initialize [

objectToPermutation := WeakKeyDictionary new.
updateProcessRunning := false.
ignoreUpdate := false.
namedBlocks := {SBExploriantsView new} asOrderedCollection.

self
attachDecorator: SBMoveDecorator new;
Expand All @@ -161,7 +163,10 @@ SBExploriants >> isArtefact [
{ #category : #initialization }
SBExploriants >> methodChanged: anEvent [

anEvent isModified ifTrue: [namedBlocks last addCodeSnapshot: anEvent]
anEvent isModified
ifTrue: [
namedBlocks detect: #isHistory
ifFound: [:history | history addCodeSnapshot: anEvent]]
]

{ #category : #accessing }
Expand Down Expand Up @@ -227,7 +232,7 @@ SBExploriants >> updateInBackgroundOnTimeoutRevertTo: theOldMultiverse [
newMultiverse := SBMultiverse bigbangInEditorWithoutKaboom: self sandblockEditor.
self namedBlocks do: [:aTab | aTab multiverse: newMultiverse].
[newMultiverse kaboom]
valueWithin: 7 seconds
valueWithin: 20 seconds
onTimeout: [newMultiverse cleanUp.
self namedBlocks do: [:aTab | aTab multiverse: theOldMultiverse]].
updateProcess := nil. updateProcessRunning := false.
Expand All @@ -236,9 +241,10 @@ SBExploriants >> updateInBackgroundOnTimeoutRevertTo: theOldMultiverse [

{ #category : #actions }
SBExploriants >> visualize [

| tabs |
|tabs|
self width: 0.
ignoreUpdate := false.
"tabs will visualize as soon as multiverse is finished"
tabs := SBExploriantsView getTabsInMultiverse: (SBMultiverse bigbangInEditor: self sandblockEditor).

Expand Down
10 changes: 8 additions & 2 deletions packages/Sandblocks-Babylonian/SBExploriantsView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,19 @@ SBExploriantsView >> initialize [
changeTableLayout;
color: Color white;
listDirection: #topToBottom;
layoutInset: 3;
cellGap: 4;
layoutInset: 1;
cellGap: 2;
cellInset: 2;
hResizing: #shrinkWrap;
vResizing: #shrinkWrap).
]

{ #category : #accessing }
SBExploriantsView >> isHistory [

^ false
]

{ #category : #accessing }
SBExploriantsView >> isOverview [

Expand Down
65 changes: 58 additions & 7 deletions packages/Sandblocks-Babylonian/SBHistoryView.class.st
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
Class {
#name : #SBHistoryView,
#superclass : #SBExploriantsView,
#instVars : [
'scrollPane'
],
#category : #'Sandblocks-Babylonian'
}

{ #category : #building }
SBHistoryView >> addCodeSnapshot: aChange [

self submorphs size - 1 "buttonRow" > self maxEpoches ifTrue: [self lastSubmorph delete].
self ensureStackSize.

self block addMorph: (self buildCodeSnapshot: aChange) atIndex: 2
self scroller addMorphFront: (self buildCodeSnapshot: aChange)
]

{ #category : #building }
SBHistoryView >> addEpoche [

self submorphs size - 1 "buttonRow" > self maxEpoches ifTrue: [self lastSubmorph delete].
self ensureStackSize.

self block addMorph: self buildEpoche atIndex: 2
self scroller addMorphFront: self buildEpoche
]

{ #category : #building }
Expand Down Expand Up @@ -67,6 +70,28 @@ SBHistoryView >> buildMetaUsageIn: aRow [

]

{ #category : #building }
SBHistoryView >> buildScrollPane [

| scrollPane |
scrollPane := ScrollPane new
color: Color transparent;
borderWidth: 0;
hResizing: #spaceFill;
scrollBarThickness: 7 sbScaled;
showHScrollBarOnlyWhenNeeded;
showVScrollBarOnlyWhenNeeded;
height: 600 sbScaled.
scrollPane scroller
changeTableLayout;
listDirection: #topToBottom;
cellPositioning: #topLeft;
layoutInset: 1;
cellGap: 2;
cellInset: 2.
^ scrollPane
]

{ #category : #building }
SBHistoryView >> buildSnapshotTabView [

Expand All @@ -93,13 +118,19 @@ SBHistoryView >> changeTabsButton [
cornerStyle: #squared
]

{ #category : #actions }
SBHistoryView >> clean [

self scroller submorphs copy do: #delete
]

{ #category : #building }
SBHistoryView >> clearButton [

^ SBButton new
icon: SBIcon iconClockO
label: 'Clear History'
do: [self clean. self block addMorphBack: self buildButtonRow];
do: [self clean];
cornerStyle: #squared
]

Expand All @@ -116,13 +147,27 @@ SBHistoryView >> deleteEpocheButton: theRow [

]

{ #category : #building }
SBHistoryView >> ensureStackSize [

self scroller submorphs size > self maxEpoches ifTrue: [self scroller lastSubmorph delete].
]

{ #category : #initialization }
SBHistoryView >> initialize [

super initialize.

self name: 'History'.
self buildButtonRow.
scrollPane := self buildScrollPane.
self block addMorphBack: scrollPane.
]

{ #category : #accessing }
SBHistoryView >> isHistory [

^ true
]

{ #category : #accessing }
Expand All @@ -139,7 +184,7 @@ SBHistoryView >> offerChangeTabMenu [
index := UIManager default chooseFrom: options.
index = 0 ifTrue: [^ self].

self block submorphs allButFirst do: [:anEpoche | anEpoche lastSubmorph activeIndex: index].
self scroller submorphs do: [:anEpoche | anEpoche lastSubmorph activeIndex: index].
]

{ #category : #building }
Expand All @@ -148,10 +193,16 @@ SBHistoryView >> saveButton [
^ SBButton new
icon: SBIcon iconSave
label: 'Save As PNG'
do: [self block exportAsPNG];
do: [self scroller exportAsPNG];
cornerStyle: #squared
]

{ #category : #accessing }
SBHistoryView >> scroller [

^ scrollPane scroller
]

{ #category : #accessing }
SBHistoryView >> tabsToSnapshot [

Expand Down
Loading

0 comments on commit 64e961a

Please sign in to comment.