def cmd_analyse_photo(self): # If pointer is defined just switch focus to the window if self.win_photo_an: self.win_photo_an.focus_force() return # Create window from class and save pointer path = filedialog.askdirectory(title=get_name("ask_dir_photo_an")) if path: try: # Create window from class and save pointer self.win_photo_an = WinPhotoAn(master=self.master, path=path) # This exception will be raised if user chooses folder without photo # and rejects suggestion to choose another folder except ValueError: return # Bind handler on destroying to clean up self class self.win_photo_an.bind("<Destroy>", self.handle_destroy_win_photo_an)
def analyze_photo_from_project(self, _=None): # TODO: show warning to user if self.win_photo_an: self.win_photo_an.destroy() try: # Create window from class and save pointer self.win_photo_an = WinPhotoAn( master=self.master, path=os_path.split(self.project_file)[0], project_keywords=self.project_dict["keywords"]) # This exception will be raised if user chooses a project without photo except ValueError: messagebox.showerror( parent=self.master, title=get_name("title_error_no_photo_in_project"), message=get_name("text_error_no_photo_in_project")) return # Bind handler on destroying to clean up self class self.win_photo_an.bind("<Destroy>", self.handle_destroy_win_photo_an)