Example #1
0
    def montage(self, arg=None, menuw=None):
        skin.clear()
        monitors = self.zm.list_monitor()
        l = len(monitors)
        w = int(sqrt(l))
        if w != sqrt(l):
            w = w + 1
        mon_w = osd.width / w
        if ((w * w) - l) >= w:
            mon_h = osd.height / (w - 1)
        else:
            mon_h = osd.height / w
        x = 0
        y = 0
        threads = []
        for (id, name, width, height) in monitors:
            t = threading.Thread(target=self.live_montage, args=(id, x, y, mon_w, mon_h))
            t.start()
            threads.append(t)
            x += mon_w
            if (x + (osd.width % w)) == osd.width:
                y += mon_h
            x = x % osd.width

        for t in threads:
            t.join()
        skin.redraw()
Example #2
0
    def __run__(self):
        _debug_('__run__()', 2)
        current_saver = None
        index = 0
        plugins_count = len(self.plugins)
        _debug_('found %s screensaver(s)' % plugins_count)
        while not self.stop_screensaver:
            # No current screensaver so select one of the installed screensaver
            # plugins at random
            # if current_saver is None:
            if plugins_count == 1:
                current_saver = self.plugins[0]
            elif plugins_count > 1 and plugins_count <= 4:
                current_saver = self.plugins[index]
                index += 1
                if index >= plugins_count:
                    index = 0
            elif plugins_count > 4:
                index = random.randint(0, len(self.plugins) - 1)
                current_saver = self.plugins[index]

            # No screensaver found just sleep for 200ms
            if current_saver is None:
                time.sleep(0.200)
            else:
                self.__run_screensaver__(current_saver)

        self.screensaver_showing = False
        skin.force_redraw = True
        skin.redraw()
        osd.update()
        _debug_('Screensaver thread stopped')
Example #3
0
 def poll(self):
     """
     update the idlebar every 30 secs even if nothing happens
     """
     logger.log( 9, 'PluginInterface.poll()')
     if skin.active():
         skin.redraw()
Example #4
0
 def poll(self):
     """
     update the idlebar every 30 secs even if nothing happens
     """
     logger.log(9, 'PluginInterface.poll()')
     if skin.active():
         skin.redraw()
Example #5
0
 def __loaded(self, result, image_request):
     if self.image == image_request[0]:
         self.loading_image = None
         self._image = result + image_request[1:]
         self.image_loaded = True
         
         skin.redraw()
Example #6
0
    def montage(self, arg=None, menuw=None):
        skin.clear()
        monitors = self.zm.list_monitor()
        l = len(monitors)
        w = int(sqrt(l))
        if w != sqrt(l):
            w = w + 1
        mon_w = osd.width / w
        if ((w*w) - l) >= w :
            mon_h = osd.height / (w - 1)
        else:
            mon_h = osd.height / w
        x = 0
        y = 0
        threads = []
        for (id, name, width, height) in monitors:
            t = threading.Thread(target=self.live_montage, args=(id, x, y, mon_w, mon_h))
            t.start()
            threads.append(t)
            x += mon_w
            if (x + (osd.width % w)) == osd.width:
                y += mon_h
            x = (x %  osd.width)

        for t in threads:
            t.join()
        skin.redraw()
Example #7
0
    def __loaded(self, result, image_request):
        if self.image == image_request[0]:
            self.loading_image = None
            self._image = result + image_request[1:]
            self.image_loaded = True

            skin.redraw()
Example #8
0
 def eventhandler(self, event, menuw=None):
     """
     catch the IDENTIFY_MEDIA event to redraw the skin (maybe the cd status
     plugin wants to redraw)
     """
     if plugin.isevent(event) == 'IDENTIFY_MEDIA' and skin.active():
         skin.redraw()
     return False
Example #9
0
 def eventhandler(self, event, menuw=None):
     """
     catch the IDENTIFY_MEDIA event to redraw the skin (maybe the cd status
     plugin wants to redraw)
     """
     logger.log( 9, 'PluginInterface.eventhandler(event=%r, menuw=%r)', event, menuw)
     if skin.active() and plugin.isevent(event) == 'IDENTIFY_MEDIA':
         skin.redraw()
     return False
