diff --git a/waypoint_manager/scripts/manager_GUI.py b/waypoint_manager/scripts/manager_GUI.py index eaf7390..87161ed 100755 --- a/waypoint_manager/scripts/manager_GUI.py +++ b/waypoint_manager/scripts/manager_GUI.py @@ -131,7 +131,11 @@ with open(map_path) as file: # .yamlを読み込む map_yaml = ruamel.yaml.YAML().load(file) + if not "image" in map_yaml.keys(): + self.message("Selected map file is unexpected format.") + return self.mymap = MyMap(Path(map_path), map_yaml) + self.message("Read map file " + map_path) ## キャンバスサイズに合わせて画像を表示 scale = 1 offset_x = 0 @@ -153,7 +157,6 @@ self.master.title(self.waypoints_filepath.name + " - " + Path(map_path).name) else: self.master.title(Path(map_path).name) - # self.open_menu.entryconfigure("Map", state=tk.DISABLED) self.open_menu.entryconfigure("Waypoints", state=tk.NORMAL) if self.waypoints is None: self.message("Please open waypoints file ") @@ -184,11 +187,15 @@ if not filepath: return with open(filepath) as file: wp_yaml = ruamel.yaml.YAML().load(file) + if (not "waypoints" in wp_yaml.keys()) or (not "finish_pose" in wp_yaml.keys()): + self.message("Selected waypoints file is unexpected format.") + return self.waypoints = WaypointList(wp_yaml) self.finish_pose = FinishPose(wp_yaml) self.waypoints_filepath = Path(filepath) self.plot_waypoints() self.master.title(self.waypoints_filepath.name + " - " + self.master.title()) + self.message("Read waypoints file " + filepath) self.file_menu.entryconfigure("Save", state=tk.NORMAL) self.file_menu.entryconfigure("Save As", state=tk.NORMAL) self.popup_menu.entryconfigure("Add waypoint here", state=tk.NORMAL)