The Inbox: Morphic-kfr.1469.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Morphic-kfr.1469.mcz

commits-2
A new version of Morphic was added to project The Inbox:
http://source.squeak.org/inbox/Morphic-kfr.1469.mcz

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

Name: Morphic-kfr.1469
Author: kfr
Time: 6 December 2018, 9:13:24.890102 pm
UUID: 3388ff60-ace3-4cf7-a1d4-f3fb7b7d9bce
Ancestors: Morphic-mt.1468

Don't hide the ProjectViewMorph and it's owner when loading

=============== Diff against Morphic-mt.1468 ===============

Item was changed:
  ----- Method: ComplexProgressIndicator>>withProgressDo: (in category 'as yet unclassified') -----
  withProgressDo: aBlock
 
  | safetyFactor totals trialRect delta targetOwner |
 
  Smalltalk isMorphic ifFalse: [^aBlock value].
  formerProject := Project current.
  formerWorld := formerProject world.
  formerProcess := Processor activeProcess.
  targetMorph
  ifNil: [targetMorph := ProgressTargetRequestNotification signal].
  targetMorph ifNil: [
  trialRect := Rectangle center: Sensor cursorPoint extent: 80@80.
  delta := trialRect amountToTranslateWithin: formerWorld bounds.
  trialRect := trialRect translateBy: delta.
  translucentMorph := TranslucentProgessMorph new
  opaqueBackgroundColor: Color white;
  bounds: trialRect;
  openInWorld: formerWorld.
  ] ifNotNil: [
  targetOwner := targetMorph owner.
  translucentMorph := TranslucentProgessMorph new
  setProperty: #morphicLayerNumber toValue: targetMorph morphicLayerNumber - 0.1;
  bounds: targetMorph boundsInWorld;
  openInWorld: targetMorph world.
  ].
  stageCompleted := 0.
  safetyFactor := 1.1. "better to guess high than low"
  translucentMorph setProperty: #progressStageNumber toValue: 1.
  translucentMorph hide.
+ "targetOwner ifNotNil: [targetOwner hide]."
- targetOwner ifNotNil: [targetOwner hide].
  totals := self loadingHistoryDataForKey: 'total'.
  newRatio := 1.0.
  estimate := totals size < 2 ifTrue: [
  15000 "be a pessimist"
  ] ifFalse: [
  (totals sum - totals max) / (totals size - 1 max: 1) * safetyFactor.
  ].
  start := Time millisecondClockValue.
  self forkProgressWatcher.
 
  [
  aBlock
  on: ProgressInitiationException
  do: [ :ex |
  ex sendNotificationsTo: [ :min :max :curr |
  "ignore this as it is inaccurate"
  ].
  ].
  ] on: ProgressNotification do: [ :note | | stageCompletedString |
  translucentMorph show.
  targetOwner ifNotNil: [targetOwner show].
  note extraParam ifNotNil:[self addProgressDecoration: note extraParam].
  stageCompletedString := (note messageText findTokens: ' ') first.
  stageCompleted := (stageCompletedString copyUpTo: $:) asNumber.
  cumulativeStageTime := Time millisecondClockValue - start max: 1.
  prevData := self loadingHistoryDataForKey: stageCompletedString.
  prevData isEmpty ifFalse: [
  newRatio := (cumulativeStageTime / (prevData average max: 1)) asFloat.
  ].
  self
  loadingHistoryAt: stageCompletedString
  add: cumulativeStageTime.
  translucentMorph
  setProperty: #progressStageNumber
  toValue: stageCompleted + 1.
  note resume.
  ].
 
  stageCompleted := 999. "we may or may not get here"
 
  !


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-kfr.1469.mcz

marcel.taeumel
Hi Karl,

it seems that the "ComplexProgressIndicator" is only used in the context of
project tooling. So, your fix makes sense. The name
"ComplexProgressIndicator" reads more general than it is (used) at the
moment. In that case, your fix could break more (unknown) things.
"targetOwner hide" might be meaningful in some ways.

I don't know...what about:
- adding your change
- renaming "ComplexProgressIndicator" to "ProjectProgressIndicator"
- adding a subclass "ComplexProgressIndicator" to "ProjectProgressIndicator"
-- but into the package "60Deprecated". (Same as we did with "ContextPart").

Any other Squeaker's out there using "ComplexProgressIndicator" for things?

(Note that MorphicUIManager >> #displayProgress:at:from:to:during: uses
"SystemProgressMorph" througout the image.)

Best,
Marcel


commits-2 wrote

