[squeak-dev] The Trunk: ToolBuilder-Kernel-cmm.49.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Jun 15 20:09:33 UTC 2011


Chris Muller uploaded a new version of ToolBuilder-Kernel to project The Trunk:
http://source.squeak.org/trunk/ToolBuilder-Kernel-cmm.49.mcz

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

Name: ToolBuilder-Kernel-cmm.49
Author: cmm
Time: 15 June 2011, 3:09:22.146 pm
UUID: d98e6d48-baa2-ea48-9617-15c9eb24f58d
Ancestors: ToolBuilder-Kernel-cmm.48

- Moved ProgressInitiationException to this package from Exceptions.
- Moved String>>#displayProgressAt:  from:  to:  during: to this package.
- Removed UIManager>>#screen in favor of #screenBounds, since that was all that was needed at this level.

=============== Diff against ToolBuilder-Kernel-cmm.48 ===============

Item was added:
+ Notification subclass: #ProgressInitiationException
+ 	instanceVariableNames: 'workBlock maxVal minVal aPoint progressTitle'
+ 	classVariableNames: 'PreferredProgressBarPosition'
+ 	poolDictionaries: ''
+ 	category: 'ToolBuilder-Kernel'!
+ 
+ !ProgressInitiationException commentStamp: '<historical>' prior: 0!
+ I provide a way to alter the behavior of the old-style progress notifier in String. See examples in:
+ 
+ ProgressInitiationException testWithout.
+ ProgressInitiationException testWith.
+ !

Item was added:
+ ----- Method: ProgressInitiationException class>>display:at:from:to:during: (in category 'signalling') -----
+ display: aString at: aPoint from: minVal to: maxVal during: workBlock 
+ 	^ self new
+ 		display: aString
+ 		at: (aPoint ifNil: [ self preferredProgressBarPoint ])
+ 		from: minVal
+ 		to: maxVal
+ 		during: workBlock!

Item was added:
+ ----- Method: ProgressInitiationException class>>display:from:to:during: (in category 'signalling') -----
+ display: aString from: minVal to: maxVal during: workBlock 
+ 	^ self
+ 		display: aString
+ 		at: nil
+ 		from: minVal
+ 		to: maxVal
+ 		during: workBlock!

Item was added:
+ ----- Method: ProgressInitiationException class>>preferredProgressBarPoint (in category 'accessing') -----
+ preferredProgressBarPoint
+ 	^ self preferredProgressBarPosition = #cursorPoint
+ 		ifTrue: [ Sensor cursorPoint ]
+ 		ifFalse: [ UIManager default screenBounds perform: self preferredProgressBarPosition ]!

Item was added:
+ ----- Method: ProgressInitiationException class>>preferredProgressBarPosition (in category 'accessing') -----
+ preferredProgressBarPosition
+ 	^ PreferredProgressBarPosition ifNil: [ #center ]!

Item was added:
+ ----- Method: ProgressInitiationException class>>preferredProgressBarPosition: (in category 'accessing') -----
+ preferredProgressBarPosition: aSymbol 
+ 	"Specify any of:  #center, #topCenter, #bottomCenter, #leftCenter, #rightCenter, #topLeft, #topRight, #bottomLeft or #bottomRight or #cursorPoint."
+ 	^ PreferredProgressBarPosition!

Item was added:
+ ----- Method: ProgressInitiationException class>>testInnermost (in category 'examples and tests') -----
+ testInnermost
+ 
+ 	"test the progress code WITHOUT special handling"
+ 
+ 	^'Now here''s some Real Progress'
+ 		displayProgressFrom: 0 
+ 		to: 10
+ 		during: [ :bar |
+ 			1 to: 10 do: [ :x | 
+ 				bar value: x. (Delay forMilliseconds: 500) wait.
+ 				x = 5 ifTrue: [1/0].	"just to make life interesting"
+ 			].
+ 			'done'
+ 		].
+ 
+ !

Item was added:
+ ----- Method: ProgressInitiationException class>>testWith (in category 'examples and tests') -----
+ testWith
+ 
+ 	"test progress code WITH special handling of progress notifications"
+ 
+ 	^[ self testWithAdditionalInfo ] 
+ 		on: ProgressInitiationException
+ 		do: [ :ex | 
+ 			ex sendNotificationsTo: [ :min :max :curr |
+ 				Transcript show: min printString,'  ',max printString,'  ',curr printString; cr
+ 			].
+ 		].
+ !

Item was added:
+ ----- Method: ProgressInitiationException class>>testWithAdditionalInfo (in category 'examples and tests') -----
+ testWithAdditionalInfo
+ 
+ 	^{'starting'. self testWithout. 'really!!'}!

Item was added:
+ ----- Method: ProgressInitiationException class>>testWithout (in category 'examples and tests') -----
+ testWithout
+ 
+ 	"test the progress code WITHOUT special handling"
+ 
+ 	^[self testInnermost]
+ 		on: ZeroDivide
+ 		do: [ :ex | ex resume]
+ 
+ !

Item was added:
+ ----- Method: ProgressInitiationException>>defaultAction (in category 'as yet unclassified') -----
+ defaultAction
+ 	
+ 	| result |
+ 	result := UIManager default 
+ 		displayProgress: progressTitle 
+ 		at: aPoint 
+ 		from: minVal 
+ 		to: maxVal 
+ 		during: workBlock.
+ 	self resume: result!

Item was added:
+ ----- Method: ProgressInitiationException>>display:at:from:to:during: (in category 'as yet unclassified') -----
+ display: argString at: argPoint from: argMinVal to: argMaxVal during: argWorkBlock
+ 
+ 	progressTitle := argString.
+ 	aPoint := argPoint.
+ 	minVal := argMinVal.
+ 	maxVal := argMaxVal.
+ 	workBlock := argWorkBlock.
+ 	^self signal!

Item was added:
+ ----- Method: ProgressInitiationException>>sendNotificationsTo: (in category 'as yet unclassified') -----
+ sendNotificationsTo: aNewBlock
+ 
+ 	self resume: (
+ 		workBlock value: [ :barVal |
+ 			aNewBlock value: minVal value: maxVal value: barVal
+ 		]
+ 	)
+ !

Item was added:
+ ----- 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 added:
+ ----- 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 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 removed:
- ----- Method: UIManager>>screen (in category 'accessing') -----
- screen
- 	^ Display!

Item was added:
+ ----- Method: UIManager>>screenBounds (in category 'accessing') -----
+ screenBounds
+ 	^ Display boundingBox!




More information about the Squeak-dev mailing list