ShowMeHowItWorks.st
changeset 3715 8e37e3d91789
parent 3714 d3314ff81424
child 3716 08e97653176e
equal deleted inserted replaced
3714:d3314ff81424 3715:8e37e3d91789
   129 showing:message do:operationsOrNothing
   129 showing:message do:operationsOrNothing
   130     "execute operationsOrNothing while showing (and speaking) some message."
   130     "execute operationsOrNothing while showing (and speaking) some message."
   131 
   131 
   132     <action>
   132     <action>
   133     
   133     
   134     |messageView talkDone|
   134     |xLatedMessage messageView talkDone|
   135 
   135 
       
   136     xLatedMessage := application notNil 
       
   137                         ifTrue:[application resources string:message]
       
   138                         ifFalse:[message].
       
   139                         
   136     self assert:(operationsOrNothing isNil or:[operationsOrNothing isSequenceable]).
   140     self assert:(operationsOrNothing isNil or:[operationsOrNothing isSequenceable]).
   137 
   141 
   138     messageView := ActiveHelpView for:message.
   142     messageView := ActiveHelpView for:xLatedMessage.
   139     "/ messageView shapeStyle:#cartoon.
   143     "/ messageView shapeStyle:#cartoon.
   140     [
   144     [
       
   145         messageView origin:(Screen current pointerPosition).
   141         messageView realize.
   146         messageView realize.
   142 
   147 
   143         self talking ifTrue:[
   148         self talking ifTrue:[
   144             talkDone := Semaphore new.
   149             talkDone := Semaphore new.
   145             [
   150             [
   146                 self tell:message.
   151                 self tell:xLatedMessage.
   147                 talkDone signal
   152                 talkDone signal
   148             ] fork.
   153             ] fork.
   149             
   154             
   150             "/
   155             "/
   151             "/ allow speaker some headoff
   156             "/ allow speaker some headoff
   152             Delay waitForSeconds:(message size / 20).
   157             Delay waitForSeconds:(xLatedMessage size / 30).
   153         ].
   158         ].
   154 
   159 
   155         operationsOrNothing notEmptyOrNil ifTrue:[
   160         operationsOrNothing notEmptyOrNil ifTrue:[
   156             self doStream:(operationsOrNothing readStream).
   161             self doStream:(operationsOrNothing readStream).
   157         ].
   162         ].
   161     self talking ifTrue:[
   166     self talking ifTrue:[
   162         talkDone wait.
   167         talkDone wait.
   163     ].
   168     ].
   164 
   169 
   165     "Created: / 19-07-2019 / 11:19:27 / Claus Gittinger"
   170     "Created: / 19-07-2019 / 11:19:27 / Claus Gittinger"
   166     "Modified: / 19-07-2019 / 15:59:52 / Claus Gittinger"
   171     "Modified: / 19-07-2019 / 21:37:07 / Claus Gittinger"
   167     "Modified (comment): / 19-07-2019 / 18:54:43 / Claus Gittinger"
       
   168 !
   172 !
   169 
   173 
   170 wait:seconds
   174 wait:seconds
   171     <action>
   175     <action>
   172     
   176     
   521     ^ component
   525     ^ component
   522 
   526 
   523     "Created: / 19-07-2019 / 11:36:21 / Claus Gittinger"
   527     "Created: / 19-07-2019 / 11:36:21 / Claus Gittinger"
   524 !
   528 !
   525 
   529 
       
   530 randomThankYou
       
   531     ^ #(
       
   532         'thank you, for watching'
       
   533         'thank you for watching'
       
   534         'thank you'
       
   535         'have a good day'
       
   536         'have fun'
       
   537         'have fun with expecco'
       
   538         'have fun with expecco, by the way: expecco comes from the latin word: peccare, which means: "to sin"'
       
   539         'happy hacking'
       
   540         'happy hacking, I hope you liked what you saw'
       
   541         'hope you liked it'
       
   542         'see you again'
       
   543         'please give feedback, and let us know, if you liked it'
       
   544         'if you have any questions, please contact exept'
       
   545         'if you need more information, please take a look at the wiki'
       
   546     ) atRandom
       
   547 
       
   548     "
       
   549      OperatingSystem speak:'have fun with expecco'
       
   550      OperatingSystem speak:'have fun with expecco, by the way: expecco comes from the latin word: peccare, which means: "to sin"'
       
   551      OperatingSystem speak:'happy hacking, I hope you liked what you saw'
       
   552      OperatingSystem speak:'please give feedback, and let us know, if you liked it'
       
   553      OperatingSystem speak:'if you have any questions, please contact exept'
       
   554      OperatingSystem speak:'if you need more information, please take a look at the wiki'
       
   555     "
       
   556 
       
   557     "Created: / 19-07-2019 / 21:39:18 / Claus Gittinger"
       
   558 !
       
   559 
   526 tell:message
   560 tell:message
   527     self talking ifTrue:[
   561     self talking ifTrue:[
   528         OperatingSystem speak:message.
   562         OperatingSystem speak:message.
   529     ].
   563     ].
   530 
   564 
   790 
   824 
   791     "Created: / 19-07-2019 / 15:34:55 / Claus Gittinger"
   825     "Created: / 19-07-2019 / 15:34:55 / Claus Gittinger"
   792 !
   826 !
   793 
   827 
   794 doStream:specStream
   828 doStream:specStream
   795     |previousStream|
   829     |previousStream resources|
   796 
   830 
       
   831     resources := self class classResources.
       
   832     
   797     previousStream := opStream.
   833     previousStream := opStream.
   798     [
   834     [
   799         opStream := specStream.
   835         opStream := specStream.
   800         [opStream atEnd] whileFalse:[
   836         [opStream atEnd] whileFalse:[
   801             self nextCommand.
   837             self nextCommand.
   802             Display shiftDown ifTrue:[
   838             Display shiftDown ifTrue:[
   803                 (Dialog confirm:(self class classResources stringWithCRs:'Stop the demonstration?'))
   839                 self tell:(resources string:'you pressed the shift key, do you want to stop the show?').
       
   840                 (Dialog confirm:(resources stringWithCRs:'Stop the demonstration?'))
   804                 ifTrue:[
   841                 ifTrue:[
   805                     self tell:'you stopped the show, thank you, for watching'.
   842                     self tell:(resources string:'you stopped the show,').
       
   843                     self tell:(resources string:(self randomThankYou)).
   806                     ^ AbortOperationRequest raise
   844                     ^ AbortOperationRequest raise
   807                 ].    
   845                 ].    
   808             ].    
   846             ].    
   809         ].    
   847         ].    
   810     ] ensure:[
   848     ] ensure:[
   838         )
   876         )
   839      )
   877      )
   840 END"
   878 END"
   841 
   879 
   842     "Created: / 19-07-2019 / 10:52:24 / Claus Gittinger"
   880     "Created: / 19-07-2019 / 10:52:24 / Claus Gittinger"
   843     "Modified: / 19-07-2019 / 18:56:13 / Claus Gittinger"
   881     "Modified: / 19-07-2019 / 21:41:43 / Claus Gittinger"
   844 !
   882 !
   845 
   883 
   846 nextCommand
   884 nextCommand
   847     self doCommand:(opStream next).
   885     self doCommand:(opStream next).
   848 
   886