Beispiel #1
0
def check(mod, mapname = None, version = None, modVersions = None, sim_mods = None, silent=False):
    '''
    This checks whether the game is properly updated and has the correct map.
    '''
    logger.info("Checking FA for: " + str(mod) + " and map " + str(mapname))
    
    if not mod:
        QtGui.QMessageBox.warning(None, "No Mod Specified", "The application didn't specify which mod to update.")
        return False
        
    if not fa.gamepath:
        savePath(fa.updater.autoDetectPath())
               
    while (not fa.updater.validatePath(fa.gamepath)):
        logger.warn("Invalid path: " + str(fa.gamepath))
        wizard = fa.updater.Wizard(None)
        result = wizard.exec_()
        if not result:  # The wizard only returns successfully if the path is okay.
            return False
    
    # Perform the actual comparisons and updating                    
    logger.info("Updating FA for mod: " + str(mod) + ", version " + str(version))

    # Spawn an update for the required mod
    updater = fa.updater.Updater(mod, version, modVersions, silent=silent)
            
    result = updater.run()

    updater = None #Our work here is done

    if (result != fa.updater.Updater.RESULT_SUCCESS):
        return False 

    logger.info("Writing fa_path.lua config file.")
    try:
        writeFAPathLua()
    except:
        logger.error("fa_path.lua can't be written: ", exc_info=sys.exc_info())
        QtGui.QMessageBox.critical(None, "Cannot write fa_path.lua", "This is a  rare error and you should report it!<br/>(open Menu BETA, choose 'Report a Bug')")             
        return False
        

    # Now it's down to having the right map
    if mapname:
        if not checkMap(mapname, silent=silent):
            return False

    if sim_mods:
        return checkMods(sim_mods)
        
    return True #FA is checked and ready
Beispiel #2
0
 def accept(self):
     fa.savePath(self.upgrade.comboBox.currentText())        
     QtGui.QWizard.accept(self)