def start_host(self): """ description: """ self.host = HostProperties(self.data["host"]) self.host.info() echo.debugln("pygame: " + pygame.version.ver, 1) self.host.start() # Get Screen parameters try: self.screen_full = self.host.get_screen()["full"] self.screen_size = self.host.get_screen()["size"] self.screen_rate = self.host.get_screen()["rate"] except BaseException: pass # Get Screensaver parameters try: self.screensaver_time = self.host.get_screensaver() \ .get('time', self.screensaver_time) if self.screensaver_time < 1: self.screensaver_time = 1 self.screensaver_type = self.host.get_screensaver() \ .get('type', self.screensaver_type) self.screensaver_enable = self.host.get_screensaver() \ .get('enable', self.screensaver_enable) except BaseException: pass
def start_screen(self): """ description: """ # global pygame echo.infoln("Screen...") # Set screen resolution self.screen_resolution = [ int(s) for s in self.screen_size.split('x') if s.isdigit() ] # Check for minimum resolution if (self.screen_resolution[0] < 480) or \ (self.screen_resolution[1] < 320): self.screen_resolution = (480, 320) self.screen_resolution[0] -= 1 self.screen_resolution[1] -= 1 echo.infoln( "Size: " + str(self.screen_resolution[0] + 1) + 'x' + str(self.screen_resolution[1] + 1) + ' px', 1) echo.infoln("Refresh rate: " + str(self.screen_rate) + ' FPS', 1) # Positioning os.environ['SDL_VIDEO_CENTERED'] = '1' # Initialise screen pygame.init() # pylint: disable=no-member self.screen = pygame.display.set_mode(self.screen_resolution) if self.screen_full: pygame.display.toggle_fullscreen() # Window caption pygame.display.set_caption(self.window_title) # Checking fonts echo.debugln('Checking fonts...', 1) for ttf_name in ['Digital Readout Thick Upright', 'Ubuntu']: ttf_path = pygame.font.match_font(ttf_name) if ttf_path is None: echo.erroln('TrueType font missing.') echo.infoln( '\"' + str(ttf_name) + '\" not found (' + str(ttf_path) + ')', 2) # Background self.background = pygame.Surface(self.screen.get_size()) self.background.fill([0, 0, 0]) # Black # Controls area self.controls = pygame.Surface([120, 240]) # Object area self.object_area = pygame.Surface( [self.screen.get_size()[0] - 65, self.screen.get_size()[1] - 70]) # Status bar self.status_bar = pygame.Surface([self.screen.get_size()[0], 16]) # Clockling echo.debugln('Clockling...', 1) self.clock = pygame.time.Clock() # Screensaver self.screensaver = Screensaver(self.screen) self.screensaver_timer = Timer(1000 * self.screensaver_time, 'COUNTDOWN') if not self.screensaver_enable: self.screensaver_timer.disable()
def info(self): """ description: """ echo.info('Mouse: ', 1) if not self.__mouse: echo.infoln(str(self.__mouse)) return echo.infoln('Found') echo.debugln('Enable: ' + str(self.__enable), 2) echo.debugln('Factor: ' + str(self.__factor), 2)
def start_x86_64(self): """ description: """ self.timer = Timer(1000) # Temperature sensor status = 'Absent' try: if self.data[self.name]["resources"]["temperature_sensor"]: self.temperature = 0 status = 'Present' except BaseException: pass echo.debugln('Temperature sensor: ' + status, 1)
def start_device(self): """ description: """ echo.infoln("Device...") if not self.device.get_id(): detected = self.device.detect() if len(detected) > 1: echo.warnln('Too many connected devices: ' + str(detected), 1) return echo.debugln(self.device.info()) if self.device.get_id(): self.window_title = self.device.system_plat + ' Mark ' + \ self.device.system_mark self.window_caption = self.device.system_plat + ' Mark ' + \ self.device.system_mark + ' - ' + \ self.device.system_desc
def start_armv7l(self): """ description: """ try: from fan import Fan except ImportError as err: echo.erroln("Could not load module. " + str(err)) sys.exit(True) self.timer = Timer(1000) # Temperature sensor status = 'Absent' try: if self.data[self.name]["resources"]["temperature_sensor"]: self.temperature = 0 status = 'Present' except BaseException: pass echo.debugln('Temperature sensor: ' + status, 1) # Status LED status = 'Absent' try: if self.data[self.name]["resources"]["status_led"]: from tools.signal import SigGen GPIO.setup(33, GPIO.OUT) self.status_led = GPIO.PWM(33, 50) self.status_led.start(0) self.status_signal = SigGen() self.status_signal.period(1000) status = 'Present' except BaseException: pass echo.infoln('Status LED: ' + status, 1) # Fan status = 'Absent' try: if self.data[self.name]["resources"]["fan"]: self.fan = Fan(32, 22, max_speed=2000) self.fan.set_limits(40, 60) self.fan_speed = 0 status = 'Present' except BaseException: pass echo.infoln('Fan: ' + status, 1)
def info(self): """ description: """ echo.info('Keyboard: ', 1) if not self.__keyboard: echo.infoln(str(self.__keyboard)) return echo.infoln('Found') echo.debugln('Enable: ' + str(self.__enable), 2) echo.debugln('Delay: ' + str(self.__delay) + 'ms', 2) echo.debugln('Interval: ' + str(self.__interval) + 'ms', 2)
def info(self): """ description: """ echo.infoln("Host...") echo.debugln("Profile: " + self.profile, 1) echo.infoln("Name: " + self.name, 1) echo.debugln( "Machine: " + self.machine + " (" + self.architecture + ")", 1) echo.debugln("Processor: " + self.processor, 1) echo.debug("Core", 1) if self.core > 1: echo.debug("s") echo.debugln(": " + str(self.core)) echo.debugln( "Memory: " + str(self.memory) + "GB (used: " + str(self.memory_used) + "%)", 1) echo.debug("Operating system: " + self.system, 1) if platform.system() == 'Linux': echo.debugln(" (" + self.distribution + " " + self.distribution_version + ")") echo.debugln("Python: " + self.python_version, 1)
def info(self): """ description: """ echo.info('Joystick: ', 1) if not self.__joystick: echo.infoln(str(self.__joystick)) return echo.infoln(str(self.__joystick.configuration()['name'])) echo.debugln('Enable: ' + str(self.__enable), 2) echo.debugln('Axes: ' + str(self.__joystick.configuration()['axes']), 2) echo.debugln( 'Buttons: ' + str(self.__joystick.configuration()['buttons']), 2) echo.debugln('Balls: ' + str(self.__joystick.configuration()['balls']), 2) echo.debugln('Hats: ' + str(self.__joystick.configuration()['hats']), 2) echo.debugln('Factor: ' + str(self.__factor), 2)