def load_config(self): config = Config('space_window.conf', __file__) self._player = config.get('player', 'player', 'omxplayer') self._player_args = config.get( 'player', 'player_args', ' --timeout 60 --loop --no-osd -b').replace('-b', '') self._player_pl_args = config.get('player', 'playlist_player_args', ' --timeout 60 --no-osd -b').replace( '-b', '') self._player_cmd = self._player + ' ' + self._player_args self._player_pl_cmd = self._player + ' ' + self._player_pl_args
def load_config(self): config = Config('space_window.conf', __file__) self._delay = config.getint('nasa', 'frame_delay', 5) self._fontname = config.get('font', 'name', 'comicsansms') self._fontsize = config.getint('nasa', 'font_size', 48) self._font = pg.font.SysFont(self._fontname, self._fontsize) self._text_col = config.getcolor('nasa', 'foreground', (100, 100, 100)) self._text_height_ratio = config.getint('nasa', 'height_ratio', 10)
def __init__(self): config = Config('space_window.conf', __file__) location = config.get('weather', 'location', 'United_Kingdom/England/London') self.url = 'https://www.yr.no/place/%s/forecast.xml' % location self.re_top = re.compile('<time from=.*?\/time>', re.S) self.re_desc = re.compile('<symbol number=\".*?\" name=\"(.*?)\"') self.re_temp = re.compile('<temperature unit=\".*?\" value=\"(.*?)"') #self.re_wind_dir=re.compile('<windDirection.*? code=\"(.*?)\"') self.re_wind_speed=\ re.compile('<windSpeed.*? mps=\"(.*?)\".*?name=\"(.*?)"')
def __init__(self, status_func=None): self._status_func = status_func self.playing = False config = Config('space_window.conf', __file__) self._player = config.get('player', 'player', _player) self._player_args = config.get('player', 'player_args', _player_args) self._player_pl_args=config.get('player','playlist_player_args',\ _player_args) self._player_cmd = self._player + ' ' + self._player_args self._player_pl_cmd = self._player + ' ' + self._player_pl_args self._player_stream_cmd = self._player_pl_cmd self._player_fbcp = '' fbdev = config.get('pygame', 'fbdev', 'None') if fbdev != 'None': self._player_fbcp = 'fbcp&' self._player_cmd = 'fbcp& ' + self._player_cmd self._player_pl_cmd = 'fbcp& ' + self._player_pl_cmd _log = logger.get(__name__)
def load_config(self): config = Config('space_window.conf', __file__) self._forecol = config.getcolor('clock', 'foreground', (255, 128, 0)) bckcol = config.getcolor('clock', 'background', (32, 0, 32)) time_sz = config.getint('clock', 'time_size', 192) date_sz = config.getint('clock', 'date_size', 24) self._border = config.getint('clock', 'border', 10) self._separation = config.getint('clock', 'separation', 8) path = os.path.dirname(os.path.abspath(__file__)) fontname = os.path.join(path, 'digital-7_mono.ttf') self._time_font = pygame.font.Font(fontname, time_sz) self._secs_font = pygame.font.Font(fontname, time_sz / 3) self._date_font = pygame.font.Font(fontname, date_sz) self._black.fill(bckcol) self._init_rects() timezone = config.get('clock', 'timezone', 'NONE') if timezone != 'NONE': os.environ['TZ'] = timezone time.tzset()
def screen(): global _screen if _screen is None: config = Config('space_window.conf', __file__) fbdev = config.get('pygame', 'fbdev', 'None') if fbdev != 'None': os.putenv('SDL_VIDEODRIVER', 'fbcon') os.environ["SDL_FBDEV"] = fbdev pygame_init() scrw = config.getint('pygame', 'screen_width', 0) scrh = config.getint('pygame', 'screen_height', 0) depth = config.getint('pygame', 'screen_depth', 0) if depth == 0: _screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN) else: _screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN, depth) return _screen
def __init__(self,status_update_func,screen): config = Config('space_window.conf',__file__) self._start_with=config.get('global','start_with','streams') self._current_stream=None self._resume_stream=None self._check_timer_delay=20 self._check_timer=None self._wait=False self._streams=Streams.load() self._nasa=NasaPod(screen) self._gallery=Gallery(status_update_func,screen) self._music=Music(status_update_func) self._clock=Clock(screen) self._mopidy=None self._status_update=status_update_func if not _standalone: threading.Thread(target=self.launch_mopidy).start() self._streams.set_status_func(status_update_func) self._resume_func=self.run_something
def __init__(self,screen): config = Config('space_window.conf',__file__) self._border=config.getint('message','border',10) self._left=config.getbool('message','left',False) self._top=config.getbool('message','top',False) self._forecol=config.getcolor('message','foreground',(255,128,0)) bckcol=config.getcolor('message','background',(32,0,32)) fontname=config.get('font','name','comicsansms') fontsz=config.getint('message','font_size',68) self.running=False self._delay=1 self._screen=None self.text=None self.black=None self.font=None #sleep(1) self.screen = screen self.black=self.screen.copy() self.black.fill(bckcol) self.font = pg.font.SysFont(fontname, fontsz) self.lock=threading.Lock()
\t ssid="SSIDNAME" \t auth_alg=OPEN \t key_mgmt=NONE \t priority=10 }\n""" _wpa_header = """ ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=GB """ config = Config('space_window.conf', __file__) ap_name = config.get('access-point', 'name', 'UnusualWiFi') _ap_driver = config.get('access-point', 'driver', 'nl80211') # edimax driver is rtl871xdrv _ap_interface = config.get('access-point', 'interface', 'wlan0') ap_ip = config.get('access-point', 'ip', '192.168.4.1') _ap_iprange = config.get('access-point', 'iprange', '192.168.4.2,192.168.4.20') def _get_config_path(): return os.path.join(os.path.dirname(os.path.abspath(__file__)), 'conf') # run a program and wait for it to finish def run(rcmd): cmd = shlex.split(rcmd) executable = cmd[0]