Example #10
0
 def eventhandler(self, event, menuw=None):
     """
     catch the IDENTIFY_MEDIA event to redraw the skin (maybe the cd status
     plugin wants to redraw)
     """
     logger.log(9, 'PluginInterface.eventhandler(event=%r, menuw=%r)',
                event, menuw)
     if skin.active() and plugin.isevent(event) == 'IDENTIFY_MEDIA':
         skin.redraw()
     return False
Example #11
0
 def poll(self):
     """
     clear the osd after 2 seconds
     """
     if self.message:
         self.message = ''
         if not rc.app() or not skin.get_singleton().force_redraw:
             skin.redraw()
         elif hasattr(rc.app(), 'im_self') and hasattr(rc.app().im_self, 'redraw'):
             rc.app().im_self.redraw()
Example #12
0
 def _paused_handler(self):
     """
     This is only called if there is only one track to play
     """
     logger.debug('_paused_handler')
     #rc.post_event does not seem to work
     #rc.post_event(STOP)
     self.stop_visual()
     # need to redraw the screen some how
     skin.redraw()
Example #13
0
 def poll(self):
     '''poll function'''
     now = time.time()
     pollduration = now - self.lastpoll
     drawduration = now - self.lastdraw
     self.lastpoll = now
     _debug_("poll(self): poll=%.2f, draw=%.2f, interval=%s, state=%s" % \
         (pollduration, drawduration, self.draw_interval, self.state), 2)
     if drawduration >= self.draw_interval / 100:
         if skin.active():
             skin.redraw()
Example #14
0
 def stop_saver(self):
     logger.log( 9, 'stop_saver()')
     if self.timer is not None:
         self.disable_dpms()
         self.dpms_timer.stop()
         self.timer.stop()
         self.screensaver_showing = False
         skin.redraw()
         osd.screensaver_running = False
         osd.update()
         logger.debug('Screensaver thread stopped')
Example #15
0
    def poll(self):
        '''poll function'''
        now = time.time()
        pollduration = now - self.lastpoll
        drawduration = now - self.lastdraw
        self.lastpoll = now
        logger.log( 9, "poll(self): poll=%.2f, draw=%.2f, interval=%s, state=%s", pollduration, drawduration, self.draw_interval, self.state)

        if drawduration >= self.draw_interval / 100:
            if skin.active():
                skin.redraw()
Example #16
0
 def poll(self):
     """
     clear the osd after 2 seconds
     """
     if self.message:
         self.message = ''
         if not rc.app() or not skin.get_singleton().force_redraw:
             skin.redraw()
         elif hasattr(rc.app(), 'im_self') and hasattr(
                 rc.app().im_self, 'redraw'):
             rc.app().im_self.redraw()
Example #17
0
    def _timerhandler(self):
        """poll function"""
        now = time.time()
        pollduration = now - self.lastpoll
        drawduration = now - self.lastdraw
        self.lastpoll = now
        logger.log( 9, "_timerhandler(): poll=%.2f, draw=%.2f, interval=%s, state=%s", pollduration, drawduration, self.draw_interval, self.state)

        if drawduration >= self.draw_interval:
            if skin.active():
                skin.redraw()
Example #18
0
    def _timerhandler(self):
        """poll function"""
        now = time.time()
        pollduration = now - self.lastpoll
        drawduration = now - self.lastdraw
        self.lastpoll = now
        logger.log(
            9, "_timerhandler(): poll=%.2f, draw=%.2f, interval=%s, state=%s",
            pollduration, drawduration, self.draw_interval, self.state)

        if drawduration >= self.draw_interval:
            if skin.active():
                skin.redraw()
