def handleInput (self, inputClass):
        if(inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED):
            data1 = inputClass.getData1()
            data2 = inputClass.getData2()
            if(data1 == self.TYPE_BUTTON):
                screen = CyGInterfaceScreen( "SpaceShipScreen", CvScreenEnums.SPACE_SHIP_SCREEN)
                xPosition = self.X_SCREEN + self.componentPanelXOffset
                yPosition = self.Y_SCREEN + self.componentPanelYOffset + data2 * self.componentPanelHeight
                index = self.componentProjects[data2]
                screen.spaceShipChangeType(index)
                activeTeam = gc.getGame().getActiveTeam()
                modelType = gc.getTeam(activeTeam).getProjectDefaultArtType(index)
                screen.addSpaceShipWidgetGFC("ComponentModel" + str(data2), xPosition + self.componentModelXOffset, yPosition + self.componentModelYOffset, self.componentModelWidth, self.componentModelHeight, index, modelType, WidgetTypes.WIDGET_GENERAL, -1, -1)
            elif(data1 == self.ZOOM_BUTTON):
                screen = CyGInterfaceScreen( "SpaceShipScreen", CvScreenEnums.SPACE_SHIP_SCREEN)
                screen.spaceShipZoom(self.componentProjects[data2])
            elif(data1 == self.ADD_BUTTON):
                screen = CyGInterfaceScreen( "SpaceShipScreen", CvScreenEnums.SPACE_SHIP_SCREEN)
                screen.spaceShipFinalize()

                #adjust interface
                screen.deleteWidget("ComponentAddButton")
                self.activeProject = -1
                self.rebuildComponentPanel()
            elif(data1 == self.LAUNCH_BUTTON):
                screen = CyGInterfaceScreen( "SpaceShipScreen", CvScreenEnums.SPACE_SHIP_SCREEN)
                screen.spaceShipLaunch()

                self.removeComponentsPanel()

        return 0
    def rebuildComponentPanel(self):
        screen = CyGInterfaceScreen( "SpaceShipScreen", CvScreenEnums.SPACE_SHIP_SCREEN)
        self.removeComponentsPanel()

        #check if already landed spaceship
        activeTeam = gc.getGame().getActiveTeam()
        victoryCountdown = gc.getTeam(activeTeam).getVictoryCountdown(self.spaceVictory)
        gameState = gc.getGame().getGameState()
        if(not (((gameState == GameStateTypes.GAMESTATE_EXTENDED) and (victoryCountdown > 0)) or (victoryCountdown == 0))):

            #loop through each panel
            for i in xrange(self.numComponents):
                index = self.componentProjects[i]
                component = gc.getProjectInfo(index)
                xPosition = self.X_SCREEN + self.componentPanelXOffset
                yPosition = self.Y_SCREEN + self.componentPanelYOffset + i * self.componentPanelHeight

                #panel
                xPositionOffset = 0
                if(index == self.activeProject):
                    xPositionOffset = 80
                screen.addPanel("ComponentPanel" + str(i), "", "", True, True, xPosition - xPositionOffset, yPosition, self.componentPanelWidth + xPositionOffset, self.componentPanelHeight + self.componentPanelHeightExtra, PanelStyles.PANEL_STYLE_TECH)
                screen.setLabel("ComponentLabel" + str(i), "ComponentPanel" + str(i), "<color=255,255,0><font=3b>" + component.getDescription() + "</font></color>", CvUtil.FONT_LEFT_JUSTIFY, xPosition - xPositionOffset + self.componentNameXOffset, yPosition + self.componentNameYOffset, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

                #completed
                completed = gc.getTeam(activeTeam).getProjectCount(index)
                totalAllowed = component.getMaxTeamInstances()
                screen.setLabel("ComponentCompletedLabel" + str(i), "ComponentPanel" + str(i), localText.getText("TXT_KEY_SPACE_SHIP_SCREEN_COMPLETED_LABEL", (completed, totalAllowed)), CvUtil.FONT_LEFT_JUSTIFY, xPosition + self.componentCompletedLabelXOffset, yPosition + self.componentCompletedLabelYOffset, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

                #required
                required = component.getVictoryMinThreshold(self.spaceVictory)
                screen.setLabel("ComponentRequiredLabel" + str(i), "ComponentPanel" + str(i), localText.getText("TXT_KEY_SPACE_SHIP_SCREEN_REQUIRED_LABEL", (required,)), CvUtil.FONT_LEFT_JUSTIFY, xPosition + self.componentRequiredLabelXOffset, yPosition + self.componentRequiredLabelYOffset, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

                #in production
                inProduction = gc.getTeam(activeTeam).getProjectMaking(index)
                screen.setLabel("ComponentInProductionLabel" + str(i), "ComponentPanel" + str(i), localText.getText("TXT_KEY_SPACE_SHIP_SCREEN_IN_PRODUCTION_LABEL", (inProduction,)), CvUtil.FONT_LEFT_JUSTIFY, xPosition + self.componentInProductionLabelXOffset, yPosition + self.componentInProductionLabelYOffset, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

                #panel color
                if(completed >= required): #green
                    screen.setPanelColor("ComponentPanel" + str(i), 85, 150, 87)
                else: #check if can build
                    canBuild = True
                    if(not gc.getTeam(activeTeam).isHasTech(component.getTechPrereq())):
                        canBuild = False
                    else:
                        for j in xrange(gc.getNumProjectInfos()):
                            if(gc.getTeam(activeTeam).getProjectCount(j) < component.getProjectsNeeded(j)):
                                canBuild = False

                    if(not canBuild): #grey
                        screen.setPanelColor("ComponentPanel" + str(i), 128, 128, 128)

                #type button if necessary
                if(screen.spaceShipCanChangeType(index) and (victoryCountdown < 0)):
                    screen.setButtonGFC("ComponentTypeButton" + str(i), localText.getText("TXT_KEY_SPACE_SHIP_SCREEN_TYPE_BUTTON", ()), "", xPosition + self.componentTypeXOffset, yPosition + self.componentTypeYOffset, self.componentTypeWidth, self.componentTypeHeight, WidgetTypes.WIDGET_GENERAL, self.TYPE_BUTTON, i, ButtonStyles.BUTTON_STYLE_STANDARD )

                #zoom button
                if(victoryCountdown < 0):
                    screen.setButtonGFC("ComponentZoomButton" + str(i), localText.getText("TXT_KEY_SPACE_SHIP_SCREEN_ZOOM_BUTTON", ()), "", xPosition + self.componentZoomXOffset, yPosition + self.componentZoomYOffset, self.componentZoomWidth, self.componentZoomHeight, WidgetTypes.WIDGET_GENERAL, self.ZOOM_BUTTON, i, ButtonStyles.BUTTON_STYLE_STANDARD )

                #add button
                if(index == self.activeProject):
                    screen.setButtonGFC("ComponentAddButton", localText.getText("TXT_KEY_SPACE_SHIP_SCREEN_ADD_BUTTON", ()), "", xPosition - xPositionOffset + self.componentAddXOffset, yPosition + self.componentAddYOffset, self.componentAddWidth, self.componentAddHeight, WidgetTypes.WIDGET_GENERAL, self.ADD_BUTTON, i, ButtonStyles.BUTTON_STYLE_STANDARD )

                #component model
                modelType = gc.getTeam(activeTeam).getProjectDefaultArtType(index)
                screen.addSpaceShipWidgetGFC("ComponentModel" + str(i), xPosition + self.componentModelXOffset, yPosition + self.componentModelYOffset, self.componentModelWidth, self.componentModelHeight, index, modelType, WidgetTypes.WIDGET_GENERAL, -1, -1)

            #launch button
            activeTeam = gc.getGame().getActiveTeam()
            if(victoryCountdown > 0):
                victoryDate = CyGameTextMgr().getTimeStr(gc.getGame().getGameTurn() + victoryCountdown, False)
                screen.setLabel("ArrivalLabel1", "SpaceShipMainPanel", "<color=255,255,0><font=3b>" + localText.getText("TXT_KEY_SPACE_SHIP_SCREEN_ARRIVAL", ()) + ": " + victoryDate + "</font></color>", CvUtil.FONT_LEFT_JUSTIFY, self.X_LAUNCH_LABEL1, self.Y_LAUNCH_LABEL1, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
                screen.setLabel("ArrivalLabel2", "SpaceShipMainPanel", "<color=255,255,0><font=3b>" + localText.getText("TXT_KEY_REPLAY_SCREEN_TURNS", ()) + ": " + str(victoryCountdown) + "</font></color>", CvUtil.FONT_LEFT_JUSTIFY, self.X_LAUNCH_LABEL2, self.Y_LAUNCH_LABEL2, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
            elif(gc.getTeam(gc.getGame().getActiveTeam()).canLaunch(self.spaceVictory)):
                delay = gc.getTeam(gc.getGame().getActiveTeam()).getVictoryDelay(self.spaceVictory)
                screen.setLabel("LaunchLabel1", "SpaceShipMainPanel", "<color=255,255,0><font=3b>" + localText.getText("TXT_KEY_SPACESHIP_CHANCE_OF_SUCCESS", (gc.getTeam(gc.getGame().getActiveTeam()).getLaunchSuccessRate(self.spaceVictory), )) + "</font></color>", CvUtil.FONT_LEFT_JUSTIFY, self.X_LAUNCH_LABEL1, self.Y_LAUNCH_LABEL1, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
                screen.setLabel("LaunchLabel2", "SpaceShipMainPanel", "<color=255,255,0><font=3b>" + localText.getText("TXT_KEY_SPACE_SHIP_SCREEN_TRAVEL_TIME_LABEL", (delay,)) + "</font></color>", CvUtil.FONT_LEFT_JUSTIFY, self.X_LAUNCH_LABEL2, self.Y_LAUNCH_LABEL2, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
                screen.setButtonGFC("LaunchButton", localText.getText("TXT_KEY_SPACE_SHIP_SCREEN_LAUNCH_BUTTON", ()), "", self.X_LAUNCH, self.Y_LAUNCH, self.W_LAUNCH, self.H_LAUNCH, WidgetTypes.WIDGET_GENERAL, self.LAUNCH_BUTTON, -1, ButtonStyles.BUTTON_STYLE_STANDARD )



        #exit button
        screen.setButtonGFC("ExitButton", localText.getText("TXT_KEY_PEDIA_SCREEN_EXIT", ()), "", self.X_EXIT, self.Y_EXIT, self.W_EXIT, self.H_EXIT, WidgetTypes.WIDGET_CLOSE_SCREEN, -1, -1, ButtonStyles.BUTTON_STYLE_STANDARD )