ApplicationModel.st
changeset 4381 d761df03f034
parent 4369 3d41c17cc1a7
child 4384 0c556a4def9c
equal deleted inserted replaced
4380:86812797002e 4381:d761df03f034
  2932     "Created: / 18-07-2019 / 21:59:06 / Claus Gittinger"
  2932     "Created: / 18-07-2019 / 21:59:06 / Claus Gittinger"
  2933     "Modified: / 23-07-2019 / 09:04:36 / Claus Gittinger"
  2933     "Modified: / 23-07-2019 / 09:04:36 / Claus Gittinger"
  2934 !
  2934 !
  2935 
  2935 
  2936 showMeHowItWorks:minorKey
  2936 showMeHowItWorks:minorKey
  2937     "present the default show, from a file named <majorKey>_<minorKey>_<lang>.show.
  2937     "present the show, from a file named <majorKey>_<minorKey>_<lang>.show.
  2938      Usually, the major key defaults to the classes name,
  2938      Usually, the major key defaults to the classes name,
  2939      and the minor key is often emptyOrNil, if there is only one show."
  2939      and the minor key is often emptyOrNil, if there is only one show."
  2940 
  2940 
  2941      self showMeHowItWorks:minorKey inAny:(self showMeHowItWorksDefaultMajorKeys)
  2941      self showMeHowItWorks:minorKey inAny:(self showMeHowItWorksDefaultMajorKeys)
  2942 
  2942 
  2952 showMeHowItWorks:minorKey inAny:setOfMajorKeys
  2952 showMeHowItWorks:minorKey inAny:setOfMajorKeys
  2953     "start a ShowMeHowItWorks presentation.
  2953     "start a ShowMeHowItWorks presentation.
  2954      This is controlled by a spec, which is read from the resources/shows folder,
  2954      This is controlled by a spec, which is read from the resources/shows folder,
  2955      and is named <appClassName>_<lang>.show"
  2955      and is named <appClassName>_<lang>.show"
  2956 
  2956 
  2957     |fn rsrcDir spec|
  2957     |fn rsrcDir|
  2958 
  2958 
  2959     rsrcDir := self class packageDirectory asFilename / 'resources' / 'shows'.
  2959     rsrcDir := self class packageDirectory asFilename / 'resources' / 'shows'.
  2960     (rsrcDir exists) ifFalse:[
  2960     (rsrcDir exists) ifFalse:[
  2961         Dialog warn:'No presentations available for %1' with:(self className).
  2961         Dialog warn:'No presentations available for %1' with:(self className).
  2962         ^ self
  2962         ^ self
  2975         } pairsDo:[:rest :lang |
  2975         } pairsDo:[:rest :lang |
  2976             |triedFn|
  2976             |triedFn|
  2977 
  2977 
  2978             triedFn := fn,rest.
  2978             triedFn := fn,rest.
  2979             (rsrcDir / triedFn) exists ifTrue:[
  2979             (rsrcDir / triedFn) exists ifTrue:[
  2980                 (rsrcDir / triedFn) readingFileWithEncoding:#utf8 do:[:s |
       
  2981                     spec := Array readFrom:s.
       
  2982                 ].
       
  2983                 ShowMeHowItWorks new
  2980                 ShowMeHowItWorks new
  2984                     application:self;
  2981                     application:self;
  2985                     language:lang;
  2982                     language:lang;
  2986                     do:spec.
  2983                     doShowFile:(rsrcDir / triedFn).
  2987                 ^ self
  2984                 ^ self
  2988             ]
  2985             ]
  2989         ].
  2986         ].
  2990     ].    
  2987     ].    
  2991     Dialog warn:'No presentations available for %1 (missing show: "%2")' with:(self className) with:(fn,'.show').
  2988     Dialog warn:'No presentations available for %1 (missing show: "%2")' with:(self className) with:(fn,'.show').