#REFACTORING by stefan
class: ProgressIndicator
changed: #showBusyIndicatorDuring:
class: ProgressIndicator class
comment/format in: #inBoxWithLabel:icon:text:abortable:view:closeWhenDone:
changed: #displayBusyIndicator:message:abortable:at:during:
--- a/ProgressIndicator.st Sat Mar 21 11:42:53 2020 +0100
+++ b/ProgressIndicator.st Wed Apr 01 10:38:02 2020 +0200
@@ -443,7 +443,7 @@
top := Dialog new.
top label:aLabel.
- top cursor:(Cursor wait).
+ top cursor:Cursor wait.
y2 := 0.
anIcon notNil ifTrue:[
@@ -451,7 +451,7 @@
label := top addTextLabel:anIcon.
label borderWidth:0.
label adjust:#left.
- label cursor:(Cursor wait).
+ label cursor:Cursor wait.
y2 := top yPosition.
top yPosition:y.
].
@@ -460,8 +460,8 @@
label sizeFixed:false.
label borderWidth:0.
label adjust:#left.
- label cursor:(Cursor wait).
- anIcon notNil ifTrue: [label leftInset:(anIcon width + 10)].
+ label cursor:Cursor wait.
+ anIcon notNil ifTrue:[label leftInset:(anIcon width + 10)].
top
yPosition:(top yPosition max:y2);
@@ -473,7 +473,7 @@
level:-1;
leftInset:5;
rightInset:5;
- cursor:(Cursor wait);
+ cursor:Cursor wait;
closeTopWhenDone:closeWhenDoneBoolean;
connectToTop:top label:label;
yourself.
@@ -497,6 +497,7 @@
"Created: / 17-07-1996 / 15:14:33 / cg"
"Modified: / 25-11-2019 / 15:44:52 / Stefan Vogel"
+ "Modified (format): / 31-03-2020 / 19:15:34 / Stefan Vogel"
!
inBoxWithLabel:aLabel text:text abortable:abortable
@@ -664,8 +665,8 @@
CannotReturnError catch:[
DialogBox closeBoxNotificationSignal handle:[:ex |
"/ make it go away immediately
- "/ but let it stay in its window-group process
- p topView device unmapWindow:p topView drawableId.
+ "/ but let it stay in its window-group process (do not #destroy)
+ p topView basicUnmap.
ex proceed
] do:[
aBlock valueWithOptionalArgument:p.
@@ -695,6 +696,8 @@
"Created: / 12-11-2010 / 18:59:13 / cg"
"Modified: / 01-10-2018 / 17:09:37 / Claus Gittinger"
+ "Modified: / 31-03-2020 / 19:08:45 / Stefan Vogel"
+ "Modified (format): / 01-04-2020 / 10:37:21 / Stefan Vogel"
!
displayBusyIndicator:aLabel message:messageString at:aPoint during:aBlock
@@ -1643,10 +1646,9 @@
connectedLabel
model:labelValue;
aspect:#value;
- labelMessage:#value.
-
- connectedLabel preferredExtent:(connectedLabel computePreferredExtent).
- connectedLabel forceResize.
+ labelMessage:#value;
+ preferredExtent:(connectedLabel computePreferredExtent);
+ forceResize.
connectedTop forceResize.
"/ connectedTop windowGroup processEvents.
] ifFalse:[
@@ -1661,10 +1663,13 @@
ActivityNotification handle:[:ex |
labelValue value:(ex messageText).
connectedLabel notNil ifTrue:[
- connectedLabel preferredExtent:(connectedLabel computePreferredExtent).
- connectedLabel forceResize.
+ connectedLabel
+ preferredExtent:(connectedLabel computePreferredExtent);
+ forceResize.
connectedTop forceResize.
- connectedTop windowGroup processEvents.
+ connectedTop windowGroup notNil ifTrue:[
+ connectedTop windowGroup processEvents.
+ ].
].
ex proceed.
] do:[
@@ -1695,18 +1700,14 @@
name:'ProgressIndicator executor';
yourself.
- Processor activeProcess
- withHigherPriorityDo:
- [
- p resume.
- self topView show.
- ].
+ Processor activeProcess withHigherPriorityDo:[
+ p resume.
+ self topView show.
+ ].
self stopBusyIndicationProcess.
- closeTopWhenDone ifTrue:[
- connectedTop notNil ifTrue:[
- connectedTop destroy
- ].
+ (closeTopWhenDone and:[connectedTop notNil]) ifTrue:[
+ connectedTop destroy
].
p notNil ifTrue:[p terminate].
@@ -1737,8 +1738,8 @@
"Modified: / 07-11-2011 / 21:53:46 / cg"
"Modified (format): / 08-01-2012 / 12:00:39 / cg"
- "Modified: / 11-07-2018 / 11:31:46 / Stefan Vogel"
"Modified: / 01-10-2018 / 16:55:07 / Claus Gittinger"
+ "Modified: / 31-03-2020 / 19:51:46 / Stefan Vogel"
!
showProgressOf:aBlock