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 lastComponentName lastComponent lastResult |
9 voice translate' |
9 voice translate language verifying' |
10 classVariableNames:'IntroShownCount' |
10 classVariableNames:'IntroShownCount' |
11 poolDictionaries:'' |
11 poolDictionaries:'' |
12 category:'Interface-Help' |
12 category:'Interface-Help' |
13 ! |
13 ! |
14 |
14 |
69 ) |
71 ) |
70 " |
72 " |
71 |
73 |
72 "Created: / 19-07-2019 / 10:52:59 / Claus Gittinger" |
74 "Created: / 19-07-2019 / 10:52:59 / Claus Gittinger" |
73 "Modified (comment): / 23-07-2019 / 10:26:42 / Claus Gittinger" |
75 "Modified (comment): / 23-07-2019 / 10:26:42 / Claus Gittinger" |
|
76 ! |
|
77 |
|
78 do:specArray |
|
79 "spec contains a list of action commands (show: / moveTo: etc.)" |
|
80 |
|
81 self new do:specArray |
|
82 |
|
83 " |
|
84 ShowMeHowItWorks do: |
|
85 #( |
|
86 (language: de) |
|
87 (show: 'üben üben üben') |
|
88 (wait: 0.5) |
|
89 (moveTo: NameOfComponent) |
|
90 ) |
|
91 " |
|
92 |
|
93 "Created: / 19-07-2019 / 10:52:59 / Claus Gittinger" |
|
94 "Modified (comment): / 23-07-2019 / 10:26:42 / Claus Gittinger" |
74 ! ! |
95 ! ! |
75 |
96 |
76 !ShowMeHowItWorks methodsFor:'accessing'! |
97 !ShowMeHowItWorks methodsFor:'accessing'! |
77 |
98 |
78 application:something |
99 application:anApplication |
79 application := something. |
100 "if set, only that application is presented (widget search is limtied to that one)" |
|
101 |
|
102 application := anApplication. |
80 ! ! |
103 ! ! |
81 |
104 |
82 !ShowMeHowItWorks methodsFor:'commands'! |
105 !ShowMeHowItWorks methodsFor:'commands'! |
83 |
106 |
84 intro |
107 intro |
85 <action> |
108 <action> |
86 |
109 |
|
110 verifying ifTrue:[^ self]. |
|
111 |
|
112 IntroShownCount := (IntroShownCount ? 0). |
|
113 |
87 "/ only say this a few times.. |
114 "/ only say this a few times.. |
88 IntroShownCount := (IntroShownCount ? 0) + 1. |
|
89 IntroShownCount > 3 ifTrue:[^ self]. |
115 IntroShownCount > 3 ifTrue:[^ self]. |
90 |
116 IntroShownCount := IntroShownCount + 1. |
|
117 |
|
118 self language:(Smalltalk language). |
91 self tell:(self class classResources |
119 self tell:(self class classResources |
92 string:'You can stop this show, by pressing the SHIFT key'). |
120 string:'You can stop this show, by pressing the SHIFT key'). |
93 |
121 |
94 "Created: / 19-07-2019 / 15:49:19 / Claus Gittinger" |
122 "Created: / 19-07-2019 / 15:49:19 / Claus Gittinger" |
95 "Modified: / 23-07-2019 / 11:06:13 / Claus Gittinger" |
123 "Modified: / 23-07-2019 / 11:06:13 / Claus Gittinger" |
307 " |
339 " |
308 |
340 |
309 <action> |
341 <action> |
310 |
342 |
311 |idx| |
343 |idx| |
312 |
344 |
|
345 verifying ifTrue:[^ self]. |
|
346 |
313 (lastComponent isKindOf:ComboView) ifTrue:[ |
347 (lastComponent isKindOf:ComboView) ifTrue:[ |
314 "/ click on the menubutton |
348 "/ click on the menubutton |
315 self movePointerToComponent:lastComponent menuButton. |
349 self movePointerToComponent:lastComponent menuButton. |
316 self click:1 inComponent:lastComponent menuButton. |
350 self click:1 inComponent:lastComponent menuButton. |
317 Delay waitForSeconds:0.3. |
351 Delay waitForSeconds:0.3. |
498 |
536 |
499 "Created: / 19-07-2019 / 15:21:29 / Claus Gittinger" |
537 "Created: / 19-07-2019 / 15:21:29 / Claus Gittinger" |
500 ! |
538 ! |
501 |
539 |
502 talking |
540 talking |
|
541 verifying ifTrue:[^ false]. |
|
542 |
503 "/ ^ Expecco::ExpeccoPreferences current speechEffectsEnabled |
543 "/ ^ Expecco::ExpeccoPreferences current speechEffectsEnabled |
504 ^ true |
544 ^ true |
505 |
545 |
506 "Created: / 19-07-2019 / 14:31:14 / Claus Gittinger" |
546 "Created: / 19-07-2019 / 14:31:14 / Claus Gittinger" |
507 "Modified (comment): / 23-07-2019 / 09:45:35 / Claus Gittinger" |
547 "Modified (comment): / 23-07-2019 / 09:45:35 / Claus Gittinger" |
512 randomThankYou |
552 randomThankYou |
513 ^ #( |
553 ^ #( |
514 'thank you, for watching' |
554 'thank you, for watching' |
515 'thank you for watching' |
555 'thank you for watching' |
516 'thank you' |
556 'thank you' |
|
557 'thanks' |
517 'have a good day' |
558 'have a good day' |
|
559 'have a nice day' |
518 'have fun' |
560 'have fun' |
519 'have fun with expecco' |
561 'have fun with expecco' |
520 'have fun with expecco, by the way: expecco comes from the latin word: peccare, which means: "to sin"' |
562 'have fun with expecco, by the way: expecco comes from the latin word: peccare, which means: "to sin"' |
521 'happy hacking' |
563 'happy hacking' |
522 'happy hacking, I hope you liked what you saw' |
564 'happy hacking, I hope you liked what you saw' |
523 'hope you liked it' |
565 'hope you liked it' |
524 'see you again' |
566 'see you again' |
|
567 'be the source with you' |
|
568 'be the force with you' |
|
569 'may the force be with you' |
|
570 'may the source be with you' |
525 'please give feedback, and let us know, if you liked it' |
571 'please give feedback, and let us know, if you liked it' |
526 'if you have any questions, please contact exept' |
572 'if you have any questions, please contact exept' |
527 'if you need more information, please take a look at the wiki' |
573 'if you need more information, please take a look at the wiki' |
528 ) atRandom |
574 ) atRandom |
529 |
575 |
530 " |
576 " |
|
577 OperatingSystem speak:'may the source be with you' |
531 OperatingSystem speak:'have fun with expecco' |
578 OperatingSystem speak:'have fun with expecco' |
532 OperatingSystem speak:'have fun with expecco, by the way: expecco comes from the latin word: peccare, which means: to sin' |
579 OperatingSystem speak:'have fun with expecco, by the way: expecco comes from the latin word: peccare, which means: to sin' |
533 OperatingSystem speak:'happy hacking, I hope you liked what you saw' |
580 OperatingSystem speak:'happy hacking, I hope you liked what you saw' |
534 OperatingSystem speak:'please give feedback, and let us know, if you liked it' |
581 OperatingSystem speak:'please give feedback, and let us know, if you liked it' |
535 OperatingSystem speak:'if you have any questions, please contact exept' |
582 OperatingSystem speak:'if you have any questions, please contact exept' |
611 |
660 |
612 candidates size == 1 ifTrue:[ |
661 candidates size == 1 ifTrue:[ |
613 component := candidates first |
662 component := candidates first |
614 ] ifFalse:[ |
663 ] ifFalse:[ |
615 candidates notEmpty ifTrue:[ |
664 candidates notEmpty ifTrue:[ |
|
665 "/ multiple elements (probably there are multiple topviews open... |
|
666 "/ check the current windowGroup |
616 self error:'multiple components found by name: ',componentName. |
667 self error:'multiple components found by name: ',componentName. |
617 ] |
668 ] |
618 ]. |
669 ]. |
619 ]. |
670 ]. |
620 ^ component |
671 ^ component |
722 |position| |
773 |position| |
723 |
774 |
724 aWidgetOrMenuItem isView ifTrue:[ |
775 aWidgetOrMenuItem isView ifTrue:[ |
725 position := aWidgetOrMenuItem screenBounds center rounded |
776 position := aWidgetOrMenuItem screenBounds center rounded |
726 ] ifFalse:[ |
777 ] ifFalse:[ |
727 self halt. |
778 self error:'not a widget: ',aWidgetOrMenuItem printString. |
728 ]. |
779 ]. |
729 self circlePointerAroundScreenPosition:position |
780 self circlePointerAroundScreenPosition:position |
730 |
781 |
731 "Created: / 19-07-2019 / 13:12:35 / Claus Gittinger" |
782 "Created: / 19-07-2019 / 13:12:35 / Claus Gittinger" |
732 "Modified: / 23-07-2019 / 09:38:12 / Claus Gittinger" |
783 "Modified: / 23-07-2019 / 09:38:12 / Claus Gittinger" |
734 |
785 |
735 circlePointerAroundScreenPosition:position |
786 circlePointerAroundScreenPosition:position |
736 "circle around it a few times" |
787 "circle around it a few times" |
737 |
788 |
738 |screen stepDelayTime numCircles circlingSpeed radius| |
789 |screen stepDelayTime numCircles circlingSpeed radius| |
|
790 |
|
791 verifying ifTrue:[^ self]. |
739 |
792 |
740 screen := Screen current. |
793 screen := Screen current. |
741 |
794 |
742 circlingSpeed := self circlingSpeed. "/ time per round |
795 circlingSpeed := self circlingSpeed. "/ time per round |
743 numCircles := self circlingCount. |
796 numCircles := self circlingCount. |
802 |position| |
855 |position| |
803 |
856 |
804 aWidgetOrMenuItem isView ifTrue:[ |
857 aWidgetOrMenuItem isView ifTrue:[ |
805 position := aWidgetOrMenuItem screenBounds center rounded |
858 position := aWidgetOrMenuItem screenBounds center rounded |
806 ] ifFalse:[ |
859 ] ifFalse:[ |
807 self halt. |
860 self error:'not a widget: ',aWidgetOrMenuItem printString. |
808 ]. |
861 ]. |
809 self movePointerToScreenPosition:position speed:pixelsPerSecond. |
862 self movePointerToScreenPosition:position speed:pixelsPerSecond. |
810 |
863 |
811 "Created: / 20-07-2019 / 08:12:49 / Claus Gittinger" |
864 "Created: / 20-07-2019 / 08:12:49 / Claus Gittinger" |
812 "Modified: / 23-07-2019 / 09:37:27 / Claus Gittinger" |
865 "Modified: / 23-07-2019 / 09:37:27 / Claus Gittinger" |
822 |
875 |
823 movePointerToScreenPosition:newPosition speed:pixelsPerSecond |
876 movePointerToScreenPosition:newPosition speed:pixelsPerSecond |
824 "move the mouse to newPosition, which is a screen position" |
877 "move the mouse to newPosition, which is a screen position" |
825 |
878 |
826 |screen distance start numSteps moveTime stepDelayTime delta| |
879 |screen distance start numSteps moveTime stepDelayTime delta| |
|
880 |
|
881 verifying ifTrue:[^ self]. |
827 |
882 |
828 screen := Screen current. |
883 screen := Screen current. |
829 start := screen pointerPosition. |
884 start := screen pointerPosition. |
830 |
885 |
831 distance := start dist:newPosition. |
886 distance := start dist:newPosition. |
870 ! |
925 ! |
871 |
926 |
872 click:buttonNr inComponent:component clickTime:clickTime |
927 click:buttonNr inComponent:component clickTime:clickTime |
873 "press-release in a component" |
928 "press-release in a component" |
874 |
929 |
|
930 self assert:component notNil. |
|
931 verifying ifTrue:[^ self]. |
|
932 |
875 component simulateButtonPress:buttonNr at:(component extent // 2) sendDisplayEvent:false. |
933 component simulateButtonPress:buttonNr at:(component extent // 2) sendDisplayEvent:false. |
876 Delay waitForSeconds:clickTime. |
934 Delay waitForSeconds:clickTime. |
877 component simulateButtonRelease:buttonNr at:(component extent // 2) sendDisplayEvent:false. |
935 component simulateButtonRelease:buttonNr at:(component extent // 2) sendDisplayEvent:false. |
878 |
936 |
879 "/ self click:buttonNr atPosition:(component extent // 2) |
937 "/ self click:buttonNr atPosition:(component extent // 2) |
944 do:specArray |
1006 do:specArray |
945 "must run as a separate process; |
1007 "must run as a separate process; |
946 otherwise - if started by the app itself - |
1008 otherwise - if started by the app itself - |
947 no events will be processed while running" |
1009 no events will be processed while running" |
948 |
1010 |
949 self language:(Smalltalk language). |
1011 |wasActive| |
|
1012 |
|
1013 (wasActive := ActiveHelp isActive) ifTrue:[ |
|
1014 ActiveHelp stop. |
|
1015 ]. |
|
1016 |
|
1017 language isNil ifTrue:[ |
|
1018 self language:(Smalltalk language). |
|
1019 ]. |
950 translate := false. |
1020 translate := false. |
951 |
1021 |
952 application isNil ifTrue:[ |
1022 application isNil ifTrue:[ |
953 application := WindowGroup activeMainApplication. |
1023 application := WindowGroup activeMainApplication. |
954 ]. |
1024 ]. |
955 |
1025 |
|
1026 "/ run in verifying mode |
|
1027 verifying := true. |
956 [ |
1028 [ |
957 Error handle:[:ex | |
1029 Error handle:[:ex | |
958 Dialog warn:(self class classResources stringWithCRs:'An error was encountered in the show:\\%1' with:ex description) |
1030 (Dialog confirm:(self class classResources stringWithCRs:'Error encountered while verifying:\\%1\\Debug?' with:ex description)) |
|
1031 ifTrue:[ex reject]. |
959 ] do:[ |
1032 ] do:[ |
960 self doStream:(specArray readStream) |
1033 self doStream:(specArray readStream) |
|
1034 ]. |
|
1035 ] ensure:[ |
|
1036 verifying := false. |
|
1037 wasActive ifTrue:[ActiveHelp start]. |
|
1038 ]. |
|
1039 |
|
1040 [ |
|
1041 ActiveHelp stop. |
|
1042 [ |
|
1043 Error handle:[:ex | |
|
1044 Dialog warn:(self class classResources stringWithCRs:'An error was encountered in the show:\\%1' with:ex description) |
|
1045 ] do:[ |
|
1046 self doStream:(specArray readStream) |
|
1047 ]. |
|
1048 ] ensure:[ |
|
1049 wasActive ifTrue:[ActiveHelp start]. |
961 ]. |
1050 ]. |
962 ] fork. |
1051 ] fork. |
963 |
1052 |
964 " |
1053 " |
965 ShowMeHowItWorks do: |
1054 ShowMeHowItWorks do: |