def __init__(self, screen): self.screen = screen self.currentBoss = 0 self.screenWidth = screen.get_width() self.screenHeight = screen.get_height() self.playerShip = PlayerSpaceShip(screen, self.enemies) self.allsprites = pygame.sprite.RenderPlain() self.scoreFont = pygame.font.SysFont("Arial", 30) self.enterNameFont = pygame.font.SysFont("Arial", 40) self.healthProgress = progress.TextProgress( pygame.font.Font(os.path.join('fonts', "Roboto-Regular.ttf"), 45), "HEALTH", (255, 0, 0), (0, 0, 0)) self.score = 0 self.sound_game_over = pygame.mixer.Sound( os.path.join('sounds', "gameover.wav"))
def main(name, datatype, passed_args=None): # If passed_args is None, this will use sys.argv options, args = parse_args(datatype, passed_args) if not args: # Help has already been printed return 2 log.info("------------- %s %s -----------------" % (name, __VERSION__)) start_time = datetime.datetime.now().replace( microsecond=0) # start the clock ticking check_python_version() if passed_args is None: cmdline = " ".join(sys.argv) else: cmdline = " ".join(passed_args) log.info("Command-line arguments used: %s" % cmdline) # Load, using the first argument as the folder try: # TODO: just pass the options in! config.the_config.init(datatype, options.phylogeny_program, options.save_phylofiles, options.cmdline_extras, options.cluster_weights, options.cluster_percent, options.cluster_max, options.kmeans, options.quick, options.min_subset_size, options.all_states, options.no_ml_tree) cfg = config.the_config # Set up the progress callback progress.TextProgress(cfg) cfg.load_base_path(args[0]) if options.check_only: log.info(""" Exiting without processing (because of the -c/--check-only option ... """) else: try: if options.profile: profile_analysis(cfg, options) else: run_analysis(cfg, options) finally: # Make sure that we reset the configuration cfg.reset() # Successful exit end_time = datetime.datetime.now().replace(microsecond=0) processing_time = end_time - start_time log.info("Total processing time: %s (h:m:s)" % processing_time) log.info("Processing complete.") return 0 except util.ExternalProgramError as e: log.error("""A program that Partitionfinder uses failed. Output follows, in case it's helpful for finding the problem""") log.error("%s", e.stdout) if options.show_python_exceptions or passed_args is not None: raise except util.ParseError: log.error("""We failed to parse the output of an external program (See previous errors). This is probably due to an update to the program which has changed the output.""") if options.show_python_exceptions or passed_args is not None: raise except util.PartitionFinderError: log.error("Failed to run. See previous errors.") # Reraise if we were called by call_main, or if the options is set if options.show_python_exceptions or passed_args is not None: raise except (KeyboardInterrupt, SystemExit): log.error("User interrupted the Program") return 1