def setup(self, all_sprites): all_sprites.add(LcarsBackgroundImage("assets/lcars_splash.png"), layer=0) all_sprites.add(LcarsText(colours.ORANGE, (270, -1), "AUTHORIZATION REQUIRED", 2), layer=1) all_sprites.add(LcarsGifImage("assets/animated/st_logo.gif", (103, 369), 50), layer=1) all_sprites.add(LcarsButton(colours.GREY_BLUE, "btn", (320, 130), "1", self.num_1), layer=2) all_sprites.add(LcarsButton(colours.GREY_BLUE, "btn", (370, 130), "2", self.num_2), layer=2) all_sprites.add(LcarsButton(colours.GREY_BLUE, "btn", (320, 270), "3", self.num_3), layer=2) all_sprites.add(LcarsButton(colours.GREY_BLUE, "btn", (370, 270), "4", self.num_4), layer=2) all_sprites.add(LcarsButton(colours.GREY_BLUE, "btn", (320, 410), "5", self.num_5), layer=2) all_sprites.add(LcarsButton(colours.GREY_BLUE, "btn", (370, 410), "6", self.num_6), layer=2) all_sprites.add(LcarsButton(colours.GREY_BLUE, "btn", (320, 550), "7", self.num_7), layer=2) all_sprites.add(LcarsButton(colours.GREY_BLUE, "btn", (370, 550), "8", self.num_8), layer=2) # 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_deny2 = Sound("assets/audio/deny_2.wav") ############ # SET PIN CODE WITH THIS VARIABLE ############ self.pin = 1234 ############ # Variables for PIN code verification self.correct = 0 self.pin_i = 0 self.granted = False
def setup(self, all_sprites): all_sprites.add(LcarsBackgroundImage("assets/lcars_splash.png"), layer=0) all_sprites.add(LcarsText(colours.ORANGE, (270, -1), "LCARS SYSTEM MONITOR", 1.8), 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 SCREEN TO PROCEED", 1.5), layer=1) all_sprites.add(LcarsGifImage("assets/animated/st_logo.gif", (103, 369), 50), layer=1) # sounds Sound("assets/audio/panel/215.wav").play() 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.granted = False
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 loadfile(self, all_sprites, target, layer): # Load data from file returnpayload = read_txt("/opt/local/var/lib/lcars/" + target) # Router heading all_sprites.add(LcarsText(colours.ORANGE, (140, 175), returnpayload[0].split(',')[0], 2), layer = layer) all_sprites.add(LcarsText(colours.ORANGE, (140, 400), returnpayload[0].split(',')[1].lstrip(), 2), layer = layer) # Loop through results index = 1 ypos = 200 while index < len(returnpayload): all_sprites.add(LcarsText(colours.BLUE, (ypos, 175), returnpayload[index].split(',')[0], 2), layer = layer) # Change color based on status if returnpayload[index].lstrip().split(',')[1].lstrip() == "ONLINE": all_sprites.add(LcarsText(colours.GREEN, (ypos, 400), "ONLINE", 2), layer = layer) else: all_sprites.add(LcarsText(colours.RED, (ypos, 400), "OFFLINE", 2), layer = layer) # Bump index and vertical pos index += 1 ypos += 50 # Add a little flair all_sprites.add(LcarsGifImage("assets/animated/fwscan.gif", (320, 556), 100), layer = layer) # Save layer, this is a hack if target == "routers": self.routers = all_sprites.get_sprites_from_layer(layer) elif target == "sensors": self.sensors = all_sprites.get_sprites_from_layer(layer) elif target == "sites": self.sites = all_sprites.get_sprites_from_layer(layer) elif target == "printers": self.printers = all_sprites.get_sprites_from_layer(layer)
def setup(self, all_sprites): # Load standard LCARS BG image all_sprites.add(LcarsBackgroundImage("assets/lcars_bg.png"), layer=0) # Setup time/date display self.stardate = LcarsText(colours.BLUE, (12, 380), "", 1.5) self.lastClockUpdate = 0 all_sprites.add(self.stardate, layer=1) # Static text all_sprites.add(LcarsText(colours.BLACK, (8, 40), "LCARS 1123"), layer=1) all_sprites.add(LcarsText(colours.ORANGE, (0, 135), "MAIN MENU", 2), layer=1) # Buttons all_sprites.add(LcarsButton(colours.RED_BROWN, "btn", (6, 660), "LOGOUT", self.load_idle), layer=4) all_sprites.add(LcarsButton(randomcolor(), "nav", (145, 15), "ENVIRO", self.load_enviro), layer=4) all_sprites.add(LcarsButton(randomcolor(), "nav", (200, 15), "NETWORK", self.load_network), layer=4) all_sprites.add(LcarsButton(randomcolor(), "nav", (255, 15), "POWER", self.load_power), layer=4) all_sprites.add(LcarsButton(randomcolor(), "nav", (310, 15), "OPERATIONS", self.load_auth), layer=4) all_sprites.add(LcarsButton(randomcolor(), "nav", (365, 15), "", self.load_template), layer=4) # Load data from file #returnpayload = read_txt("/opt/local/var/lib/lcars/alert") # First line in file is always going to be heading #all_sprites.add(LcarsText(colours.ORANGE, (137, 133), returnpayload[0], 1.8), layer=3) # Loop through results starting at second element #index = 1 #ypos = 190 #while index < len(returnpayload): # all_sprites.add(LcarsText(colours.BLUE, (ypos, 150), returnpayload[index], 1.5), layer=3) # Bump index and vertical pos # index += 1 # ypos += 50 # Rotating Deep Space 9 #yieldall_sprites.add(LcarsGifImage("assets/animated/ds9_3d.gif", (148, 475), 100), layer=1) weather = get_weather() #"%s\nTemperature: %s\nPrecipitations %s" % (current.summary, current.temperature, current.precipProbability) all_sprites.add(LcarsText(colours.BLUE, (150, 300), weather.summary , 1.5), layer=3) all_sprites.add(LcarsText(colours.BLUE, (200, 300), "Temperature: %s C / Feels like: %s" % (weather.temperature, weather.apparentTemperature) , 1.5), layer=3) all_sprites.add(LcarsText(colours.BLUE, (250, 300), "Wind: %s KPH %s" % (weather.windSpeed, degrees_to_cardinal(weather.windBearing)) , 1.5), layer=3) all_sprites.add(LcarsText(colours.BLUE, (300, 300), "Precipitations: %s" % (weather.precipProbability) , 1.5), layer=3) #all_sprites.add(LcarsText(colours.BLUE, (350, 300), "Type: %s / Qty: %s cm" % (weather.precipType, weather.precipAccumulation) , 1.5), layer=3) #all_sprites.add(LcarsText(colours.BLUE, (350, 300), "Sunset: %s / Sunrise: %s cm" % (weather.precipType, weather.precipAccumulation) , 1.5), layer=3) all_sprites.add(LcarsGifImage("assets/weather/%s.gif" % (weather.icon), (100, 144), 50), layer=1) self.beep1 = Sound("assets/audio/panel/201.wav") Sound("assets/audio/panel/220.wav").play()
def setup(self, all_sprites): #if config.DEV_MODE: # all_sprites.add(LcarsButton(colours.GREY_BLUE, (0, 770), "X", self.exitHandler, (30, 30)), layer=2) all_sprites.add(LcarsBackgroundImage("assets/lcars_screen_screensaver.png"), layer=0) print('screensaver gif:') all_sprites.add(LcarsGifImage("assets/stars_at_warp_speed.gif", (0, 0), stretch=True), layer=0) # add screen blanking here # for example turn off RPi display backlight pass
def setup(self, all_sprites): all_sprites.add(LcarsBackgroundImage("assets/lcars_screen_2.png"), layer=0) all_sprites.add(LcarsGifImage("assets/gadgets/stlogorotating.gif", (103, 369), 50), layer=0) all_sprites.add(LcarsText(colours.ORANGE, (270, -1), "AUTHORIZATION REQUIRED", 2), layer=0) 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(LcarsButton(colours.GREY_BLUE, (320, 130), "1", self.num_1), layer=2) all_sprites.add(LcarsButton(colours.GREY_BLUE, (370, 130), "2", self.num_2), layer=2) all_sprites.add(LcarsButton(colours.GREY_BLUE, (320, 270), "3", self.num_3), layer=2) all_sprites.add(LcarsButton(colours.GREY_BLUE, (370, 270), "4", self.num_4), layer=2) all_sprites.add(LcarsButton(colours.GREY_BLUE, (320, 410), "5", self.num_5), layer=2) all_sprites.add(LcarsButton(colours.GREY_BLUE, (370, 410), "6", self.num_6), layer=2) all_sprites.add(LcarsButton(colours.GREY_BLUE, (320, 550), "7", self.num_7), layer=2) all_sprites.add(LcarsButton(colours.GREY_BLUE, (370, 550), "8", self.num_8), layer=2) self.layer1 = all_sprites.get_sprites_from_layer(1) self.layer2 = all_sprites.get_sprites_from_layer(2) # sounds Sound("assets/audio/panel/215.wav").play() self.sound_granted = Sound("assets/audio/accessing.wav") self.sound_beep1 = Sound("assets/audio/panel/201.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") ############ # SET PIN CODE WITH THIS VARIABLE ############ self.pin = 7212 ############ self.reset()
def setup(self, all_sprites): # Load BG image all_sprites.add(LcarsBackgroundImage("assets/lcars_bg.png"), layer=0) # Time/Date display self.stardate = LcarsText(colours.BLUE, (12, 380), "", 1.5) self.lastClockUpdate = 0 all_sprites.add(self.stardate, layer=1) # Static text all_sprites.add(LcarsText(colours.BLACK, (8, 40), "LCARS 1123"), layer=1) all_sprites.add(LcarsText(colours.ORANGE, (0, 135), "ENVIRONMENT", 2), layer=1) # Interfaces all_sprites.add(LcarsButton(colours.RED_BROWN, "btn", (6, 660), "MAIN", self.logoutHandler), layer=2) all_sprites.add(LcarsButton(randomcolor(), "nav", (145, 15), "CURRENT", self.nullfunction), layer=2) all_sprites.add(LcarsButton(randomcolor(), "nav", (200, 15), "TODAY", self.nullfunction), layer=2) all_sprites.add(LcarsButton(randomcolor(), "nav", (255, 15), "TOMORROW", self.nullfunction), layer=2) all_sprites.add(LcarsButton(randomcolor(), "nav", (310, 15), "WEEK", self.nullfunction), layer=2) all_sprites.add(LcarsButton(randomcolor(), "nav", (365, 15), "", self.nullfunction), layer=2) # Info text weather = get_weather() #"%s\nTemperature: %s\nPrecipitations %s" % (current.summary, current.temperature, current.precipProbability) all_sprites.add(LcarsText(colours.BLUE, (150, 300), weather.summary, 1.5), layer=3) all_sprites.add(LcarsText( colours.BLUE, (200, 300), "Temperature: %s C / Feels like: %s" % (weather.temperature, weather.apparentTemperature), 1.5), layer=3) all_sprites.add(LcarsText( colours.BLUE, (250, 300), "Wind: %s KPH %s" % (weather.windSpeed, degrees_to_cardinal(weather.windBearing)), 1.5), layer=3) all_sprites.add(LcarsText( colours.BLUE, (300, 300), "Precipitations: %s" % (weather.precipProbability), 1.5), layer=3) #all_sprites.add(LcarsText(colours.BLUE, (350, 300), "Type: %s / Qty: %s cm" % (weather.precipType, weather.precipAccumulation) , 1.5), layer=3) #all_sprites.add(LcarsText(colours.BLUE, (350, 300), "Sunset: %s / Sunrise: %s cm" % (weather.precipType, weather.precipAccumulation) , 1.5), layer=3) all_sprites.add(LcarsGifImage("assets/weather/%s.gif" % (weather.icon), (100, 144), 50), layer=1) self.info_text = all_sprites.get_sprites_from_layer(3) # SFX self.beep1 = Sound("assets/audio/panel/201.wav") Sound("assets/audio/hail_2.wav").play()
def setup(self, all_sprites): UserInterface.lastEventTime = datetime.now().timestamp( ) + config.SCREENSAVER_TIMEOUT_SECONDS if UserInterface.Authorised == False: self.callScreen(ScreenAuthorize()) all_sprites.add(LcarsBackgroundImage("assets/lcars_screen_1b.png"), layer=0) # panel text all_sprites.add(LcarsText(colours.BLACK, (15, 44), "LCARS 105"), layer=1) all_sprites.add(LcarsText(colours.ORANGE, (0, 135), "HOME AUTOMATION", 2), layer=1) all_sprites.add(LcarsBlockMedium(colours.RED_BROWN, (145, 16), "LIGHTS"), layer=1) all_sprites.add(LcarsBlockSmall(colours.ORANGE, (211, 16), "CAMERAS"), layer=1) all_sprites.add(LcarsBlockLarge(colours.BEIGE, (249, 16), "ENERGY"), layer=1) self.ip_address = LcarsText(colours.BLACK, (444, 520), get_ip_address_string()) all_sprites.add(self.ip_address, 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 2311.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) all_sprites.add(LcarsButton(colours.PEACH, (108, 536), "HOME", self.homeHandler), 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() # Background warp core sound Sound("assets/audio/voy_core_1.wav").play(-1)
def setup(self, all_sprites): all_sprites.add(LcarsBackgroundImage("assets/lcars_screen_1b.png"), layer=0) # panel text all_sprites.add(LcarsText(colours.BLACK, (34, 90), "LCARS 702"), layer=1) all_sprites.add(LcarsText(colours.ORANGE, (0, 304), "HOME AUTOMATION", 1.5), layer=1) all_sprites.add(LcarsBlockMedium(colours.RED_BROWN, (327, 39), "LIGHTS"), layer=1) all_sprites.add(LcarsBlockSmall(colours.ORANGE, (475, 39), "CAMERAS"), layer=1) all_sprites.add(LcarsBlockLarge(colours.BEIGE, (561, 39), "ENERGY"), layer=1) self.ip_address = LcarsText(colours.BLACK, (999, 1248), get_ip_address_string()) all_sprites.add(self.ip_address, layer=1) # info text all_sprites.add(LcarsText(colours.WHITE, (432, 418), "EVENT LOG:", 1.25), layer=3) all_sprites.add(LcarsText(colours.BLUE, (549, 418), "2 ALARM ZONES TRIGGERED", 1.25), layer=3) all_sprites.add(LcarsText(colours.BLUE, (644, 418), "14.3 kWh USED YESTERDAY", 1.25), layer=3) all_sprites.add(LcarsText(colours.BLUE, (743, 418), "1.3 Tb DATA USED THIS MONTH", 1.25), layer=3) self.info_text = all_sprites.get_sprites_from_layer(3) # date display self.stardate = LcarsText(colours.BLUE, (27, 912), "STAR DATE 2311.05 17:54:32", 1.25) self.lastClockUpdate = 0 all_sprites.add(self.stardate, layer=1) # buttons all_sprites.add(LcarsButton(colours.RED_BROWN, (14, 1589), "LOGOUT", self.logoutHandler), layer=4) all_sprites.add(LcarsButton(colours.BEIGE, (241, 305), "SENSORS", self.sensorsHandler), layer=4) all_sprites.add(LcarsButton(colours.PURPLE, (241, 629), "GAUGES", self.gaugesHandler), layer=4) all_sprites.add(LcarsButton(colours.PEACH, (241, 956), "WEATHER", self.weatherHandler), layer=4) all_sprites.add(LcarsButton(colours.PEACH, (241, 1287), "HOME", self.homeHandler), layer=4) # gadgets all_sprites.add(LcarsGifImage("assets/gadgets/fwscan.gif", (624, 1335), 100), layer=1) self.sensor_gadget = LcarsGifImage("assets/gadgets/lcars_anim3.gif", (529, 360), 100) self.sensor_gadget.visible = False all_sprites.add(self.sensor_gadget, layer=2) self.dashboard = LcarsImage("assets/gadgets/dashboard.png", (421, 557)) self.dashboard.visible = False all_sprites.add(self.dashboard, layer=2) self.weather = LcarsImage("assets/weather.jpg", (423, 293)) 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 setup(self, all_sprites): all_sprites.add(LcarsBackgroundImage("assets/lcars_screen_1b.png"), layer=0) # Image reference WINTERPARKSNOW = cStringIO.StringIO(urllib.urlopen("http://cams.winterparkresort.com/winter-park-basecam.jpg").read()) WINTERPARKSNOW2 = Image.open(WINTERPARKSNOW) WINTERPARK2 = WINTERPARKSNOW2.resize((380,232), Image.ANTIALIAS) WINTERPARK2.save("WINTERPARKSNOW.jpg") KEYSTONESNOW = cStringIO.StringIO(urllib.urlopen("http://common.snow.com/mtncams/riverrun.jpg").read()) KEYSTONESNOW2 = Image.open(KEYSTONESNOW) KEYSTONE2 = KEYSTONESNOW2.resize((380,232), Image.ANTIALIAS) KEYSTONE2.save("KEYSTONESNOW.jpg") BRECKENRIDGESNOW = cStringIO.StringIO(urllib.urlopen("http://common.snow.com/Mtncams/brecksnowcam.jpg").read()) BRECKENRIDGESNOW2 = Image.open(BRECKENRIDGESNOW) BRECKENRIDGE2 = BRECKENRIDGESNOW2.resize((380,232), Image.ANTIALIAS) BRECKENRIDGE2.save("BRECKENRIDGESNOW.jpg") # panel text all_sprites.add(LcarsText(colours.BLACK, (15, 44), "COLORADO"), layer=1) all_sprites.add(LcarsText(colours.ORANGE, (0, 135), "SNOW REPORT", 2), layer=1) all_sprites.add(LcarsBlockMedium(colours.RED_BROWN, (145, 16), "WEATHER"), layer=1) all_sprites.add(LcarsBlockSmall(colours.ORANGE, (211, 16), "CAMERAS"), layer=1) all_sprites.add(LcarsBlockLarge(colours.BEIGE, (249, 16), "ENERGY"), layer=1) all_sprites.add(LcarsText(colours.BLACK, (444, 612), "172 18 0 99"), layer=1) # info text all_sprites.add(LcarsText(colours.WHITE, (192, 174), "RESORT OPENING DAY:", 1.5), layer=3) all_sprites.add(LcarsText(colours.BLUE, (244, 174), "WINTER PARK: NOVEMBER 15, 2017", 1.5), layer=3) all_sprites.add(LcarsText(colours.BLUE, (286, 174), "ARAPAHOE BASEN: MID OCTOBER", 1.5), layer=3) all_sprites.add(LcarsText(colours.BLUE, (330, 174), "KEYSTONE: NOVEMBER 10, 2017", 1.5), layer=3) all_sprites.add(LcarsText(colours.BLUE, (370, 174), "BRECKENRIDGE: NOVEMBER 10, 2017", 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), "DASHBOARD", self.sensorsHandler), # layer=4) all_sprites.add(LcarsButton(colours.PURPLE, (107, 262), "BRECKENRIDGE", self.sensorsHandler), layer=4) all_sprites.add(LcarsButton(colours.BEIGE, (107, 127), "KEYSTONE", self.gaugesHandler), layer=4) #all_sprites.add(LcarsButton(colours.PEACH, (107, 398), "WINTER PARK", self.weatherHandler), # layer=4) all_sprites.add(LcarsButton(colours.PEACH, (107, 398), "WINTER PARK", self.weatherHandler), layer=4) # gadgets all_sprites.add(LcarsGifImage("assets/gadgets/fwscan.gif", (277, 556), 100), layer=1) self.sensor_gadget = LcarsImage ("BRECKENRIDGESNOW.jpg", (200, 130)) self.sensor_gadget.visible = False all_sprites.add(self.sensor_gadget, layer=2) self.dashboard = LcarsImage("KEYSTONESNOW.jpg", (200, 130)) self.dashboard.visible = False all_sprites.add(self.dashboard, layer=2) self.weather = LcarsImage("WINTERPARKSNOW.jpg", (200, 130)) self.weather.visible = False all_sprites.add(self.weather, layer=2) self.gauges = LcarsImage("KEYSTONESNOW.jpg", (200, 130)) self.gauges.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 setup(self, all_sprites): all_sprites.add(LcarsBackgroundImage("assets/lcars_screen_1.png"), layer=0) # panel text all_sprites.add(LcarsText(colours.BLACK, (15, 44), "DYN"), layer=1) all_sprites.add(LcarsText(colours.ORANGE, (0, 135), "ELECTRIC SLIDE", 2), layer=1) all_sprites.add(LcarsBlockMedium(colours.RED_BROWN, (145, 16), "TOP 10"), layer=1) all_sprites.add(LcarsBlockSmall(colours.ORANGE, (211, 16), "PICTURE"), layer=1) all_sprites.add(LcarsBlockLarge(colours.BEIGE, (249, 16), "ENERGY"), layer=1) # Get ip address of machine ip = [ l for l in ( [ ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if not ip.startswith("127.") ][:1], [[(s.connect(('8.8.8.8', 53)), s.getsockname()[0], s.close()) for s in [socket.socket(socket.AF_INET, socket.SOCK_DGRAM)] ][0][1]]) if l ][0][0] all_sprites.add(LcarsText(colours.BLACK, (444, 612), ip), layer=1) # info text all_sprites.add(LcarsText(colours.WHITE, (192, 174), "TOP 10", 1.5), layer=3) all_sprites.add(LcarsText(colours.BLUE, (222, 174), "one", 1.5), layer=3) all_sprites.add(LcarsText(colours.BLUE, (252, 174), "two", 1.5), layer=3) all_sprites.add(LcarsText(colours.BLUE, (282, 174), "three", 1.5), layer=3) all_sprites.add(LcarsText(colours.BLUE, (312, 174), "four", 1.5), layer=3) all_sprites.add(LcarsText(colours.BLUE, (342, 174), "five", 1.5), layer=3) self.info_text = all_sprites.get_sprites_from_layer(3) # date display (get's set to date in update()) 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), "TOP 10", self.sensorsHandler), layer=4) all_sprites.add(LcarsButton(colours.PURPLE, (107, 262), "LAST", 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)
def setup(self, all_sprites): # Load standard LCARS BG image all_sprites.add(LcarsBackgroundImage("assets/lcars_bg.png"), layer=0) # Setup time/date display self.stardate = LcarsText(colours.BLUE, (12, 380), "", 1.5) self.lastClockUpdate = 0 all_sprites.add(self.stardate, layer=1) # Static text all_sprites.add(LcarsText(colours.BLACK, (8, 40), "LCARS 1123"), layer=1) all_sprites.add(LcarsText(colours.ORANGE, (0, 135), "MAIN MENU", 2), layer=1) # Buttons all_sprites.add(LcarsButton(colours.RED_BROWN, "btn", (6, 660), "LOGOUT", self.load_idle), layer=4) all_sprites.add(LcarsButton(randomcolor(), "nav", (145, 15), "ENVIRO", self.load_enviro), layer=4) all_sprites.add(LcarsButton(randomcolor(), "nav", (200, 15), "NETWORK", self.load_network), layer=4) all_sprites.add(LcarsButton(randomcolor(), "nav", (255, 15), "POWER", self.load_power), layer=4) all_sprites.add(LcarsButton(randomcolor(), "nav", (310, 15), "OPERATIONS", self.load_auth), layer=4) all_sprites.add(LcarsButton(randomcolor(), "nav", (365, 15), "", self.load_template), layer=4) # Load data from file returnpayload = read_txt("/var/lib/lcars/alert") # First line in file is always going to be heading all_sprites.add(LcarsText(colours.ORANGE, (137, 133), returnpayload[0], 1.8), layer=3) # Loop through results starting at second element index = 1 ypos = 190 while index < len(returnpayload): all_sprites.add(LcarsText(colours.BLUE, (ypos, 150), returnpayload[index], 1.5), layer=3) # Bump index and vertical pos index += 1 ypos += 50 # Rotating Deep Space 9 all_sprites.add(LcarsGifImage("assets/animated/ds9_3d.gif", (148, 475), 100), layer=1) self.beep1 = Sound("assets/audio/panel/201.wav") Sound("assets/audio/panel/220.wav").play()
def setup(self, all_sprites): all_sprites.add(LcarsBackgroundImage("assets/lcars_screen_3.png"), layer=0) all_sprites.add(LcarsGifImage("assets/gadgets/stlogorotating2.gif", (232, 895), 50), layer=0) all_sprites.add(LcarsText(colours.ORANGE, (608, -1), "AUTHORIZATION REQUIRED", 2), layer=0) all_sprites.add(LcarsText( colours.BLUE, (743, -1), "ONLY AUTHORIZED PERSONNEL MAY ACCESS THIS TERMINAL", 1.5), layer=1) all_sprites.add(LcarsText(colours.BLUE, (810, -1), "TOUCH TERMINAL TO PROCEED", 1.5), layer=1) #all_sprites.add(LcarsText(colours.BLUE, (878, -1), "FAILED ATTEMPTS WILL BE REPORTED", 1.5), layer=1) all_sprites.add(LcarsButton(colours.GREY_BLUE, (740, 312), "1", self.num_1), layer=2) all_sprites.add(LcarsButton(colours.GREY_BLUE, (843, 312), "2", self.num_2), layer=2) all_sprites.add(LcarsButton(colours.GREY_BLUE, (740, 648), "3", self.num_3), layer=2) all_sprites.add(LcarsButton(colours.GREY_BLUE, (843, 648), "4", self.num_4), layer=2) all_sprites.add(LcarsButton(colours.GREY_BLUE, (740, 984), "5", self.num_5), layer=2) all_sprites.add(LcarsButton(colours.GREY_BLUE, (843, 984), "6", self.num_6), layer=2) all_sprites.add(LcarsButton(colours.GREY_BLUE, (740, 1320), "7", self.num_7), layer=2) all_sprites.add(LcarsButton(colours.GREY_BLUE, (843, 1320), "8", self.num_8), layer=2) if config.DEV_MODE: all_sprites.add(LcarsButton(colours.GREY_BLUE, (0, 1848), "X", self.exitHandler, (68, 72)), layer=2) self.layer1 = all_sprites.get_sprites_from_layer(1) self.layer2 = all_sprites.get_sprites_from_layer(2) # sounds Sound("assets/audio/panel/215.wav").play() self.sound_granted = Sound("assets/audio/accessing.wav") self.sound_beep1 = Sound("assets/audio/panel/201.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") ############ # SET PIN CODE WITH THIS VARIABLE ############ self.pin = 1234 ############ self.reset()
def setup(self, all_sprites): all_sprites.add(LcarsBackgroundImage("assets/lcars_screen_1.png"), layer=0) # panel text all_sprites.add(LcarsText(colours.BLACK, (15, 44), "LCARS 105"), layer=1) all_sprites.add(LcarsText(colours.ORANGE, (0, 135), "DynSlide Top 10", 2), layer=1) all_sprites.add(LcarsBlockMedium(colours.RED_BROWN, (145, 16), "TOP 10", self.logoutHandler), layer=1) all_sprites.add(LcarsBlockSmall(colours.ORANGE, (211, 16), "STATS"), layer=1) all_sprites.add(LcarsBlockLarge(colours.BEIGE, (249, 16), "LAST SLIDE"), layer=1) all_sprites.add(LcarsText(colours.BLACK, (444, 612), "192 168 0 3"), layer=1) # Leader Board rows = get_leaderboard() i = 0 for row in rows: y = 107 + int(i / 5) * 180 x = 130 + i % 5 * 130 text = "#" + str(i + 1) + " - " + str(row[2] * 3) all_sprites.add(LcarsText(colours.WHITE, (y + 90, x), text, 1.5)) # self.dashboard = LcarsImage("65573701.jpg", (y, x)) img = LcarsImage(str(row[0]) + ".jpg", (y, x)) #print img.image #.__dict__ # img.image.transform.scale(picture, (1280, 720)) # img_scaled = pygame.transform.scale(img.image, (10,10)) img.image = pygame.transform.scale(img.image, (120, 90)) all_sprites.add(img, layer=2) i += 1 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) 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 setup(self, all_sprites): all_sprites.add(LcarsBackgroundImage("assets/lcars_screen_1b.png"), layer=0) # panel text all_sprites.add(LcarsText(colours.BLACK, (15, 44), "LCARS 105"), layer=1) all_sprites.add(LcarsText(colours.ORANGE, (0, 135), "HOME AUTOMATION", 2), layer=1) all_sprites.add(LcarsBlockMedium(colours.RED_BROWN, (145, 16), "LIGHTS"), layer=1) all_sprites.add(LcarsBlockSmall(colours.ORANGE, (211, 16), "CAMERAS"), layer=1) all_sprites.add(LcarsBlockLarge(colours.BEIGE, (249, 16), "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 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), "DATA INTERFACE", 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), socket.gethostbyname(socket.gethostname()).replace(".", " ")), layer=1) # info text all_sprites.add(LcarsText(colours.WHITE, (192, 130), "EVENT LOG:", 1.5), layer=3) all_sprites.add(LcarsText(colours.BLUE, (244, 130), "acpi", 1), layer=3) all_sprites.add(LcarsText(colours.BLUE, (286, 130), "uptime", 1), layer=3) all_sprites.add(LcarsText(colours.BLUE, (330, 130), "fqdn", 1), 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 setup(self, all_sprites): #self.mainscreen=mainscr all_sprites.add( LcarsBackgroundImage("assets/lcars_screen_2_modern.png"), layer=0) all_sprites.add(LcarsGifImage("assets/gadgets/stlogorotating.gif", (103, 369), 50), layer=0) all_sprites.add(LcarsText(colours.BLUEMID, (270, -1), "AUTHORIZATION REQUIRED", 2), layer=1) all_sprites.add(LcarsText( colours.BLUEMID, (330, -1), "ONLY AUTHORIZED PERSONNEL MAY ACCESS THIS TERMINAL", 1.5), layer=1) all_sprites.add(LcarsText(colours.BLUEMID, (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) button_row_1 = 230 button_row_2 = 270 button_row_3 = 310 button_row_4 = 350 button_col_1 = 210 button_col_2 = 340 button_col_3 = 470 button_image = pygame.image.load("assets/buttonpad.png") button_image_down = pygame.image.load("assets/buttonpaddown.png") all_sprites.add(UltimateButton( (button_row_1, button_col_1), text="1", handler=self.num_1, image_set=[button_image, button_image, button_image_down]), layer=2) all_sprites.add(UltimateButton( (button_row_1, button_col_2), text="2", handler=self.num_2, image_set=[button_image, button_image, button_image_down]), layer=2) all_sprites.add(UltimateButton( (button_row_1, button_col_3), text="3", handler=self.num_3, image_set=[button_image, button_image, button_image_down]), layer=2) all_sprites.add(UltimateButton( (button_row_2, button_col_1), text="4", handler=self.num_4, image_set=[button_image, button_image, button_image_down]), layer=2) all_sprites.add(UltimateButton( (button_row_2, button_col_2), text="5", handler=self.num_5, image_set=[button_image, button_image, button_image_down]), layer=2) all_sprites.add(UltimateButton( (button_row_2, button_col_3), text="6", handler=self.num_6, image_set=[button_image, button_image, button_image_down]), layer=2) all_sprites.add(UltimateButton( (button_row_3, button_col_1), text="7", handler=self.num_7, image_set=[button_image, button_image, button_image_down]), layer=2) all_sprites.add(UltimateButton( (button_row_3, button_col_2), text="8", handler=self.num_8, image_set=[button_image, button_image, button_image_down]), layer=2) all_sprites.add(UltimateButton( (button_row_3, button_col_3), text="9", handler=self.num_3, image_set=[button_image, button_image, button_image_down]), layer=2) all_sprites.add(UltimateButton( (button_row_4, button_col_2), text="0", handler=self.num_7, image_set=[button_image, button_image, button_image_down]), layer=2) if config.DEV_MODE: all_sprites.add(LcarsButton(colours.GREY_BLUE, (0, 770), "X", self.exitHandler, (30, 30)), layer=2) self.layer1 = all_sprites.get_sprites_from_layer(1) self.layer2 = all_sprites.get_sprites_from_layer(2) # sounds Sound("assets/audio/panel/215.wav").play() self.sound_granted = Sound("assets/audio/accessing.wav") self.sound_beep1 = Sound("assets/audio/panel/201.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") ############ # SET PIN CODE WITH THIS VARIABLE ############ self.pin = 1337 ############ self.reset()