Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quality of life adjustments #143

Merged
merged 9 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
]
30 changes: 17 additions & 13 deletions packages/Sandblocks-Babylonian/SBCluster.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ SBCluster >> initialize [
changeTableLayout;
listDirection: #topToBottom;
vResizing: #shrinkWrap;
hResizing: #shrinkWrap
hResizing: #shrinkWrap;
cellInset: 0@2
]

{ #category : #accessing }
Expand Down Expand Up @@ -113,8 +114,7 @@ SBCluster >> newTopRowFrom: aCollectionOfMorphs [
cellPositioning: #topCenter;
hResizing: #spaceFill;
addAllMorphsBack: (aCollectionOfMorphs collect: [:aMorph |
aMorph rotationDegrees: 90.
(self wrapInCell: aMorph owner flexVertically: true flexHorizontally: false) borderWidth: 0])
self morphResizer applyOn: aMorph])
]

{ #category : #visualisation }
Expand All @@ -138,16 +138,19 @@ SBCluster >> visualize [
(matrix rowCount < 2 or: [matrix columnCount < 2])
ifTrue:[self visualizeNothingToDisplay. ^ self].

self addAllMorphsBack: {
self newTopRowFrom: (matrix atRow: 1) allButFirst. "ignore placeholder morph"
self addMorphBack: (
self newContainerMorph
listDirection: #leftToRight;
cellInset: 0;
addAllMorphsBack: {
self newLeftColumnFrom: (matrix atColumn: 1) allButFirst. "ignore placeholder morph"
SBGrid newDisplaying:
((matrix atRows: 2 to: matrix rowCount columns: 2 to: matrix columnCount)
collect: [:aMorph | self wrapInCell: aMorph])}}
cellInset: 0@0;
addAllMorphsBack: {
self newTopRowFrom: (matrix atRow: 1) allButFirst. "ignore placeholder morph"
self newContainerMorph
listDirection: #leftToRight;
cellInset: 3@3;
addAllMorphsBack: {
self newLeftColumnFrom: (matrix atColumn: 1) allButFirst. "ignore placeholder morph"
SBGrid newDisplaying:
((matrix atRows: 2 to: matrix rowCount columns: 2 to: matrix columnCount)
collect: [:aMorph | self wrapInCell: aMorph])}})
]

{ #category : #visualisation }
Expand All @@ -171,6 +174,7 @@ SBCluster >> wrapInCell: aMorph flexVertically: aVBoolean flexHorizontally: aHBo

| cell targetExtent|
cell := self newCellMorph.
cell on: #click send: #value to: [aMorph triggerEvent: #clicked].

aVBoolean ifTrue: [cell vResizing: #shrinkWrap].
aHBoolean ifTrue: [cell hResizing: #shrinkWrap].
Expand All @@ -189,6 +193,6 @@ SBCluster >> wrapInCell: aMorph flexVertically: aVBoolean flexHorizontally: aHBo
cell addMorph: (ImageMorph new
newForm: (aMorph imageForm scaledIntoFormOfSize: targetExtent);
when: #clicked send: #triggerEvent: to: aMorph with: #clicked).
cell on: #click send: #value to: [cell submorphs first triggerEvent: #clicked].

^ cell
]
32 changes: 24 additions & 8 deletions packages/Sandblocks-Babylonian/SBCorrelationCluster.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -120,21 +120,37 @@ SBCorrelationCluster >> extractedTopHeadingsFrom: aCollectionOfCorrelatingUniver
referingTo: aCorrelatingUniverse]
]

{ #category : #visualisation }
SBCorrelationCluster >> newLeftColumnFrom: aCollectionOfMorphs [

"Height should be set, but width can vary"
^ self newContainerMorph
cellPositioning: #rightCenter;
addAllMorphsBack: (aCollectionOfMorphs collect: [:aMorph |
aMorph wrapFlag: false.
(self wrapInCell: aMorph flexVertically: false flexHorizontally: true)
listDirection: #rightToLeft;
borderWidth: 0])
]

{ #category : #visualisation }
SBCorrelationCluster >> newTopRowFrom: aCollectionOfPermutationLabels [

"Width should be set, but height can vary"
^ self newContainerMorph
listDirection: #leftToRight;
listCentering: #bottomRight;
cellPositioning: #topCenter;
cellPositioning: #bottomCenter;
hResizing: #spaceFill;
addAllMorphsBack: (aCollectionOfPermutationLabels collect: [:aLabel |
self newContainerMorph
addAllMorphsBack: {
(self
wrapInCell: aLabel
flexVertically: true
flexHorizontally: false) borderWidth: 0.
SBButton newApplyPermutationFor: (aLabel universe activePermutation).}])
self morphResizer applyOn: aLabel])
]

{ #category : #helper }
SBCorrelationCluster >> wrapInCell: aMorph [

^ self morphResizer label = SBMorphResizer newIdentity label
ifTrue: [self wrapInCell: aMorph flexVertically: true flexHorizontally: true]
ifFalse: [self wrapInCell: aMorph flexVertically: true flexHorizontally: false]

]
62 changes: 20 additions & 42 deletions packages/Sandblocks-Babylonian/SBCorrelationView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ Class {
{ #category : #building }
SBCorrelationView >> buildAllPossibleResults [

self multiverse activeExamples
ifEmpty: [gridContainer addMorph: (TextMorph new contents: 'No examples active').
gridContainer width: gridContainer firstSubmorph width + 5 "a bit of margin"].

groupedUniverses := self groupUniversesContainingAllVariantsIn: selectedVariants.
basePermutations := self collectAllPermutationsOfSelectedVariants asOrderedCollection.

Expand All @@ -33,9 +29,13 @@ SBCorrelationView >> buildForExample: anExample watching: aWatch [
self containerRow listDirection: #topToBottom;
addAllMorphsBack: {
SBOwnTextMorph new contents: (
'{1}, {2}' format: {anExample label.
(aWatch cleanedExpression sourceString)}).
self buildGridsFor: anExample watching: aWatch} flatten})
'{1}{2}' format: {"anExample label" ''.
(aWatch cleanedExpression sourceString withoutLineEndings)}).
self containerRow
listDirection: #topToBottom;
cellPositioning: #rightCenter;
cellInset: 0@10;
addAllMorphsBack: ((self buildGridsFor: anExample watching: aWatch) flatten)}})
]

