def __init__(self, util): """ Initializer :param util: contains config object """ self.name = LOGO plugin_folder = type(self).__name__.lower() Screensaver.__init__(self, self.name, util, plugin_folder) Container.__init__(self, util, bounding_box=util.screen_rect, background=self.bg[1], content=self.bg[2], image_filename=self.bg[3]) self.config = util.config self.image_util = util.image_util self.util = util vertical_size_percent = self.plugin_config_file.getint( PLUGIN_CONFIGURATION, VERTICAL_SIZE_PERCENT) self.logo_size = int( (vertical_size_percent * self.bounding_box.h) / 100) self.r = pygame.Rect(0, 0, self.logo_size, self.logo_size) self.component = Component(util) self.component.name = GENERATED_IMAGE + self.name self.component.image_filename = self.component.name self.add_component(self.component)
def __init__(self, util): """ Initializer :param util: utility object """ self.util = util self.config = util.config self.screen_w = self.config[SCREEN_INFO][WIDTH] self.screen_h = self.config[SCREEN_INFO][HEIGHT] self.lines = 12 line_length = 52 font_vertical_percent = 5 self.name = LYRICS self.lyrics_util = LyricsUtil(util.k2, self.lines, line_length) self.lyrics_not_found_label = self.config[LABELS][LYRICS_NOT_FOUND] plugin_folder = type(self).__name__.lower() Screensaver.__init__(self, plugin_folder) self.bounding_box = util.screen_rect Container.__init__(self, util, self.bounding_box, (0, 0, 0)) font_size = int((font_vertical_percent * self.bounding_box.h) / 100) self.f = util.get_font(font_size) self.lyrics_not_found = True c = Component(util, bgr=(0, 0, 0)) c.name = "base" self.set_not_found(c) self.add_component(c) self.current_page = 1 self.current_song = ""
def __init__(self, util): """ Initializer :param util: utility object """ self.util = util plugin_folder = type(self).__name__.lower() Screensaver.__init__(self, plugin_folder) self.config = util.config self.name = RANDOM self.current_image = None self.current_image_folder = None self.current_volume = None self.current_song_info = None s = self.plugin_config_file.get(PLUGIN_CONFIGURATION, "savers") if s == None or len(s.strip()) == 0: self.saver_names = [CLOCK, LOGO, SLIDESHOW, VUMETER, WEATHER, SPECTRUM, LYRICS] else: self.saver_names = s.split(",") self.saver_names = list(map(str.strip, self.saver_names)) shuffle(self.saver_names) self.savers = {} for name in self.saver_names: self.savers[name] = self.util.load_screensaver(name) self.saver_num = 0 self.current_saver = None
def __init__(self, util): """ Initializer :param util: contains configuration object """ self.config = util.config Component.__init__(self, util, bgr=(0, 0, 0)) plugin_folder = type(self).__name__.lower() Screensaver.__init__(self, plugin_folder) self.bounding_box = util.screen_rect military_time_format = self.plugin_config_file.getboolean(PLUGIN_CONFIGURATION, MILITARY_TIME_FORMAT) if military_time_format: self.TIME_FORMAT = "%H:%M" else: self.TIME_FORMAT = "%I:%M" self.animated = self.plugin_config_file.getboolean(PLUGIN_CONFIGURATION, ANIMATED) if self.animated: font_vertical_percent = 20 else: font_vertical_percent = 50 font_size = int((font_vertical_percent * self.bounding_box.h)/100) self.f = util.get_font(font_size)
def __init__(self, util): """ Initializer :param util: contains configuration object """ Container.__init__(self, util, util.screen_rect, (0, 0, 0)) plugin_folder = type(self).__name__.lower() Screensaver.__init__(self, plugin_folder) self.util = util self.config = util.config self.bounding_box = util.screen_rect self.default_folder = os.path.join(PACKAGE_SCREENSAVER, plugin_folder, DEFAULT_SLIDES_FOLDER) self.name = SLIDESHOW config_slides_folder = self.plugin_config_file.get( PLUGIN_CONFIGURATION, CONFIG_SLIDES_FOLDER) if config_slides_folder: self.current_folder = config_slides_folder else: self.current_folder = self.default_folder self.random = self.plugin_config_file.get(PLUGIN_CONFIGURATION, RANDOM_ORDER) self.slides = [] self.component = Component(util) self.component.name = self.name self.add_component(self.component)
def __init__(self, util): """ Initializer :param util: contains config object and utility functions """ self.name = "spectrum" plugin_folder = type(self).__name__.lower() Screensaver.__init__(self, self.name, util, plugin_folder) Container.__init__(self, util, bounding_box=util.screen_rect, background=self.bg[1], content=self.bg[2], image_filename=self.bg[3]) self.config = util.config self.image_util = util.image_util self.util = util self.run_flag = False self.run_datasource = False self.pipe_name = self.plugin_config_file.get(PLUGIN_CONFIGURATION, PIPE_NAME) self.PIPE_BUFFER_SIZE = 1048576 # as defined for Raspberry OS in /proc/sys/fs/pipe-max-size self.max_value = self.plugin_config_file.getint( PLUGIN_CONFIGURATION, MAX_VALUE) self.size = self.plugin_config_file.getint(PLUGIN_CONFIGURATION, SIZE) self.update_ui_interval = self.plugin_config_file.getfloat( PLUGIN_CONFIGURATION, UPDATE_UI_INTERVAL) self.amplifier = self.plugin_config_file.getfloat( PLUGIN_CONFIGURATION, AMPLIFIER) self.pipe_polling_inerval = self.update_ui_interval / 10 self.bar_heights = [0] * self.size self.pipe_size = 4 * self.size self.fifth = self.bounding_box.h / 5 self.unit = (self.fifth * 2) / self.max_value self.bar_max_height = int(self.unit * self.max_value * self.amplifier) width = int(self.bounding_box.w - self.fifth * 2) self.bar_width = int(math.floor(width) / self.size) base_line_1 = self.bounding_box.h - (self.fifth * 1.8) base_line_2 = self.bounding_box.h - (self.fifth * 3.0) base_line_3 = self.bounding_box.h - (self.fifth * 1.0) self.base_line = [base_line_1, base_line_2, base_line_3] self.indexes = cycle(range(3)) self.pipe = None self.init_images() self.init_container() if "win" in sys.platform: self.windows = True else: self.windows = False thread = Thread(target=self.open_pipe) thread.start()
def __init__(self, util): """ Initializer :param util: contains config object and utility functions """ self.config = util.config self.bounding_box = self.config[SCREEN_RECT] bgr = (0, 0, 0) Container.__init__(self, util, self.bounding_box, bgr) plugin_folder = type(self).__name__.lower() Screensaver.__init__(self, plugin_folder) self.util = util self.run_flag = False self.run_datasource = False self.pipe_name = self.plugin_config_file.get(PLUGIN_CONFIGURATION, PIPE_NAME) self.pipe_polling_interval = self.plugin_config_file.getfloat( PLUGIN_CONFIGURATION, PIPE_POLLING_INTERVAL) self.max_value = self.plugin_config_file.getint( PLUGIN_CONFIGURATION, MAX_VALUE) self.size = self.plugin_config_file.getint(PLUGIN_CONFIGURATION, SIZE) self.update_ui_interval = self.plugin_config_file.getfloat( PLUGIN_CONFIGURATION, UPDATE_UI_INTERVAL) self.amplifier = self.plugin_config_file.getfloat( PLUGIN_CONFIGURATION, AMPLIFIER) self.bar_heights = [0] * self.size self.pipe_size = 4 * self.size self.fifth = self.bounding_box.h / 5 self.unit = (self.fifth * 2) / self.max_value self.bar_max_height = int(self.unit * self.max_value * self.amplifier) width = int(self.bounding_box.w - self.fifth * 2) self.bar_width = int(math.floor(width) / self.size) base_line_1 = self.bounding_box.h - (self.fifth * 1.8) base_line_2 = self.bounding_box.h - (self.fifth * 3.0) base_line_3 = self.bounding_box.h - (self.fifth * 1.0) self.base_line = [base_line_1, base_line_2, base_line_3] self.indexes = cycle(range(3)) self.pipe = None self.init_images() self.init_container() if "win" in sys.platform: self.windows = True self.update_ui_interval = 0.1 else: self.windows = False thread = Thread(target=self.open_pipe) thread.start()
def __init__(self, util): """ Initializer :param util: contains config object """ self.config = util.config Component.__init__(self, util) plugin_folder = type(self).__name__.lower() Screensaver.__init__(self, plugin_folder) self.util = util self.bounding_box = util.screen_rect vertical_size_percent = self.plugin_config_file.getint( PLUGIN_CONFIGURATION, VERTICAL_SIZE_PERCENT) self.logo_size = int( (vertical_size_percent * self.bounding_box.h) / 100) self.r = pygame.Rect(0, 0, self.logo_size, self.logo_size)
def __init__(self, util): """ Initializer :param util: utility object """ self.name = LYRICS plugin_folder = type(self).__name__.lower() Screensaver.__init__(self, self.name, util, plugin_folder, True) Container.__init__(self, util, bounding_box=util.screen_rect, background=self.bg[1], content=self.bg[2], image_filename=self.bg[3]) self.util = util self.config = util.config self.screen_w = self.config[SCREEN_INFO][WIDTH] self.screen_h = self.config[SCREEN_INFO][HEIGHT] self.lines = 12 line_length = 52 font_vertical_percent = 5 self.lyrics_util = LyricsUtil(util.k2, self.lines, line_length) self.lyrics_not_found_label = self.config[LABELS][LYRICS_NOT_FOUND] self.bounding_box = util.screen_rect font_size = int((font_vertical_percent * self.bounding_box.h) / 100) self.f = util.get_font(font_size) self.lyrics_not_found = True self.not_found_screen = self.get_not_found_screen(util) self.add_component(self.not_found_screen) self.current_page = 0 self.next_page = 0 self.current_song = "" exit_area_height = int(2 * self.bounding_box.h / self.lines) self.exit_area = pygame.Rect(0, 0, self.bounding_box.w, exit_area_height) half = int(self.bounding_box.w / 2) self.left_half = pygame.Rect(0, 0, half, self.bounding_box.h) self.right_half = pygame.Rect(half, 0, half, self.bounding_box.h) self.disable_auto_refresh = False
def __init__(self, util): """ Initializer :param util: contains configuration object """ self.name = CLOCK self.config = util.config plugin_folder = type(self).__name__.lower() Screensaver.__init__(self, self.name, util, plugin_folder) Container.__init__(self, util, bounding_box=util.screen_rect, background=self.bg[1], content=self.bg[2], image_filename=self.bg[3]) military_time_format = self.plugin_config_file.getboolean( PLUGIN_CONFIGURATION, MILITARY_TIME_FORMAT) if military_time_format: self.TIME_FORMAT = "%H:%M" else: self.TIME_FORMAT = "%I:%M" self.animated = self.plugin_config_file.getboolean( PLUGIN_CONFIGURATION, ANIMATED) digits = 5 clock_width_percent = self.plugin_config_file.getint( PLUGIN_CONFIGURATION, CLOCK_SIZE) clock_width_pixels = int( (clock_width_percent * self.bounding_box.w) / 100) digit_width = clock_width_pixels / digits digit_height = int(digit_width * 2.1) self.f = util.get_font(digit_height) self.component = Component(util) self.component.name = GENERATED_IMAGE + self.name self.component.image_filename = self.component.name self.add_component(self.component)
def __init__(self, util): """ Initializer :param util: contains configuration object """ Component.__init__(self, util) plugin_folder = type(self).__name__.lower() Screensaver.__init__(self, plugin_folder) self.util = util self.config = util.config self.bounding_box = self.config[SCREEN_RECT] self.default_folder = os.path.join(PACKAGE_SCREENSAVER, plugin_folder, DEFAULT_SLIDES_FOLDER) config_slides_folder = self.plugin_config_file.get( PLUGIN_CONFIGURATION, CONFIG_SLIDES_FOLDER) if config_slides_folder: self.current_folder = config_slides_folder else: self.current_folder = self.default_folder self.slides = []