Example #1
0
def main(configFileName):

    ConfigurationFile.read(configFileName)

    gui = GUI()

    hideInput = True
    githubPassword = gui.getUserInput("Enter Github Password", hideInput)

    gui.drawMessage("Updating internal gubbins, please wait")
    Github.GithubWrapper.init(githubPassword)
    _updateRepository()

    branches = []

    releaseArchipelagoName = ConfigurationFile.releaseArchipelago
    branches = Git.getArchipelagoNamesRecentlyActiveInBranch(
        releaseArchipelagoName, ConfigurationFile.
        amountOfTimeInDaysBeforeBranchIsTooOldToBeConsideredRecent)

    # The archipelago(s) which are never merged into anything and we :. can't rely on when they have been merged into the release archipelago.
    #  Usually only the release archipelagos are merged into it except that there might be bug fixes so really any branch could go in from
    #  anywhere. It could be called anything and there could be multiple instances of it (though usually not).
    blackList = ConfigurationFile.blackList
    branches = _removeBlacklistedArchipelagosFromList(branches, blackList)

    archipelagoDataList = _setUpArchipelagoDataList(branches,
                                                    releaseArchipelagoName,
                                                    gui)

    gui.clearScreen()
    gui.drawMessage("Press F5 to refresh")

    # Git.RunAndStoreAllRepeatedCommands()

    keepRunning = True
    justStartedAndThereforeJustUpdatedRepository = True
    haveDrawnCirclesOnceAlready = False
    while keepRunning:
        gui.go()

        events = gui.getEvents()
        for event in events:
            if (event == GUI.WindowClosedEvent) or (event
                                                    == GUI.EscapeKeyEvent):
                keepRunning = False
                return

            if (event == gui.F5KeyEvent):
                gui.drawMessage("Updating internal gubbins, please wait")
                if not justStartedAndThereforeJustUpdatedRepository:
                    _updateRepository()
                justStartedAndThereforeJustUpdatedRepository = False
                needToDrawCirclesEveryTime = ConfigurationFile.automaticallyUpdateRepository
                if needToDrawCirclesEveryTime:
                    _drawIslands(releaseArchipelagoName, gui,
                                 archipelagoDataList)
                elif haveDrawnCirclesOnceAlready:
                    _redrawIslands(releaseArchipelagoName, gui,
                                   archipelagoDataList)
                else:
                    _drawIslands(releaseArchipelagoName, gui,
                                 archipelagoDataList)
                haveDrawnCirclesOnceAlready = True

            if (event == gui.F6KeyEvent):
                if haveDrawnCirclesOnceAlready:
                    _redrawIslands(releaseArchipelagoName, gui,
                                   archipelagoDataList)

            if (event == gui.MouseClickReleaseEvent):
                gui.displayNameOfIslandAtMouseLocation()

            if (event == gui.DeleteKeyEvent):
                gui.doNotRenderSelectedIsland()