[squeak-dev] The Inbox: ToolBuilder-Kernel-ct.138.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Feb 5 10:10:11 UTC 2020


Christoph Thiede uploaded a new version of ToolBuilder-Kernel to project The Inbox:
http://source.squeak.org/inbox/ToolBuilder-Kernel-ct.138.mcz

==================== Summary ====================

Name: ToolBuilder-Kernel-ct.138
Author: ct
Time: 5 February 2020, 11:10:09.014675 am
UUID: e66248df-c727-5440-b18d-c7b7ae9f038f
Ancestors: ToolBuilder-Kernel-mt.134

Proposal: Add convenient method String >> #informUserDuring:

We could already say
	'Squeak is great!' displayProgressFrom: 9 to: 17 during: [:bar |
		bar value: 9.
		1 second wait.
		bar value: 16.
		1 seconds wait.
		bar value: 17].
Now we can also say
	'Squeak is great!' informUserDuring: [2 seconds wait].

=============== Diff against ToolBuilder-Kernel-mt.134 ===============

Item was changed:
+ ----- Method: String>>displayProgressAt:from:to:during: (in category '*ToolBuilder-Kernel') -----
- ----- Method: String>>displayProgressAt:from:to:during: (in category '*toolbuilder-kernel') -----
  displayProgressAt: aPoint from: minVal to: maxVal during: workBlock 
  	"Display this string as a caption over a progress bar while workBlock is evaluated.
  
  EXAMPLE (Select next 6 lines and Do It)
  'Now here''s some Real Progress'
  	displayProgressAt: Sensor cursorPoint
  	from: 0 to: 10
  	during: [:bar |
  	1 to: 10 do: [:x | bar value: x.
  			(Delay forMilliseconds: 500) wait]].
  
  HOW IT WORKS (Try this in any other language :-)
  Since your code (the last 2 lines in the above example) is in a block,
  this method gets control to display its heading before, and clean up 
  the screen after, its execution.
  The key, though, is that the block is supplied with an argument,
  named 'bar' in the example, which will update the bar image every 
  it is sent the message value: x, where x is in the from:to: range.
  "
  	^ProgressInitiationException 
  		display: self
  		at: aPoint 
  		from: minVal 
  		to: maxVal 
  		during: workBlock!

Item was changed:
+ ----- Method: String>>displayProgressFrom:to:during: (in category '*ToolBuilder-Kernel') -----
- ----- Method: String>>displayProgressFrom:to:during: (in category '*toolbuilder-kernel') -----
  displayProgressFrom: minVal to: maxVal during: workBlock 
  	"Display this string as a caption over a progress bar while workBlock is evaluated.
  
+ EXAMPLE (Select next 5 lines and Do It):
- EXAMPLE (Select next 6 lines and Do It)
  'Now here''s some Real Progress'
  	displayProgressFrom: 0 to: 10
  	during: [:bar |
  	1 to: 10 do: [:x | bar value: x.
  			(Delay forMilliseconds: 500) wait]]."
  	^ self
  		displayProgressAt: nil
  		from: minVal
  		to: maxVal
  		during: workBlock!

Item was changed:
+ ----- Method: String>>displaySequentialProgress: (in category '*ToolBuilder-Kernel') -----
- ----- Method: String>>displaySequentialProgress: (in category '*toolbuilder-kernel') -----
  displaySequentialProgress: aBlock 
  	"
  	'This takes some time...' displaySequentialProgress: [
  		(Delay forMilliseconds: 500) wait.
  		ProgressNotification signal: 0.1 extra: 'just starting'.
  		(Delay forMilliseconds: 500) wait.
  		ProgressNotification signal: 0.5.
  		(Delay forMilliseconds: 500) wait.
  		ProgressNotification signal: '1.0' extra: 'done'.
  		(Delay forMilliseconds: 500) wait.
  	]
  	"
  	ProgressInitiationException
  		display: self
  		from: 0 to: 1
  		during: [:bar | aBlock
  				on: ProgressNotification
  				do: [:e | 
  					bar value: e messageText asNumber.
  					e extraParam: self, (e extraParam ifNil: ['']).
  					e pass]].
  !

Item was changed:
+ ----- Method: String>>edit (in category '*ToolBuilder-Kernel') -----
- ----- Method: String>>edit (in category '*toolbuilder-kernel') -----
  edit
  
  	UIManager default edit: self.!

Item was changed:
+ ----- Method: String>>editWithLabel: (in category '*ToolBuilder-Kernel') -----
- ----- Method: String>>editWithLabel: (in category '*toolbuilder-kernel') -----
  editWithLabel: label
  
  	UIManager default edit: self label: label!

Item was added:
+ ----- Method: String>>informUserDuring: (in category '*ToolBuilder-Kernel') -----
+ informUserDuring: aBlock
+ 
+ 	^ Project uiManager
+ 		informUser: self
+ 		during: aBlock!



More information about the Squeak-dev mailing list