> A new version of Morphic was added to project The Inbox:
> http://source.squeak.org/inbox/Morphic-kfr.1469.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-kfr.1469
> Author: kfr
> Time: 6 December 2018, 9:13:24.890102 pm
> UUID: 3388ff60-ace3-4cf7-a1d4-f3fb7b7d9bce
> Ancestors: Morphic-mt.1468
>
> Don't hide the ProjectViewMorph and it's owner when loading
>
> =============== Diff against Morphic-mt.1468 ===============
>
> Item was changed:
>   ----- Method: ComplexProgressIndicator>>withProgressDo: (in category 'as
> yet unclassified') -----
>   withProgressDo: aBlock
>  
>   | safetyFactor totals trialRect delta targetOwner |
>  
>   Smalltalk isMorphic ifFalse: [^aBlock value].
>   formerProject := Project current.
>   formerWorld := formerProject world.
>   formerProcess := Processor activeProcess.
>   targetMorph
>   ifNil: [targetMorph := ProgressTargetRequestNotification signal].
>   targetMorph ifNil: [
>   trialRect := Rectangle center: Sensor cursorPoint extent: 80@80.
>   delta := trialRect amountToTranslateWithin: formerWorld bounds.
>   trialRect := trialRect translateBy: delta.
>   translucentMorph := TranslucentProgessMorph new
>   opaqueBackgroundColor: Color white;
>   bounds: trialRect;
>   openInWorld: formerWorld.
>   ] ifNotNil: [
>   targetOwner := targetMorph owner.
>   translucentMorph := TranslucentProgessMorph new
>   setProperty: #morphicLayerNumber toValue: targetMorph
> morphicLayerNumber - 0.1;
>   bounds: targetMorph boundsInWorld;
>   openInWorld: targetMorph world.
>   ].
>   stageCompleted := 0.
>   safetyFactor := 1.1. "better to guess high than low"
>   translucentMorph setProperty: #progressStageNumber toValue: 1.
>   translucentMorph hide.
> + "targetOwner ifNotNil: [targetOwner hide]."
> - targetOwner ifNotNil: [targetOwner hide].
>   totals := self loadingHistoryDataForKey: 'total'.
>   newRatio := 1.0.
>   estimate := totals size < 2 ifTrue: [
>   15000 "be a pessimist"
>   ] ifFalse: [
>   (totals sum - totals max) / (totals size - 1 max: 1) * safetyFactor.
>   ].
>   start := Time millisecondClockValue.
>   self forkProgressWatcher.
>  
>   [
>   aBlock
>   on: ProgressInitiationException
>   do: [ :ex |
>   ex sendNotificationsTo: [ :min :max :curr |
>   "ignore this as it is inaccurate"
>   ].
>   ].
>   ] on: ProgressNotification do: [ :note | | stageCompletedString |
>   translucentMorph show.
>   targetOwner ifNotNil: [targetOwner show].
>   note extraParam ifNotNil:[self addProgressDecoration: note
> extraParam].
>   stageCompletedString := (note messageText findTokens: ' ') first.
>   stageCompleted := (stageCompletedString copyUpTo: $:) asNumber.
>   cumulativeStageTime := Time millisecondClockValue - start max: 1.
>   prevData := self loadingHistoryDataForKey: stageCompletedString.
>   prevData isEmpty ifFalse: [
>   newRatio := (cumulativeStageTime / (prevData average max: 1))
> asFloat.
>   ].
>   self
>   loadingHistoryAt: stageCompletedString
>   add: cumulativeStageTime.
>   translucentMorph
>   setProperty: #progressStageNumber
>   toValue: stageCompleted + 1.
>   note resume.
>   ].
>  
>   stageCompleted := 999. "we may or may not get here"
>  
>   !





--
Sent from: http://forum.world.st/Squeak-Dev-f45488.html

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-kfr.1469.mcz

K K Subbu
In reply to this post by commits-2
On 06/12/18 8:13 PM, [hidden email] wrote:
>    ----- Method: ComplexProgressIndicator>>withProgressDo: (in category 'as yet unclassified') -----
>    withProgressDo: aBlock
>    
>     | safetyFactor totals trialRect delta targetOwner |

targetOwner is an uninitialized local variable
>    ....
>     targetMorph ifNil: [
> ...
  It is not set in this part of the test. Should it be set to nil here?
>     ] ifNotNil: [
>     targetOwner := targetMorph owner.
> .....
>     ].
> ....
> + "targetOwner ifNotNil: [targetOwner hide]."

but is used here.

Regards .. Subbu

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-kfr.1469.mcz

Karl Ramberg
Yes, we could remove targetOwner from the method, but since I'm not sure about how other callers use it I did not do it in this version.

Cheers,
Karl