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): self.image = None self.zoomPoint = None self.preview = False self.timer = 0 # detect focus self.focus = ProcessFocus() self.focus.start() # stack images self.stack = ProcessStacking() self.stack.start() self.showStack = False # tracking images self.telescope = Telescope(self.config['telescope_dev']) self.tracker = ProcessTracking(self.telescope) self.tracker.start() self.tracking = False self.focusText = LcarsText((255,0,0), (17,303), "Focus: ") self.trackingText = LcarsText((255,0,0), (17,380), "Track: ") all_sprites.add(LcarsBackgroundImage("assets/jarvis.png")) all_sprites.add(self.focusText) all_sprites.add(self.trackingText)
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): script_dir = dirname(__file__) ipath = join(script_dir, '../assets/lcars_screen_2.png') all_sprites.add(LcarsBackgroundImage(ipath), layer=0) all_sprites.add(LcarsText(colours.ORANGE, (170, -1), "AUTHORIZATION REQUIRED", 2), layer=1) all_sprites.add(LcarsText( colours.BLUE, (230, -1), "ONLY AUTHORIZED PERSONNEL MAY ACCESS THIS TERMINAL", 1.5), layer=1) all_sprites.add(LcarsText(colours.BLUE, (260, -1), "TOUCH TERMINAL TO PROCEED", 1.5), layer=1) all_sprites.add(LcarsText(colours.BLUE, (290, -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): # 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), "NETWORK STATUS", 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), "LAN", self.display_lan), layer=2) all_sprites.add(LcarsButton(randomcolor(), "nav", (200, 15), "INTERNET", self.display_internet), layer=2) all_sprites.add(LcarsButton(randomcolor(), "nav", (255, 15), "SERVER", self.nullfunction), layer=2) all_sprites.add(LcarsButton(randomcolor(), "nav", (310, 15), "", self.nullfunction), layer=2) all_sprites.add(LcarsButton(randomcolor(), "nav", (365, 15), "", self.nullfunction), layer=2) all_sprites.add(LcarsButton(randomcolor(), "btn", (140, 660), "ROUTERS", self.display_lan), layer=3) all_sprites.add(LcarsButton(randomcolor(), "btn", (200, 660), "PRINTERS", self.display_printers), layer=3) all_sprites.add(LcarsButton(randomcolor(), "btn", (260, 660), "SENSORS", self.display_sensors), layer=3) self.lan_buttons = all_sprites.get_sprites_from_layer(3) # Pull in information self.loadfile(all_sprites, "routers", 4) self.loadfile(all_sprites, "sites", 5) self.toggle_sprites(self.sites, False) self.loadfile(all_sprites, "sensors", 6) self.toggle_sprites(self.sensors, False) self.loadfile(all_sprites, "printers", 7) self.toggle_sprites(self.printers, False) # SFX self.beep1 = Sound("assets/audio/panel/201.wav") Sound("assets/audio/hail_2.wav").play()
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): # 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), "OPERATIONS", 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), "TERMINAL", self.display_hw), layer=2) all_sprites.add(LcarsButton(randomcolor(), "nav", (200, 15), "LCARS UI", self.display_lcars), layer=2) all_sprites.add(LcarsButton(randomcolor(), "nav", (255, 15), "BUTTON 3", self.nullfunction), layer=2) all_sprites.add(LcarsButton(randomcolor(), "nav", (310, 15), "BUTTON 4", self.nullfunction), layer=2) all_sprites.add(LcarsButton(randomcolor(), "nav", (365, 15), "", self.nullfunction), layer=2) # Local hardware all_sprites.add(LcarsText(colours.ORANGE, (140, 175), "UPTIME", 2), layer=3) all_sprites.add(LcarsText(colours.BLUE, (200, 175), get_uptime(), 2), layer=3) all_sprites.add(LcarsText(colours.ORANGE, (260, 175), "SYSTEM LOAD AVG", 2), layer=3) all_sprites.add(LcarsText(colours.BLUE, (320, 175), get_load(), 2), layer=3) all_sprites.add(LcarsButton(colours.ORANGE, "btn", (380, 175), "REBOOT", self.reboot), layer=3) all_sprites.add(LcarsButton(colours.RED, "btn", (380, 350), "SHUTDOWN", self.shutdown), layer=3) self.hw = all_sprites.get_sprites_from_layer(3) # LCARS UI # Check for update if update_available() == False: all_sprites.add(LcarsText(colours.ORANGE, (140, 175), "LATEST VERSION INSTALLED", 2), layer=4) elif update_available() == True: all_sprites.add(LcarsText(colours.ORANGE, (140, 175), "UPDATE AVAILABLE", 2), layer=4) all_sprites.add(LcarsButton(colours.BLUE, "btn", (200, 175), "UPDATE LCARS", self.git_pull), layer=4) all_sprites.add(LcarsButton(colours.ORANGE, "btn", (260, 175), "RESTART LCARS", self.exit), layer=4) self.lcars = all_sprites.get_sprites_from_layer(4) self.toggle_sprites(self.lcars, False) # SFX self.beep1 = Sound("assets/audio/panel/201.wav") Sound("assets/audio/hail_2.wav").play()
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), "SECTION NAME", 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), "BUTTON 1", self.nullfunction), layer=2) all_sprites.add(LcarsButton(randomcolor(), "nav", (200, 15), "BUTTON 2", self.nullfunction), layer=2) all_sprites.add(LcarsButton(randomcolor(), "nav", (255, 15), "BUTTON 3", self.nullfunction), layer=2) all_sprites.add(LcarsButton(randomcolor(), "nav", (310, 15), "BUTTON 4", self.nullfunction), layer=2) all_sprites.add(LcarsButton(randomcolor(), "nav", (365, 15), "", self.nullfunction), layer=2) # Info text all_sprites.add(LcarsText(colours.BLUE, (244, 174), "TEXT GOES HERE", 1.5), layer=3) 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): 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_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_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), "HOME AUTOMATION", 2), layer=1) # ----------- Main Menu Buttons - move when more than one screen, move to parent class all_sprites.add(LcarsBlockMedium(colours.RED_BROWN, (145, 16), "MAIN"), layer=1) all_sprites.add(LcarsBlockSmall(colours.ORANGE, (211, 16), "SETTINGS"), layer=1) all_sprites.add(LcarsBlockLarge(colours.BEIGE, (249, 16), "ENERGY"), layer=1) # ----------- Main Menu Buttons End all_sprites.add(LcarsText(colours.BLACK, (444, 612), "192 168 0 3"), layer=1) # 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) # sub buttons - layer 2 # Distance of 135 on y axis seems good # Move to super class all_sprites.add(LcarsButton(colours.RED_BROWN, (6, 662), "LOGOUT", self.logoutHandler), layer=2) # ----------------------------------------------------------------------------------------- all_sprites.add(LcarsButton(colours.BEIGE, (107, 127), "LIGHTS", self.lights_handler), layer=2) all_sprites.add(LcarsButton(colours.PURPLE, (107, 262), "AUDIO", self.audio_handler), layer=2) all_sprites.add(LcarsButton(colours.PEACH, (107, 398), "SENSORS", self.sensors_handler), layer=2) all_sprites.add(LcarsButton(colours.ORANGE, (107, 533), "PENDING", self.sensors_handler), layer=2) # Audio ------------------------------------------------------------------------------- # Move to own section # Audio Buttons - layer 4 audio.initialize(self, all_sprites) # all_sprites.add(LcarsButton(colours.PEACH, (200, 127), "VAL", self.audio_handler_play_val), # layer=4) lights.initialize(self, all_sprites) # self.section_audio_sprites = all_sprites.get_sprites_from_layer(4) # Audio Logic # self.section_audio_sources_val = vlc.MediaPlayer("http://radio.doubleclic.fr/radiovaldisere.mp3") # self.section_audio_radio_image = LcarsImage("assets/make_it_snow.jpg", (150, 122)) # self.section_audio_radio_image.visible = False # all_sprites.add(self.section_audio_radio_image, layer=4) # ------------------------------------------------------------------------------------- # gadgets 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) # 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), "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): # Weather parameters self.temperature = -9999 self.tStr = None self.pressure = -9999 self.pStr = None self.humidity = -9999 self.hStr = None self.battery = -9999 self.load = -9999 self.pwrStr = None self.timestamp = -9999 self.tsStr = None self.displayedValue = "Temp" self.paramStr = self.tStr self.timestampDT = dt.datetime.now() self.beatWarningTime = 10. * 60. self.runningCam = False self.cmdCamGo = [ 'sudo', '-H', '-u', 'pi', 'adafruit-io', 'camera', 'start', '-f', 'camera_feed', '-m', 'false', '-r', '5', '-v', 'false' ] self.cmdCamStop = [ 'sudo', '-H', '-u', 'pi', 'adafruit-io', 'camera', 'stop' ] # Background image/overall layout script_dir = dirname(__file__) ipath = join(script_dir, '../assets/mainscreen.png') all_sprites.add(LcarsBackgroundImage(ipath), layer=0) # Screen brightness we start from self.sbrightness = 0.5 # Need this to not crash the auto brightness # button, so choose a default that's easily elimated # from any logging activity just in case self.lux = 86.75309 # Screen control buttons buttonBri = LcarsButton((255, 204, 153), (5, 270), "BRIGHTER", self.screenBrighterHandler) buttonDim = LcarsButton((255, 153, 102), (5, 375), "DIMMER", self.screenDimmerHandler) buttonOff = LcarsButton((204, 102, 102), (50, 270), "OFF", self.logoutHandler) # Add this one to self to make it easily changed elsewhere self.buttonAuto = LcarsButton(colours.BLUE, (50, 375), "AUTO", self.autoBrightHandler) all_sprites.add(buttonBri, layer=4) all_sprites.add(buttonDim, layer=4) all_sprites.add(buttonOff, layer=4) all_sprites.add(self.buttonAuto, layer=4) # Header text all_sprites.add(LcarsText((255, 204, 153), (-5, 55), "WEATHER", size=3), layer=1) # date display sDateFmt = "%d%m.%y %H:%M:%S" sDate = "{}".format(datetime.now().strftime(sDateFmt)) self.stardate = LcarsText(colours.BLUE, (55, 55), sDate, size=2.0) self.lastClockUpdate = 0 self.whenLastRead = dt.datetime.now() all_sprites.add(self.stardate, layer=1) # Section/Parameter ID Text self.sensorTimestampText = LcarsText((0, 0, 0), (95, 275), "LAST UPDATE: ", 1.0) # self.sectionText = LcarsText((255, 204, 153), (120, 55), # "TEMPERATURE:", 3.) all_sprites.add(self.sensorTimestampText, layer=4) # all_sprites.add(self.sectionText, layer=4) # Section Value Text. If the temperature isn't nuts, it's probably # a good enough value to display so start with that. self.paramValueText = LcarsText((255, 204, 153), (170, -1), "XX.X C|XX.X F", 4.5) all_sprites.add(self.paramValueText, layer=3) self.info_text = all_sprites.get_sprites_from_layer(3) # buttons # (Bottom) #buttrowpos = (270, 65) # (Top) buttrowpos = (125, 55) self.butt1 = LcarsButton(colours.PURPLE, buttrowpos, "Temperature", self.cTempHandler) self.butt2 = LcarsButton( colours.PURPLE, (buttrowpos[0], buttrowpos[1] + self.butt1.size[0]), "Pressure", self.cPressHandler) self.butt3 = LcarsButton(colours.PURPLE, (buttrowpos[0], buttrowpos[1] + self.butt1.size[0] + self.butt2.size[0]), "Humidity", self.cHumiHandler) self.butt4 = LcarsButton( colours.PURPLE, (buttrowpos[0], buttrowpos[1] + self.butt1.size[0] + self.butt2.size[0] + self.butt3.size[0]), "Power", self.cPowerHandler) all_sprites.add(self.butt1, layer=5) all_sprites.add(self.butt2, layer=5) all_sprites.add(self.butt3, layer=5) all_sprites.add(self.butt4, layer=5) campos = (270, 320) self.buttcam = LcarsButton((204, 102, 102), campos, "KITTY CAM", self.camHandler) all_sprites.add(self.buttcam, layer=4) # Local (intranet) MQTT server setup; Hopefully we can can start # with the current values already there if all is well with MQTT self.client = mqtt.Client() self.client.on_connect = self.on_connect self.client.on_message = self.on_message self.client.username_pw_set("WeatherduinoUser", "rainyday") self.client.connect("localhost", 1883, 60) # Non-blocking call that processes network traffic, dispatches # callbacks and handles reconnecting. Must call client.loop_stop() # when you're done with stuff. self.client.loop_start() if self.temperature != -9999: self.paramStr = self.tStr # Note: We need to explicitly update the strings since they're # caught in the time loop and may lag self.updateDisplayedSensorStrings() # Highlight the default choice so we know where we are and trigger self.butt1.changeColor(colours.WHITE) self.butt2.changeColor(self.butt2.inactiveColor) self.butt3.changeColor(self.butt3.inactiveColor) self.butt4.changeColor(self.butt4.inactiveColor) # Automatically control screen brightness at start? self.autosbrightness = True self.buttonAuto.changeColor(colours.WHITE)
def setup(self, all_sprites): #relay setup # get configuration from file pins_df=pd.read_csv("data/buttons.csv") self.all_sprites=all_sprites self.total_banks=pins_df['group'].max() #loop through each cluster for i in range(pins_df['group'].max()): #create arrays for labels, power/reset buttons self.cluster_node_labels.append([]) self.cluster_node_pwr_buttons.append([]) self.cluster_node_reset_buttons.append([]) self.status_labels.append([]) #Elbow up-down buttons all_sprites.add(ModernElbowTop(colours.TRANSPARENT, (77,15), "", handler=self.changeClusterUp), layer=1) all_sprites.add(ModernElbowBottom(colours.TRANSPARENT, (400,15), "", handler=self.changeClusterDown), layer=1) for i in range(len(pins_df)): button=None label=None controller=self.relay_controllers[i] #create relevant button and add it to all_sprites and button array #buttons not in group 1 hidden by default #labels are created at same time as power buttons if pins_df['type'][i]=='power': name=pins_df['name'][i] button=RelayPowerButton(colours.PURPLE, (self.content_ypos+(self.content_yinterval*(int(pins_df['computer_number'][i])-1)), self.pwr_button_xpos), "POWER", controller, self.relayButtonHandler) self.cluster_node_pwr_buttons[int(pins_df['group'][i])-1].append(button) label=DescText(colours.WHITE, ((self.content_ypos+5)+(self.content_yinterval*(int(pins_df['computer_number'][i])-1)), self.label_xpos), name) statuslabel=DescText(colours.RED, (self.content_ypos+5)+(self.content_yinterval*(int(pins_df['computer_number'][i])-1)+20, self.label_xpos), "OFFLINE") self.cluster_node_labels[pins_df['group'][i]-1].append(label) self.status_labels[pins_df['group'][i]-1].append(statuslabel) all_sprites.add(label, layer=4) all_sprites.add(statuslabel, layer=4) print(nodes[i-((pins_df['group'][i]-1)*4)].ip_address) #nodes[i-((pins_df['group'][i]-1)*4)].statuslabel=statuslabel #create reset buttons else: button=RelayResetButton(colours.WHITE, (self.content_ypos+(self.content_yinterval*(int(pins_df['computer_number'][i])-1)), self.reset_button_xpos), "RESET", controller, self.relayButtonHandler) self.cluster_node_reset_buttons[int(pins_df['group'][i])-1].append(button) all_sprites.add(button, layer=4) #set buttons not in group to not be visible if not int(pins_df['group'][i])==1: button.visible=False statuslabel.Visible=False if not label==None: label.visible=False # background image all_sprites.add(LcarsBackgroundImage("assets/lcars_screen_1_modern.png"), layer=0) # panel text #all_sprites.add(YukonText(colours.BLUEDARK, (117, 90), "UP"), # layer=1) #all_sprites.add(YukonText(colours.BLUEDARK, (420, 65), "dOWN"), # layer=1) self.title_text=LcarsText(colours.WHITE, (10, 135), "CLUSTER CONTROL", 2) all_sprites.add(self.title_text, layer=1) all_sprites.add(LcarsBlockMedium(colours.TRANSPARENT, (145, 16), "CONTROL", self.showControlHandler), layer=1) all_sprites.add(LcarsBlockSmall(colours.WHITE, (211, 16), "STATUS", self.showStatusHandler), layer=1) all_sprites.add(LcarsBlockLarge(colours.WHITE, (249, 16), "SETTINGS", self.showSettingsHandler), layer=1) self.ip_address = LcarsText(colours.BLUEDARK, (446, 505), ":: NODE | "+get_ip_address_string()+" ::", 1.13) all_sprites.add(self.ip_address, layer=1) self.bank_number_text = LcarsText(colours.BLUEDARK, (79, 331), "BANK "+str(self.bank_number), 1.1) all_sprites.add(self.bank_number_text, layer=1) # date display self.stardate = LcarsText(colours.BLUEMID, (25, 470), "STAR DATE 2311.05 17:54:32", 1.5) self.lastClockUpdate = 0 all_sprites.add(self.stardate, layer=1) # buttons all_sprites.add(SideBlockSmall(colours.BLUEMID, (447, 690), "LOGOUT", self.logoutHandler), layer=1) #all_sprites.add(LcarsMoveToMouse(colours.WHITE), layer=1) self.beep1 = Sound("assets/audio/panel/201.wav") Sound("assets/audio/panel/220.wav").play() #ensure only first page displayed for sprite in all_sprites.get_sprites_from_layer(5): sprite.visible=False for sprite in all_sprites.get_sprites_from_layer(6): sprite.visible=False
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): 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): 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): # 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): # 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_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()