{ #category : #building }
Expand All @@ -58,17 +58,22 @@ SBCorrelationView >> buildGridsFor: anExample watching: aWatch [
]

{ #category : #building }
SBCorrelationView >> buildSelectionRow [
SBCorrelationView >> buildSelectionOptions [

| container selectedString |
container := self containerRow.
container := Morph new
color: Color transparent;
changeTableLayout;
vResizing: #shrinkWrap;
hResizing: #shrinkWrap;
listDirection: #leftToRight.
self ensureVariantSelectionIn: container.
selectedString := 'Selected: '.
selectedString := ''.
selectedVariants
ifEmpty: [ selectedString := selectedString, 'None' ]
ifNotEmpty: [ selectedString := selectedString, ((selectedVariants collect: #name) fold: [:a :b | a, ', ', Character cr, b ])].
container addMorphBack: selectedString asMorph.
self block addMorph: container.
container addMorphBack: selectedString withoutLineEndings asMorph.
^ container

]

Expand All @@ -80,7 +85,7 @@ SBCorrelationView >> buildVariantSelection [
topLevelVariant := options detect: [:aVariant | aVariant parentVariant isNil] ifNone: [options first].

^ SBComboBox new
prefix: 'Add or Remove';
prefix: 'Configure Y Axis';
labels: (options collect: #name);
values: options;
object: topLevelVariant;
Expand All @@ -90,8 +95,8 @@ SBCorrelationView >> buildVariantSelection [

{ #category : #accessing }
SBCorrelationView >> buttons [

^ {}
^ super buttons, {self buildSelectionOptions}
]

{ #category : #building }
Expand All @@ -117,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 Down Expand Up @@ -187,20 +179,6 @@ SBCorrelationView >> initialize [

]

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

self clean.

self buildSelectionRow.
self block addMorph: dimensionOptions.

self buildButtonRow.

self buildAllPossibleResults .
self concludeContainerWidth.
]

{ #category : #accessing }
SBCorrelationView >> wantsReloadOnSaveWhenOpen [

Expand Down
12 changes: 8 additions & 4 deletions packages/Sandblocks-Babylonian/SBCustomView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,19 @@ SBCustomView >> buildViewOptions [
options := self viewClasses collect: [:aClass | aClass new hasBeenRenamed: true].

^ SBComboBox new
prefix: 'Current View: ';
prefix: 'Current Grid View: ';
labels: (options collect: #name);
values: options ;
object: options first;
object: options third;
when: #selectionChanged send: #switchView to: self
]

{ #category : #accessing }
SBCustomView >> buttons [

^ {viewOptions}, super buttons
]

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

Expand All @@ -36,8 +42,6 @@ SBCustomView >> initialize [
self name: 'Results'.

self buildButtonRow.

self block addMorphBack: viewOptions.
self block addMorphBack: self selectedView

]
Expand Down
23 changes: 3 additions & 20 deletions packages/Sandblocks-Babylonian/SBDiffTabView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,6 @@ Class {
#category : #'Sandblocks-Babylonian'
}

{ #category : #nil }
SBDiffTabView >> addButton [

^ SBButton new
icon: (SBIcon iconPlus
size: 7.0 sbScaled;
color: (Color green))
do: [self addTab];
makeSmall;
cornerStyle: #squared;
vResizing: #spaceFill;
balloonText: 'Add';
cellGap: -1.0 sbScaled;
layoutInset: (4.0 @ 4.0) sbScaled
]

{ #category : #callbacks }
SBDiffTabView >> artefactSaved: aMethodBlock [

Expand Down Expand Up @@ -72,14 +56,12 @@ SBDiffTabView >> buildView [
SBDiffTabView >> diffButton [

^ SBButton new
icon: (SBIcon iconCodeFork size: 12.0)
icon: (SBIcon iconCodeFork size: 10)
do: [self toggleDiffView];
makeSmall;
balloonText: 'Toggle diff to others';
vResizing: #spaceFill;
cornerStyle: #squared;
cellGap: -1.0 sbScaled;
layoutInset: (4.0 @ 3.0)
cornerStyle: #squared
]

{ #category : #diffing }
Expand All @@ -104,6 +86,7 @@ SBDiffTabView >> initialize [

super initialize.

wantsTabCountChanges := true.
isShowingDiff := false.
self hResizing: #spaceFill.
]
Expand Down
17 changes: 6 additions & 11 deletions packages/Sandblocks-Babylonian/SBExample.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,9 @@ SBExample >> lastError: anError [
anError
ifNotNil: [
true ifTrue: [
"ToolSet debugException: anError"
^ reportedError := self sandblockEditor
reportError: anError
process: ((Process forContext: anError signal copyStack priority: Processor activeProcess priority)
shouldResumeFromDebugger: false;
yourself)
process: currentProcess
source: self].

errorIndicator ifNil: [
Expand Down Expand Up @@ -386,8 +383,7 @@ SBExample >> run [
self sendStartNotification.

processRunning := true.
currentProcess := [
| returned |
currentProcess := [ | returned |
SBExecutionEnvironment value: self.

[returned := self evaluate] on: Error do: [:e |
Expand All @@ -401,8 +397,8 @@ SBExample >> run [
returnValue reportValues: {returned asSBWatchValue} sized: SBMorphResizer newThumbmail.
returnValue updateDisplay.
self sendFinishNotification]
] forkAt: Processor userBackgroundPriority.

] forkAt: Processor userBackgroundPriority.
^ currentProcess
]

Expand Down Expand Up @@ -453,7 +449,7 @@ SBExample >> self: aBlock args: aCollectionBlock label: aString [
removeAllMorphs;
addMorphBack: (icon := SBIcon iconPause
small;
color: Color white;
color: (Color white);
on: #click send: #toggleRunning to: self);
addMorphBack: (nameInput := SBTextBubble new contents: aString);
addMorphBack: (SBStringMorph new contents: 'self:');
Expand Down Expand Up @@ -530,8 +526,7 @@ SBExample >> stopRunning [
returnValue clear.
self updateIcon.

self sandblockEditor allMorphsDo: [:morph |
(morph isSandblock and: [morph listensToExamples]) ifTrue: [morph exampleStopped: self]]
self sandblockEditor allMorphsDo: [:morph | (morph isSandblock and: [morph listensToExamples]) ifTrue: [morph exampleStopped: self]]
]

{ #category : #actions }
Expand Down
18 changes: 1 addition & 17 deletions packages/Sandblocks-Babylonian/SBExampleCluster.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,5 @@ SBExampleCluster >> newTopRowFrom: aCollectionOfPermutationLabels [
cellPositioning: #topCenter;
hResizing: #spaceFill;
addAllMorphsBack: (aCollectionOfPermutationLabels collect: [:aLabel |
| wrappedLabel button |
aLabel rotationDegrees: 90.
wrappedLabel := (self wrapInCell: aLabel owner
flexVertically: true
flexHorizontally: false) borderWidth: 0.
"Rotating morphs somehow clips their right border, so dirty hack so container gets clipped 1px"
button := self newContainerMorph
cellInset: 1;
addMorphBack: (SBButton newApplyPermutationFor: aLabel permutation);
rotationDegrees: 90.
button owner width > wrappedLabel width ifTrue: [button firstSubmorph makeTiny].

self newContainerMorph
cellPositioning: #bottomToTop;
cellPositioning: #topCenter;
cellInset: 0@2;
addAllMorphsBack: {button owner. wrappedLabel}])
self morphResizer applyOn: aLabel])
]
Loading
Loading