@@ -38,8 +38,8 @@ class DirectorySelectionWidgets:
38
38
39
39
def __init__ ( # pylint: disable=too-many-arguments
40
40
self ,
41
- parent ,
42
- parent_frame ,
41
+ parent : tk . Toplevel ,
42
+ parent_frame : tk . Widget ,
43
43
initialdir : str ,
44
44
label_text : str ,
45
45
autoresize_width : bool ,
@@ -175,7 +175,7 @@ def __init__( # pylint: disable=too-many-arguments
175
175
self .local_filesystem = local_filesystem
176
176
self .destroy_parent_on_open = destroy_parent_on_open
177
177
178
- def on_select_directory (self ) -> None :
178
+ def on_select_directory (self ) -> bool :
179
179
# Call the base class method to open the directory selection dialog
180
180
if super ().on_select_directory ():
181
181
if "vehicle_templates" in self .directory and not self .local_filesystem .allow_editing_template_files :
@@ -186,14 +186,14 @@ def on_select_directory(self) -> None:
186
186
"as those are used as a template for new vehicles"
187
187
),
188
188
)
189
- return
189
+ return False
190
190
self .local_filesystem .vehicle_dir = self .directory
191
191
192
192
if not self .local_filesystem .vehicle_configuration_files_exist (self .directory ):
193
193
_filename = self .local_filesystem .vehicle_components_json_filename
194
194
error_msg = _ ("Selected directory must contain files matching \\ d\\ d_*\\ .param and a {_filename} file" )
195
195
messagebox .showerror (_ ("Invalid Vehicle Directory Selected" ), error_msg .format (** locals ()))
196
- return
196
+ return False
197
197
198
198
try :
199
199
self .local_filesystem .re_init (self .directory , self .local_filesystem .vehicle_type )
@@ -207,9 +207,11 @@ def on_select_directory(self) -> None:
207
207
LocalFilesystem .store_recently_used_vehicle_dir (self .directory )
208
208
if self .destroy_parent_on_open :
209
209
self .parent .root .destroy ()
210
- return
210
+ return True
211
211
# No files were found in the selected directory
212
212
show_no_param_files_error (self .directory )
213
+ return True
214
+ return False
213
215
214
216
215
217
class VehicleDirectorySelectionWindow (BaseWindow ):
0 commit comments