ShowMeHowItWorks.st
changeset 3783 e935b92253c9
parent 3781 0040ac44a2f3
child 3784 f6654cc10071
equal deleted inserted replaced
3782:f26ed65a4360 3783:e935b92253c9
     3 "{ Package: 'stx:libtool2' }"
     3 "{ Package: 'stx:libtool2' }"
     4 
     4 
     5 "{ NameSpace: Smalltalk }"
     5 "{ NameSpace: Smalltalk }"
     6 
     6 
     7 Object subclass:#ShowMeHowItWorks
     7 Object subclass:#ShowMeHowItWorks
     8 	instanceVariableNames:'application opStream lastComponentName lastComponent lastResult
     8 	instanceVariableNames:'application opStream streamStack lastComponentName lastComponent
     9 		voice translate language verifying closeApplicationWhenFinished'
     9 		lastResult voice translate language verifying
       
    10 		closeApplicationWhenFinished defaultComponentWaitTime'
    10 	classVariableNames:'IntroShownCount DebugMode'
    11 	classVariableNames:'IntroShownCount DebugMode'
    11 	poolDictionaries:''
    12 	poolDictionaries:''
    12 	category:'Interface-Help'
    13 	category:'Interface-Help'
    13 !
    14 !
    14 
    15 
   431         aSelectionInListView
   432         aSelectionInListView
   432     "    
   433     "    
   433 
   434 
   434     <action>
   435     <action>
   435 
   436 
   436     |idx|
   437     |idx component|
   437 
   438 
   438     verifying ifTrue:[^ self].
   439     verifying ifTrue:[^ self].
   439 
   440 
   440     (lastComponent isKindOf:ComboView) ifTrue:[
   441     ((component := lastComponent) isKindOf:ScrollableView) ifTrue:[
       
   442         component := component scrolledView.
       
   443     ].
       
   444 
       
   445     (component isKindOf:ComboView) ifTrue:[
   441         "/ click on the menubutton
   446         "/ click on the menubutton
   442         self movePointerToComponent:lastComponent menuButton.
   447         self movePointerToComponent:component menuButton.
   443         self click:1 inComponent:lastComponent menuButton.
   448         self click:1 inComponent:component menuButton.
   444         Delay waitForSeconds:0.3.
   449         Delay waitForSeconds:0.3.
   445         (idx := lastComponent list indexOf:itemsLabel ifAbsent:[nil]) isNil ifTrue:[
   450         (idx := component list indexOf:itemsLabel ifAbsent:[nil]) isNil ifTrue:[
   446             self error:'no such item in comboList: ',itemsLabel
   451             self error:'no such item in comboList: ',itemsLabel
   447         ].
   452         ].
   448         lastComponent select:idx.
   453         component select:idx.
   449         Delay waitForSeconds:0.3.
   454         Delay waitForSeconds:0.3.
   450         lastComponent shownMenu notNil ifTrue:[
   455         component shownMenu notNil ifTrue:[
   451             lastComponent shownMenu hide.
   456             component shownMenu hide.
   452         ].    
   457         ].    
   453         ^ self
   458         ^ self
   454     ].    
   459     ].    
       
   460     (component isKindOf:HierarchicalListView) ifTrue:[
       
   461         component 
       
   462             selectElementForWhich:[:el |
       
   463                 el label string = itemsLabel
       
   464             ] 
       
   465             ifAbsent:[
       
   466                 self error:'no such item in hierarchicalList: ',itemsLabel
       
   467             ].
       
   468         ^ self
       
   469     ].
       
   470 
   455     self error:'cannot select this component'
   471     self error:'cannot select this component'
   456 
   472 
   457     "Created: / 19-07-2019 / 12:34:25 / Claus Gittinger"
   473     "Created: / 19-07-2019 / 12:34:25 / Claus Gittinger"
   458     "Modified (format): / 19-07-2019 / 14:55:34 / Claus Gittinger"
   474     "Modified (format): / 19-07-2019 / 14:55:34 / Claus Gittinger"
   459 !
   475 !
   757         ].
   773         ].
   758         candidates size == 1 ifTrue:[
   774         candidates size == 1 ifTrue:[
   759             ^ candidates first
   775             ^ candidates first
   760         ].
   776         ].
   761     ].
   777     ].
   762     application isNil ifTrue:[
   778     true "application isNil" ifTrue:[
   763         "/ search through all current applications
   779         "/ search through all current applications
   764         WindowGroup scheduledWindowGroups do:[:eachWG |
   780         WindowGroup scheduledWindowGroups do:[:eachWG |
   765             |eachApp|
   781             |eachApp|
   766 
   782 
   767             (eachApp := eachWG application) notNil ifTrue:[
   783             (eachApp := eachWG application) notNil ifTrue:[
  1210     
  1226     
  1211     application isNil ifTrue:[
  1227     application isNil ifTrue:[
  1212         application := WindowGroup activeMainApplication.
  1228         application := WindowGroup activeMainApplication.
  1213     ].
  1229     ].
  1214     closeApplicationWhenFinished := false.
  1230     closeApplicationWhenFinished := false.
       
  1231     defaultComponentWaitTime isNil ifTrue:[ defaultComponentWaitTime := 1 ].
  1215 
  1232 
  1216     "/ run in verifying mode
  1233     "/ run in verifying mode
  1217     verifying := true.
  1234     verifying := true.
  1218     [
  1235     [
  1219         Error handle:[:ex |
  1236         Error handle:[:ex |
  1318 
  1335 
  1319 doStream:specStream
  1336 doStream:specStream
  1320     |previousStream resources|
  1337     |previousStream resources|
  1321 
  1338 
  1322     resources := self class classResources.
  1339     resources := self class classResources.
  1323     
  1340 
       
  1341     streamStack isNil ifTrue:[ streamStack := OrderedCollection new ].
       
  1342     streamStack add:opStream.
       
  1343 
  1324     previousStream := opStream.
  1344     previousStream := opStream.
  1325     [
  1345     [
  1326         opStream := specStream.
  1346         opStream := specStream.
  1327         [opStream atEnd] whileFalse:[
  1347         [opStream atEnd] whileFalse:[
  1328             self nextCommand.
  1348             self nextCommand.
  1338                     ^ AbortOperationRequest raise
  1358                     ^ AbortOperationRequest raise
  1339                 ].    
  1359                 ].    
  1340             ].    
  1360             ].    
  1341         ].    
  1361         ].    
  1342     ] ensure:[
  1362     ] ensure:[
       
  1363         streamStack removeLast.
  1343         opStream := previousStream
  1364         opStream := previousStream
  1344     ].
  1365     ].
  1345     
  1366     
  1346 "<<END
  1367 "<<END
  1347      ShowMeHowItWorks do:#(
  1368      ShowMeHowItWorks do:#(