As we are in feature freeze, I am requesting a review from the list first, but I would rather classify this as a fix than as a fixer. Unless any weird code out there relied on #informUser:during: returning a UIManager instance or something similar, I would not expect any regressions with that.<br>
<br>
Best,<br>
Christoph<br>
<br>
<b>=============== Summary ===============</b><br>
<br>
Change Set: informUserDuringResult<br>
Date: 25 May 2022<br>
Author: Christoph Thiede<br>
<br>
This changeset modifies all implementors of #informUser{:d,D}uring: to ensure that always the result of aBlock will be returned.<br>
<br>
<b>=============== Diff ===============</b><br>
<br>
<b>ClassBuilder>>informUserDuring: {private} · ct 5/25/2022 22:32 (changed)</b><br>
informUserDuring: aBlock<br>
<s><font color="#0000FF">- self class isSilent ifTrue:[^aBlock value].<br>
- UIManager default informUserDuring:[:bar|<br>
</font></s><font color="#FF0000">+ <br>
+ | result |<br>
+ self class isSilent ifTrue: [^ aBlock value].<br>
+ <br>
+ result := Project uiManager informUserDuring: [:bar |<br>
</font> progress := bar.<br>
aBlock value].<br>
<s><font color="#0000FF">- progress := nil.<br>
</font></s><font color="#FF0000">+ progress := nil.<br>
+ ^ result</font><br>
<br>
<b>DummyUIManager>>informUserDuring: {ui requests} · ct 5/25/2022 22:32 (changed)</b><br>
informUserDuring: aBlock<br>
<s><font color="#0000FF">- aBlock value: Association new.<br>
</font></s><font color="#FF0000">+ ^ aBlock value: Association new</font><br>
<br>
<b>MVCMenuMorph>>informUserAt:during: {invoking} · ct 5/25/2022 22:34 (changed)</b><br>
informUserAt: aPoint during: aBlock<br>
"Add this menu to the Morphic world during the execution of the given block."<br>
<br>
<s><font color="#0000FF">- | title w |<br>
- Smalltalk isMorphic ifFalse: [^ self].<br>
</font></s><font color="#FF0000">+ | title w result |<br>
+ Smalltalk isMorphic ifFalse: [^ aBlock value].<br>
</font> <br>
title := self allMorphs detect: [:ea | ea hasProperty: #titleString].<br>
title := title submorphs first.<br>
self visible: false.<br>
w := self currentWorld.<br>
<s><font color="#0000FF">- aBlock value: [:string|<br>
</font></s><font color="#FF0000">+ result := aBlock value: [:string|<br>
</font> self visible ifFalse: [<br>
w addMorph: self centeredNear: aPoint.<br>
self visible: true].<br>
title contents: string.<br>
self setConstrainedPosition: Sensor cursorPoint hangOut: false.<br>
self changed.<br>
w displayWorld "show myself"<br>
]. <br>
self delete.<br>
<s><font color="#0000FF">- w displayWorld.<br>
</font></s><font color="#FF0000">+ w displayWorld.<br>
+ ^ result</font><br>
<br>
<b>MVCUIManager>>informUser:during: {ui requests} · ct 5/25/2022 22:31 (changed)</b><br>
informUser: aStringOrText during: aBlock<br>
"Display a message above (or below if insufficient room) the cursor <br>
during execution of the given block.<br>
Project uiManager informUser: 'Just a sec!' during: [1 second wait].<br>
"<br>
<s><font color="#0000FF">- (SelectionMenu labels: '')<br>
</font></s><font color="#FF0000">+ ^ (SelectionMenu labels: '')<br>
</font> displayAt: Sensor cursorPoint<br>
withCaption: (aStringOrText ifNotNil: [<br>
"This is a compromise. See commentary in DialogWindow >> #message:."<br>
aStringOrText withNoLineLongerThan: (aStringOrText size > 900 ifTrue: [65] ifFalse: [45])])<br>
during: aBlock<br>
<br>
<b>MVCUIManager>>informUserDuring: {ui requests} · ct 5/25/2022 22:33 (changed)</b><br>
informUserDuring: aBlock<br>
"Display a message above (or below if insufficient room) the cursor <br>
during execution of the given block.<br>
UIManager default informUserDuring:[:bar|<br>
#(one two three) do:[:info|<br>
bar value: info.<br>
(Delay forSeconds: 1) wait]]"<br>
<s><font color="#0000FF">- aBlock value:[:string| Transcript cr; show: string].<br>
</font></s><font color="#FF0000">+ ^ aBlock value: [:string | Transcript cr; show: string]</font><br>
<br>
<b>MenuMorph>>informUserAt:during: {modal control} · ct 5/25/2022 22:34 (changed)</b><br>
informUserAt: aPoint during: aBlock<br>
"Add this menu to the Morphic world during the execution of the given block."<br>
<br>
<s><font color="#0000FF">- | title world |<br>
</font></s><font color="#FF0000">+ | title world result |<br>
</font> title := self allMorphs detect: [ :ea | ea hasProperty: #titleString ].<br>
title := title submorphs first.<br>
self visible: false.<br>
world := self currentWorld.<br>
<s><font color="#0000FF">- aBlock value: [:string|<br>
</font></s><font color="#FF0000">+ result := aBlock value: [:string|<br>
</font> self visible ifFalse:[<br>
world addMorph: self centeredNear: aPoint.<br>
self visible: true].<br>
title contents: string.<br>
self setConstrainedPosition: self currentHand cursorPoint hangOut: false.<br>
self changed.<br>
world displayWorld "show myself"]. <br>
self delete.<br>
<s><font color="#0000FF">- world displayWorld.<br>
</font></s><font color="#FF0000">+ world displayWorld.<br>
+ ^ result</font><br>
<br>
<b>MorphicUIManager>>informUserDuring: {ui requests} · ct 5/25/2022 22:32 (changed)</b><br>
informUserDuring: aBlock<br>
"Display a message above (or below if insufficient room) the cursor <br>
during execution of the given block.<br>
UIManager default informUserDuring:[:bar|<br>
#(one two three) do:[:info|<br>
bar value: info.<br>
(Delay forSeconds: 1) wait]]"<br>
<s><font color="#0000FF">- SystemProgressMorph<br>
</font></s><font color="#FF0000">+ ^ SystemProgressMorph<br>
</font> informUserAt: nil during: aBlock.<br>
<br>
<b>PopUpMenu>>displayAt:withCaption:during: {displaying} · ct 5/25/2022 22:33 (changed)</b><br>
displayAt: aPoint withCaption: captionOrNil during: aBlock<br>
"Display the receiver just to the right of aPoint while aBlock is evaluated. If the receiver is forced off screen, display it just to the right."<br>
<s><font color="#0000FF">- | delta savedArea captionForm captionSave outerFrame captionText tFrame frameSaveLoc captionBox |<br>
</font></s><font color="#FF0000">+ | delta savedArea captionForm captionSave outerFrame captionText tFrame frameSaveLoc captionBox result |<br>
</font> marker ifNil: [self computeForm].<br>
frame := frame align: marker leftCenter with: aPoint + (2@0).<br>
outerFrame := frame.<br>
captionOrNil notNil ifTrue:<br>
[captionText := (DisplayText<br>
text: captionOrNil asText<br>
textStyle: self class standardMenuStyle copy centered)<br>
foregroundColor: (self userInterfaceTheme textColor ifNil: [Color black])<br>
backgroundColor: (self userInterfaceTheme color ifNil: [Color white]).<br>
tFrame := captionText boundingBox insetBy: -2.<br>
outerFrame := frame merge: (tFrame align: tFrame bottomCenter<br>
with: frame topCenter + (0@2))].<br>
delta := outerFrame amountToTranslateWithin: Display boundingBox.<br>
frame right > Display boundingBox right<br>
ifTrue: [delta := 0 - frame width @ delta y].<br>
frame := frame translateBy: delta.<br>
captionOrNil notNil ifTrue:<br>
[captionForm := captionText form.<br>
captionBox := captionForm boundingBox expandBy: 4.<br>
captionBox := captionBox align: captionBox bottomCenter<br>
with: frame topCenter + (0@2).<br>
captionSave := Form fromDisplay: captionBox.<br>
Display border: captionBox width: 4 fillColor: (self userInterfaceTheme color ifNil: [Color white]).<br>
Display border: captionBox width: 2 fillColor: (self userInterfaceTheme textColor ifNil: [Color black]).<br>
captionForm displayAt: captionBox topLeft + 4].<br>
marker := marker align: marker leftCenter with: aPoint + delta + (2@0).<br>
savedArea := Form fromDisplay: frame.<br>
self menuForm displayOn: Display at: (frameSaveLoc := frame topLeft).<br>
selection ~= 0 ifTrue: [Display reverse: marker].<br>
<s><font color="#0000FF">- Cursor normal showWhile: aBlock.<br>
</font></s><font color="#FF0000">+ result := Cursor normal showWhile: aBlock.<br>
</font> savedArea displayOn: Display at: frameSaveLoc.<br>
captionOrNil notNil ifTrue:<br>
<s><font color="#0000FF">- [captionSave displayOn: Display at: captionBox topLeft]<br>
</font></s><font color="#FF0000">+ [captionSave displayOn: Display at: captionBox topLeft].<br>
+ ^ result</font><br>
<br>
<b>SystemProgressMorph class>>informUserAt:during: {instance creation} · ct 5/25/2022 22:34 (changed)</b><br>
informUserAt: aPoint during: workBlock<br>
<s><font color="#0000FF">- ProgressInitiationException <br>
</font></s><font color="#FF0000">+ ^ ProgressInitiationException <br>
</font> display: ' '<br>
at: aPoint <br>
from: 0 <br>
to: 0 <br>
during: workBlock<br>
<br>
<b>UIManagerTest>>testInformUserDuring {tests} · ct 5/25/2022 22:37</b><br>
<font color="#FF0000">+ testInformUserDuring<br>
+ <br>
+ self assert: 42 equals:<br>
+ (Project uiManager informUser: 'test' during: [6 * 7]).</font><br>
<br>
<font color="#808080">---<br>
</font><font color="#808080"><i>Sent from </i></font><font color="#808080"><i><a href="https://github.com/hpi-swa-lab/squeak-inbox-talk"><u><font color="#808080">Squeak Inbox Talk</font></u></a></i></font><br>
["informUserDuringResult.2.cs"]