From dfc347719e6a1f41649b253b5492818f4921a380 Mon Sep 17 00:00:00 2001 From: Joana Bergsiek Date: Thu, 18 Jan 2024 19:45:42 +0100 Subject: [PATCH] Display watches which are not reached and watches not open in world in exploriants --- .../SBInactiveExampleWatch.class.st | 6 ++++++ .../Sandblocks-Babylonian/SBMultiverse.class.st | 17 ++++++++--------- .../SBResultsView.class.st | 7 ------- packages/Sandblocks-Watch/SBWatchView.class.st | 6 +++++- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/packages/Sandblocks-Babylonian/SBInactiveExampleWatch.class.st b/packages/Sandblocks-Babylonian/SBInactiveExampleWatch.class.st index 9ba21458..2ef15b3d 100644 --- a/packages/Sandblocks-Babylonian/SBInactiveExampleWatch.class.st +++ b/packages/Sandblocks-Babylonian/SBInactiveExampleWatch.class.st @@ -23,6 +23,12 @@ SBInactiveExampleWatch class >> registerWatch: aWatch [ "we do not want the inactive watches in the registry" ] +{ #category : #'event handling' } +SBInactiveExampleWatch class >> unregisterWatch: aWatch [ + + "we do not want the inactive watches in the registry" +] + { #category : #callbacks } SBInactiveExampleWatch >> artefactSaved: aBlock [ diff --git a/packages/Sandblocks-Babylonian/SBMultiverse.class.st b/packages/Sandblocks-Babylonian/SBMultiverse.class.st index e5ea15ea..a41418e5 100644 --- a/packages/Sandblocks-Babylonian/SBMultiverse.class.st +++ b/packages/Sandblocks-Babylonian/SBMultiverse.class.st @@ -89,13 +89,6 @@ SBMultiverse >> allMethodBlocksContainingWatches [ ] -{ #category : #collecting } -SBMultiverse >> copyWatches [ - - ^ (self allMethodBlocksContainingWatches collect: [:aMethodBlock | - aMethodBlock containedExampleWatches collect: #asInactiveCopy]) flatten -] - { #category : #converting } SBMultiverse >> createUniverseFomPermutation: aSBPermutation [ @@ -136,17 +129,23 @@ SBMultiverse >> gatherElements [ { #category : #'initialize-release' } SBMultiverse >> initialize [ - | permutations | + | permutations watches outOfWorldWatches | super initialize. self gatherElements. permutations := SBPermutation allPermutationsOf: variants. universes := OrderedCollection new. + + watches := (self allMethodBlocksContainingWatches collect: #containedExampleWatches) flatten. + "Only open watches display values when examples are run. We want to show them too" + (outOfWorldWatches := watches reject: #isInEditor) do: [:aWatch | self sandblockEditor openMorph: aWatch]. + [permutations do: [:aPermutation | SBActiveVariantPermutation value: aPermutation. activeExamples do: #runSynchronouslyIgnoreReturn. - universes add: (self createUniverseFomPermutation: aPermutation)]. + universes add: (SBUniverse newActive: aPermutation watches: (watches collect: #asInactiveCopy))]. + outOfWorldWatches copy do: #delete. self resetWatchesToOriginalPermutationRunning: activeExamples. self triggerEvent: #updated] forkAt: Processor userSchedulingPriority. diff --git a/packages/Sandblocks-Babylonian/SBResultsView.class.st b/packages/Sandblocks-Babylonian/SBResultsView.class.st index 0e34a49a..a1238e79 100644 --- a/packages/Sandblocks-Babylonian/SBResultsView.class.st +++ b/packages/Sandblocks-Babylonian/SBResultsView.class.st @@ -21,13 +21,6 @@ SBResultsView >> initialize [ morphResizer := SBMorphResizer newThumbmail. ] -{ #category : #building } -SBResultsView >> resetWatchesToOriginalPermutationRunning: activeExamples [ - - SBActiveVariantPermutation value: nil. - activeExamples do: #runSynchronouslyIgnoreReturn -] - { #category : #actions } SBResultsView >> visualize [ diff --git a/packages/Sandblocks-Watch/SBWatchView.class.st b/packages/Sandblocks-Watch/SBWatchView.class.st index 53b356d3..47c630f8 100644 --- a/packages/Sandblocks-Watch/SBWatchView.class.st +++ b/packages/Sandblocks-Watch/SBWatchView.class.st @@ -142,7 +142,11 @@ SBWatchView >> displayWatchValues [ { #category : #accessing } SBWatchView >> displayedMorphs [ - ^ self scroller submorphs first "container for scrolling" submorphs + ^ self scroller submorphs + ifEmpty: [{}] + ifNotEmpty: [:valueContainer | valueContainer first "container for scrolling" submorphs ] + + ] { #category : #'event handling' }