equal
deleted
inserted
replaced
6 |
6 |
7 Object subclass:#ShowMeHowItWorks |
7 Object subclass:#ShowMeHowItWorks |
8 instanceVariableNames:'application opStream streamStack lastComponentName lastComponent |
8 instanceVariableNames:'application opStream streamStack lastComponentName lastComponent |
9 lastResult voice translate language verifying |
9 lastResult voice translate language verifying |
10 closeApplicationWhenFinished defaultComponentWaitTime ui |
10 closeApplicationWhenFinished defaultComponentWaitTime ui |
11 theShowFile defaultElementTimeout applicationStack' |
11 theShowFile defaultElementTimeout applicationStack pronunciations' |
12 classVariableNames:'IntroShownCount DebugMode StartLabel' |
12 classVariableNames:'IntroShownCount DebugMode StartLabel' |
13 poolDictionaries:'' |
13 poolDictionaries:'' |
14 category:'Interface-Help' |
14 category:'Interface-Help' |
15 ! |
15 ! |
16 |
16 |
55 click: ReceiverEditor |
55 click: ReceiverEditor |
56 )) |
56 )) |
57 (showing: 'Enter a value (or expression) into "receiver" field' do:( |
57 (showing: 'Enter a value (or expression) into "receiver" field' do:( |
58 enter: '100' |
58 enter: '100' |
59 )) |
59 )) |
60 |
60 ) |
|
61 ! |
|
62 |
|
63 example2 |
|
64 ShowMeHowItWorks do:#( |
|
65 language: 'de' |
|
66 (pronounce:'feature' as:'fiedscher') |
|
67 (pronounce:'suite' as:'swied') |
|
68 (pronounce:'expecco' as:'expecko') |
|
69 (pronounce:'read me' as:'ried mie') |
|
70 (pronounce:'python' as:'paiton') |
|
71 (pronounce:'jenkins' as:'dschengkins') |
|
72 show:'jenkins' |
|
73 show:'dies ist ein neues feature' |
|
74 show:'suite' |
|
75 show:'expecco' |
|
76 show:'read me' |
|
77 show:'python' |
|
78 show:'node' |
61 ) |
79 ) |
62 ! |
80 ! |
63 |
81 |
64 scriptFormat |
82 scriptFormat |
65 " |
83 " |
327 "go back to the previous app" |
345 "go back to the previous app" |
328 |
346 |
329 application := applicationStack removeLast. |
347 application := applicationStack removeLast. |
330 ! |
348 ! |
331 |
349 |
|
350 pronounce:word as:pronunciation |
|
351 <action> |
|
352 |
|
353 pronunciations isNil ifTrue:[ |
|
354 pronunciations := OrderedDictionary new. |
|
355 ]. |
|
356 pronunciations at:word put:pronunciation |
|
357 ! |
|
358 |
332 pushApplication:newApplicationOrName |
359 pushApplication:newApplicationOrName |
333 <action> |
360 <action> |
334 |
361 |
335 "goto another app, remembering where we were before" |
362 "goto another app, remembering where we were before" |
336 |
363 |
491 talkDone := Semaphore new. |
518 talkDone := Semaphore new. |
492 [ |
519 [ |
493 |sentence| |
520 |sentence| |
494 sentence := (sentenceOrNil ? xLatedMessage) copy withCRs replaceAny:c'\t' with:(Character space). |
521 sentence := (sentenceOrNil ? xLatedMessage) copy withCRs replaceAny:c'\t' with:(Character space). |
495 sentence := sentence copy withCRs replaceAny:c'\n\r' with:(Character space). |
522 sentence := sentence copy withCRs replaceAny:c'\n\r' with:(Character space). |
|
523 sentence := sentence asLowercase. |
|
524 pronunciations notNil ifTrue:[ |
|
525 pronunciations keysAndValuesDo:[:word :pronounced | |
|
526 (sentence includesString:word) ifTrue:[ |
|
527 sentence := sentence copyReplaceString:word withString:pronounced |
|
528 ] |
|
529 ] |
|
530 ]. |
496 self tell:sentence. |
531 self tell:sentence. |
497 talkDone signal |
532 talkDone signal |
498 ] fork. |
533 ] fork. |
499 |
534 |
500 "/ |
535 "/ |
2412 nextCommand := opStream next. |
2447 nextCommand := opStream next. |
2413 self doCommand:nextCommand. |
2448 self doCommand:nextCommand. |
2414 |
2449 |
2415 Display shiftDown ifTrue:[ |
2450 Display shiftDown ifTrue:[ |
2416 (IntroShownCount ? 0) > 3 ifFalse:[ |
2451 (IntroShownCount ? 0) > 3 ifFalse:[ |
2417 self tell:(self class classResources string:'You pressed the SHIFT key.'). |
2452 self tell:(self translate:'You pressed the SHIFT key.'). |
2418 ]. |
2453 ]. |
2419 self tell:(self class classResources string:'Do you want to stop the show?'). |
2454 self tell:(self translate:'Do you want to stop the show?'). |
2420 (Dialog confirm:(resources stringWithCRs:'Stop the demonstration?')) |
2455 (Dialog confirm:(resources stringWithCRs:'Stop the demonstration?')) |
2421 ifTrue:[ |
2456 ifTrue:[ |
2422 self tell:(self possiblyTranslate:'OK,'). |
2457 self tell:(self translate:'OK,'). |
2423 self tell:(self class classResources string:(self randomThankYou)). |
2458 self tell:(self translate:(self randomThankYou)). |
2424 ^ AbortOperationRequest raise |
2459 ^ AbortOperationRequest raise |
2425 ]. |
2460 ]. |
2426 ]. |
2461 ]. |
2427 ]. |
2462 ]. |
2428 ] ensure:[ |
2463 ] ensure:[ |
2460 |
2495 |
2461 "Created: / 19-07-2019 / 10:52:24 / Claus Gittinger" |
2496 "Created: / 19-07-2019 / 10:52:24 / Claus Gittinger" |
2462 "Modified: / 23-07-2019 / 11:48:45 / Claus Gittinger" |
2497 "Modified: / 23-07-2019 / 11:48:45 / Claus Gittinger" |
2463 ! |
2498 ! |
2464 |
2499 |
2465 possiblyTranslate:aString |
2500 translate:aString |
2466 |xLatedMessage| |
2501 ^ self class classResources stringWithCRs:aString. |
2467 |
|
2468 translate ifTrue:[ |
|
2469 xLatedMessage := self class classResources stringWithCRs:aString. |
|
2470 ^ xLatedMessage |
|
2471 ]. |
|
2472 ^ aString |
|
2473 ! ! |
2502 ! ! |
2474 |
2503 |
2475 !ShowMeHowItWorks::ItemInView class methodsFor:'documentation'! |
2504 !ShowMeHowItWorks::ItemInView class methodsFor:'documentation'! |
2476 |
2505 |
2477 documentation |
2506 documentation |