示例#1
0
    def __init__(self,
                 util,
                 bounding_box=None,
                 background=None,
                 visible=True,
                 content=None,
                 image_filename=None):
        """ Initializer
        
        :param util: utility object
        :param bounding_box: container bounding box
        :param background: container background color
        :param visible: visibility flag, True - visible, False - invisible
        """
        if content:
            cnt = content
        else:
            cnt = bounding_box

        Component.__init__(self,
                           util,
                           c=cnt,
                           bb=bounding_box,
                           bgr=background,
                           v=visible)
        self.components = list()
        if image_filename:
            self.image_filename = image_filename
示例#2
0
 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)
示例#3
0
 def __init__(self, util, bounding_box=None, background=None, visible=True):
     """ Initializer
     
     :param util: utility object
     :param bounding_box: container bounding box
     :param background: container background color
     :param visible: visibility flag, True - visible, False - invisible
     """
     Component.__init__(self, util, bb=bounding_box, bgr=background, v=visible)
     self.components = list()
示例#4
0
 def __init__(self, util):
     """ Initializer
     
     :param util: contains config object
     """ 
     self.config = util.config       
     Component.__init__(self, util)
     self.bounding_box = self.config[SCREEN_RECT]
     self.logo_size = int((100 * self.bounding_box.h)/320)
     self.r = pygame.Rect(0, 0, self.logo_size, self.logo_size)
     self.update_period = 4
示例#5
0
 def __init__(self, util):
     """ Initializer
     
     :param util: contains config object
     """
     self.config = util.config
     Component.__init__(self, util, bgr=(0, 0, 0))
     self.bounding_box = self.config[SCREEN_RECT]
     self.TIME_FORMAT = "%I:%M"
     font_size = int((60 * self.bounding_box.h)/320)
     self.f = util.get_font(font_size)
     self.update_period = 4
示例#6
0
 def __init__(self, util, bounding_box=None, background=None, visible=True):
     """ Initializer
     
     :param util: utility object
     :param bounding_box: container bounding box
     :param background: container background color
     :param visible: visibility flag, True - visible, False - invisible
     """
     Component.__init__(self,
                        util,
                        bb=bounding_box,
                        bgr=background,
                        v=visible)
     self.components = list()
示例#7
0
 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 which contains config
     """
     self.util = util
     self.config = util.config
     Component.__init__(self, util, None, None, False)
     self.current_image = None
     self.current_volume = 0
     self.start_listeners = []
     self.stop_listeners = []
     self.current_screensaver = self.get_screensaver()
     self.update_period = self.current_screensaver.get_update_period()
     self.current_delay = self.get_delay()
     self.current_screen = None
     self.saver_running = False
     self.one_cycle_period = 1000 / self.config[SCREEN_INFO][FRAME_RATE]
     self.counter = 0
     self.delay_counter = 0
示例#9
0
 def __init__(self, util):
     """ Initializer
     
     :param util: utility object which contains configuration
     """
     self.util = util
     self.config = util.config
     Component.__init__(self, util, None, None, False)
     self.current_image = None
     self.current_volume = 0
     self.start_listeners = []
     self.stop_listeners = []
     self.current_screensaver = self.get_screensaver()
     self.update_period = self.current_screensaver.get_update_period()
     self.current_delay = self.get_delay()
     self.current_screen = None
     self.saver_running = False
     self.one_cycle_period = 1000 / self.config[SCREEN_INFO][FRAME_RATE]
     self.counter = 0
     self.delay_counter = 0
示例#10
0
文件: slideshow.py 项目: Rucia1/Peppy
    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 = []
示例#11
0
 def __init__(self, util):
     """ Initializer
     
     :param util: contains config object
     """ 
     Component.__init__(self, util)
     self.config = util.config
     self.bounding_box = self.config[SCREEN_RECT]
     self.slides = util.load_screensaver_images("slideshow", "slides")
     self.w = self.config[SCREEN_INFO][WIDTH]
     self.h = self.config[SCREEN_INFO][HEIGHT]
     l = []
     for slide in self.slides:
         width = slide[1].get_size()[0]
         height = slide[1].get_size()[1]
         
         if width == self.w and height == self.h:
             l.append(slide)
         else:
             if width > self.w and height > self.h:
                 k1 = self.w/width
                 k2 = self.h/height                    
                 width = int(width * (min(k1, k2)))
                 height = int(height * (min(k1, k2)))
             elif width > self.w and height < self.h:
                 k = self.w/width
                 width = int(width * k)
                 height = int(height * k)
             elif width < self.w and height >self.h:
                 k = self.h/height
                 width = int(width * k)
                 height = int(height * k)
             img = util.scale_image(slide[1], (width, height))
             t = (slide[0], img)
             l.append(t)
     self.slides = l
     self.indexes = cycle(range(len(self.slides)))
     self.update_period = 6