def end_of_file_shutdown(self): # End of file reached TKHelper.disable_buttons(button_list=self.w.review_buttons) # self.start_time = time.time() #self.logger.debug(f'COMPLETED time={int((time.time() - self.start_time) / 60)} minutes') self.w.status.set_text("Done. Shutting Down...") self.w.original_entry.set_text(" ") path = self.cfg.get("gedcom_path") self.ancestry_file_handler.close() self.update_statistics() self.w.root.update_idletasks() # Let GUI update if 'ramp' in self.out_suffix: # Gramps file is .csv messagebox.showinfo( "Info", f"Finished. Created file for Import to Ancestry software:\n\n {path}.csv" ) else: messagebox.showinfo( "Info", f"Finished. Created file for Import to Ancestry software:\n\n {path}.{self.out_suffix}" ) self.logger.info('End of file') self.shutdown()
def quit_handler(self): """ Set flag for shutdown. Process all global replaces and exit """ self.skip_count += 1 path = self.cfg.get("gedcom_path") if self.w.prog.shutdown_requested: # Already in shutdown and user aborted self.logger.info('Shutdown') self.shutdown() self.w.prog.shutdown_requested = True if messagebox.askyesno( 'Generate Import File?', f'All updates saved.\n\nDo you want to generate a file for import' f' to Gedcom/Gramps?\n\n', default='no'): # Write file for importing back messagebox.showinfo( "Generate Import File", "Reminder - make sure the ancestry export file you are working on is up to date before " "generating a file to import back!\n\nThe file will take about 10 minutes per 1000 places" ) TKHelper.disable_buttons(button_list=self.w.review_buttons) self.w.quit_button.config(state="disabled") self.w.prog.startup = True self.w.statistics_text.configure(style="Good.TLabel") self.w.user_entry.set_text("Creating Import File...") self.start_time = time.time() # Write out the item we are on self.ancestry_file_handler.write_asis( self.w.original_entry.get_text()) # We will still continue to go through file, but only handle global replaces self.handle_place_entry() else: # Immediate exit self.logger.info('Shutdown') self.shutdown()