def setup(self, all_sprites): all_sprites.add(LcarsBackgroundImage("assets/lcars_screen_2.png"), layer=0) all_sprites.add(LcarsText(colours.ORANGE, (270, -1), "AUTHORIZATION REQUIRED", 2), layer=1) all_sprites.add(LcarsText(colours.BLUE, (330, -1), "ONLY AUTHORIZED PERSONNEL MAY ACCESS THIS TERMINAL", 1.5), layer=1) all_sprites.add(LcarsText(colours.BLUE, (360, -1), "TOUCH TERMINAL TO PROCEED", 1.5), layer=1) all_sprites.add(LcarsText(colours.BLUE, (390, -1), "FAILED ATTEMPTS WILL BE REPORTED", 1.5), layer=1) all_sprites.add(LcarsGifImage("assets/gadgets/stlogorotating.gif", (103, 369), 50), layer=1) # sounds Sound("assets/audio/panel/215.wav").play() Sound("assets/audio/enter_authorization_code.wav").play() self.sound_granted = Sound("assets/audio/accessing.wav") self.sound_beep1 = Sound("assets/audio/panel/206.wav") self.sound_denied = Sound("assets/audio/access_denied.wav") self.sound_deny1 = Sound("assets/audio/deny_1.wav") self.sound_deny2 = Sound("assets/audio/deny_2.wav") self.attempts = 0 self.granted = False
def setup(self, all_sprites): all_sprites.add(LcarsBackgroundImage("assets/lcars_screen_1b.png"), layer=0) # panel text all_sprites.add(LcarsText(colours.BLACK, (11, 52), "LCARS 105"), layer=1) all_sprites.add(LcarsText(colours.ORANGE, (0, 135), "HOME AUTOMATION", 2), layer=1) all_sprites.add(LcarsText(colours.BLACK, (183, 74), "LIGHTS"), layer=1) all_sprites.add(LcarsText(colours.BLACK, (222, 57), "CAMERAS"), layer=1) all_sprites.add(LcarsText(colours.BLACK, (372, 70), "ENERGY"), layer=1) all_sprites.add(LcarsText(colours.BLACK, (444, 612), "192 168 0 3"), layer=1) # info text all_sprites.add(LcarsText(colours.WHITE, (192, 174), "EVENT LOG:", 1.5), layer=3) all_sprites.add(LcarsText(colours.BLUE, (244, 174), "2 ALARM ZONES TRIGGERED", 1.5), layer=3) all_sprites.add(LcarsText(colours.BLUE, (286, 174), "14.3 kWh USED YESTERDAY", 1.5), layer=3) all_sprites.add(LcarsText(colours.BLUE, (330, 174), "1.3 Tb DATA USED THIS MONTH", 1.5), layer=3) self.info_text = all_sprites.get_sprites_from_layer(3) # date display self.stardate = LcarsText(colours.BLUE, (12, 380), "STAR DATE 2711.05 17:54:32", 1.5) self.lastClockUpdate = 0 all_sprites.add(self.stardate, layer=1) # buttons all_sprites.add(LcarsButton(colours.RED_BROWN, (6, 662), "LOGOUT", self.logoutHandler), layer=4) all_sprites.add(LcarsButton(colours.BEIGE, (107, 127), "SENSORS", self.sensorsHandler), layer=4) all_sprites.add(LcarsButton(colours.PURPLE, (107, 262), "GAUGES", self.gaugesHandler), layer=4) all_sprites.add(LcarsButton(colours.PEACH, (107, 398), "WEATHER", self.weatherHandler), layer=4) # gadgets all_sprites.add(LcarsGifImage("assets/gadgets/fwscan.gif", (277, 556), 100), layer=1) self.sensor_gadget = LcarsGifImage("assets/gadgets/lcars_anim2.gif", (235, 150), 100) self.sensor_gadget.visible = False all_sprites.add(self.sensor_gadget, layer=2) self.dashboard = LcarsImage("assets/gadgets/dashboard.png", (187, 232)) self.dashboard.visible = False all_sprites.add(self.dashboard, layer=2) self.weather = LcarsImage("assets/weather.jpg", (188, 122)) self.weather.visible = False all_sprites.add(self.weather, layer=2) #all_sprites.add(LcarsMoveToMouse(colours.WHITE), layer=1) self.beep1 = Sound("assets/audio/panel/201.wav") Sound("assets/audio/panel/220.wav").play()
class ScreenMain(LcarsScreen): def setup(self, all_sprites): all_sprites.add(LcarsBackgroundImage("assets/lcars_screen_1b.png"), layer=0) # panel text all_sprites.add(LcarsText(colours.BLACK, (11, 52), "LCARS 105"), layer=1) all_sprites.add(LcarsText(colours.ORANGE, (0, 135), "HOME AUTOMATION", 2), layer=1) all_sprites.add(LcarsText(colours.BLACK, (183, 74), "LIGHTS"), layer=1) all_sprites.add(LcarsText(colours.BLACK, (222, 57), "CAMERAS"), layer=1) all_sprites.add(LcarsText(colours.BLACK, (372, 70), "ENERGY"), layer=1) all_sprites.add(LcarsText(colours.BLACK, (444, 612), "192 168 0 3"), layer=1) # info text all_sprites.add(LcarsText(colours.WHITE, (192, 174), "EVENT LOG:", 1.5), layer=3) all_sprites.add(LcarsText(colours.BLUE, (244, 174), "2 ALARM ZONES TRIGGERED", 1.5), layer=3) all_sprites.add(LcarsText(colours.BLUE, (286, 174), "14.3 kWh USED YESTERDAY", 1.5), layer=3) all_sprites.add(LcarsText(colours.BLUE, (330, 174), "1.3 Tb DATA USED THIS MONTH", 1.5), layer=3) self.info_text = all_sprites.get_sprites_from_layer(3) # date display self.stardate = LcarsText(colours.BLUE, (12, 380), "STAR DATE 2711.05 17:54:32", 1.5) self.lastClockUpdate = 0 all_sprites.add(self.stardate, layer=1) # buttons all_sprites.add(LcarsButton(colours.RED_BROWN, (6, 662), "LOGOUT", self.logoutHandler), layer=4) all_sprites.add(LcarsButton(colours.BEIGE, (107, 127), "SENSORS", self.sensorsHandler), layer=4) all_sprites.add(LcarsButton(colours.PURPLE, (107, 262), "GAUGES", self.gaugesHandler), layer=4) all_sprites.add(LcarsButton(colours.PEACH, (107, 398), "WEATHER", self.weatherHandler), layer=4) # gadgets all_sprites.add(LcarsGifImage("assets/gadgets/fwscan.gif", (277, 556), 100), layer=1) self.sensor_gadget = LcarsGifImage("assets/gadgets/lcars_anim2.gif", (235, 150), 100) self.sensor_gadget.visible = False all_sprites.add(self.sensor_gadget, layer=2) self.dashboard = LcarsImage("assets/gadgets/dashboard.png", (187, 232)) self.dashboard.visible = False all_sprites.add(self.dashboard, layer=2) self.weather = LcarsImage("assets/weather.jpg", (188, 122)) self.weather.visible = False all_sprites.add(self.weather, layer=2) #all_sprites.add(LcarsMoveToMouse(colours.WHITE), layer=1) self.beep1 = Sound("assets/audio/panel/201.wav") Sound("assets/audio/panel/220.wav").play() def update(self, fpsClock): if pygame.time.get_ticks() - self.lastClockUpdate > 1000: self.stardate.setText("STAR DATE {}".format(datetime.now().strftime("%d%m.%y %H:%M:%S"))) self.lastClockUpdate = pygame.time.get_ticks() LcarsScreen.update(self, fpsClock) def handleEvents(self, event, fpsClock): LcarsScreen.handleEvents(self, event, fpsClock) if event.type == pygame.MOUSEBUTTONDOWN: self.beep1.play() if event.type == pygame.MOUSEBUTTONUP: return False def hideInfoText(self): if self.info_text[0].visible: for sprite in self.info_text: sprite.visible = False def gaugesHandler(self, item, event, clock): self.hideInfoText() self.sensor_gadget.visible = False self.dashboard.visible = True self.weather.visible = False def sensorsHandler(self, item, event, clock): self.hideInfoText() self.sensor_gadget.visible = True self.dashboard.visible = False self.weather.visible = False def weatherHandler(self, item, event, clock): self.hideInfoText() self.sensor_gadget.visible = False self.dashboard.visible = False self.weather.visible = True def logoutHandler(self, item, event, clock): from screens.authorize import ScreenAuthorize self.loadScreen(ScreenAuthorize())