@@ -283,6 +283,10 @@ def GetLanguages(self):
283283 path_to_language_folder = os .path .join (UserInterface .path_to_languages_folder (), language )
284284 # only add this language if there is a xxx_Rules.yaml file
285285 files = glob .glob (os .path .join (path_to_language_folder , "*_Rules.yaml" ))
286+ if len (files ) == 0 :
287+ # look in the .zip file for the style files -- it might not have been unzipped
288+ zip_file = ZipFile (f"{ path_to_language_folder } \\ { language } .zip" , "r" )
289+ files = [name for name in zip_file .namelist () if name .endswith ('_Rules.yaml' )]
286290 if files :
287291 # add to the listbox the text for this language together with the code
288292 if languages_dict .get (language , "missing" ) != "missing" :
@@ -330,6 +334,7 @@ def GetSpeechStyles(self, this_SpeechStyle: str):
330334 this_language_code = getCurrentLanguage ().lower ().replace ("_" , "-" )
331335 # FIX: when dialog is aware of regional dialects, remove this next line that removes the dialect part
332336 this_language_code = this_language_code .split ("-" )[0 ] # grab the first part
337+ log .info (f"Language==Auto, voice is '{ this_language_code } '" )
333338
334339 this_language_path = (
335340 os .path .expanduser ("~" )
@@ -338,14 +343,17 @@ def GetSpeechStyles(self, this_SpeechStyle: str):
338343 )
339344 this_path = this_language_path + "\\ *_Rules.yaml"
340345 # populate the m_choiceSpeechStyle choices
341- all_style_files = glob .glob (this_path ) # works for unzipped dirs
346+ # start with listing unzipped dirs
347+ all_style_files = [os .path .basename (name ) for name in glob .glob (this_path )]
348+ log .info (f'\n GetSpeechStyles: lang={ this_language_code } , non-zipped sytle files found: { all_style_files } ' )
342349 if len (all_style_files ) == 0 :
343350 # look in the .zip file for the style files
344351 zip_file = ZipFile (f"{ this_language_path } \\ { this_language_code } .zip" , "r" )
345- all_style_files = [name for name in zip_file .namelist () if name .endswith ('.jpg' )]
346- for f in glob .glob (this_path ):
347- fname = os .path .basename (f )
348- self .m_choiceSpeechStyle .Append ((fname [: fname .find ("_Rules.yaml" )]))
352+ all_style_files = [name for name in zip_file .namelist () if name .endswith ('_Rules.yaml' )]
353+ log .info (f'...: non-zipped style files found: { all_style_files } ' )
354+ for name in all_style_files :
355+ log .info (f'...in loop, appending name="{ name [: name .find ("_Rules.yaml" )]} "' )
356+ self .m_choiceSpeechStyle .Append ((name [: name .find ("_Rules.yaml" )]))
349357 try :
350358 # set the SpeechStyle to the same as previous
351359 self .m_choiceSpeechStyle .SetStringSelection (this_SpeechStyle )
0 commit comments