Example #19
0
 def eventhandler(self, event, menuw=None):
     """
     catch OSD_MESSAGE and display it, return False, maybe someone
     else is watching for the event.
     """
     if event == OSD_MESSAGE:
         self.poll_counter = 1
         self.message = event.arg
         if not rc.app() or not skin.get_singleton().force_redraw:
             skin.redraw()
         elif hasattr(rc.app(), 'im_self') and hasattr(rc.app().im_self, 'redraw'):
             rc.app().im_self.redraw()
     return False
Example #20
0
    def update(self):
        """
        update the bar according to showstatus
        """
        if self.status == BAR_SHOW:
            if skin.active():
                skin.redraw()

        elif self.status == BAR_IDLE:
            self.status = self.timer()
            if self.status == BAR_HIDE:
                self.hide()
            if skin.active():
                skin.redraw()
Example #21
0
 def eventhandler(self, event, menuw=None):
     """
     catch OSD_MESSAGE and display it, return False, maybe someone
     else is watching for the event.
     """
     if event == OSD_MESSAGE:
         self.poll_counter = 1
         self.message = event.arg
         if not rc.app() or not skin.get_singleton().force_redraw:
             skin.redraw()
         elif hasattr(rc.app(), 'im_self') and hasattr(
                 rc.app().im_self, 'redraw'):
             rc.app().im_self.redraw()
     return False
Example #22
0
 def display(self, surface = osd):
     if self.stream_file is None:
         return
     waiting = True
     while waiting:
         for e in pygame.event.get():
             if e.type == pygame.KEYDOWN:
                 if e.key == pygame.K_ESCAPE:
                     waiting = False
         picture = self.get_picture()
         if picture is None:
             continue
         surface.screen.blit(pygame.transform.scale(picture, surface.screen.get_size()), (0, 0))
         pygame.display.flip()
     skin.redraw()
Example #23
0
 def display(self, surface=osd):
     if self.stream_file is None:
         return
     waiting = True
     while waiting:
         for e in pygame.event.get():
             if e.type == pygame.KEYDOWN:
                 if e.key == pygame.K_ESCAPE:
                     waiting = False
         picture = self.get_picture()
         if picture is None:
             continue
         surface.screen.blit(pygame.transform.scale(picture, surface.screen.get_size()), (0, 0))
         pygame.display.flip()
     skin.redraw()
Example #24
0
    def update(self, state=None):
        """
        update the bar according to bar state
        """
        logger.log(8, 'update()')
        if state is not None:
            if state == BAR_SHOW:
                self.show()
                self.timer.start(1.0)
            elif state == BAR_HIDE:
                self.timer.stop()
                self.hide()
            elif state == BAR_WAIT:
                self.time = time.time()
            self.state = state

        if self.state == BAR_SHOW:
            skin.redraw()
        elif self.state == BAR_HIDE:
            skin.redraw()
        elif self.state == BAR_WAIT:
            if self.time and (time.time() - self.time) > self.wait_timeout:
                self.update(BAR_HIDE)
Example #25
0
    def update(self, state=None):
        """
        update the bar according to bar state
        """
        logger.log( 8, 'update()')
        if state is not None:
            if state == BAR_SHOW:
                self.show()
                self.timer.start(1.0)
            elif state == BAR_HIDE:
                self.timer.stop()
                self.hide()
            elif state == BAR_WAIT:
                self.time = time.time()
            self.state = state

        if self.state == BAR_SHOW:
            skin.redraw()
        elif self.state == BAR_HIDE:
            skin.redraw()
        elif self.state == BAR_WAIT:
            if self.time and (time.time() - self.time) > self.wait_timeout:
                self.update(BAR_HIDE)
Example #26
0
 def poll(self):
     """
     update the idlebar every 30 secs even if nothing happens
     """
     if skin.active():
         skin.redraw()
Example #27
0
    def __image_loaded(self, result, image):
        if image in self.loading_images and result[0] is not None:
            self.image_loaded = True
            del self.loading_images[image]

            skin.redraw()
Example #28
0
 def __image_loaded(self, result, image):
     if image in self.loading_images and result[0] is not None:
         self.image_loaded = True
         del self.loading_images[image]
         
         skin.redraw()