Update of /cvsroot/freevo/freevo/src/plugins/idlebar
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv817/src/plugins/idlebar

Modified Files:
        __init__.py 
Log Message:
use signals for theme and applicatio change

Index: __init__.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/plugins/idlebar/__init__.py,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** __init__.py 16 Jul 2005 11:40:28 -0000      1.43
--- __init__.py 21 Jul 2005 18:55:37 -0000      1.44
***************
*** 46,49 ****
--- 46,50 ----
  import gui.animation
  import gui.theme
+ import application
  from event import *
  
***************
*** 70,74 ****
          # register for events
          handler = kaa.notifier.EventHandler(self.eventhandler)
!         handler.register(SCREEN_CONTENT_CHANGE, THEME_CHANGE)
  
          self.poll_interval  = 3000
--- 71,79 ----
          # register for events
          handler = kaa.notifier.EventHandler(self.eventhandler)
!         handler.register()
! 
!         # register for signals
!         application.signals['application change'].connect(self.app_change)
!         gui.theme.signals['theme change'].connect(self.theme_change)
  
          self.poll_interval  = 3000
***************
*** 94,116 ****
          draw a background and all idlebar plugins
          """
-         screen  = gui.display
          changed = False
  
!         w = screen.width
          h = config.GUI_OVERSCAN_Y + 60
  
-         f = gui.theme.image('idlebar')
- 
-         if self.barfile != f:
-             if self.bar:
-                 self.container.remove_child(self.bar)
-             self.barfile = f
-             self.bar = gui.widgets.Image(self.barfile, (0,0), (w, h))
-             self.container.add_child(self.bar)
-             changed = True
- 
          x1 = config.GUI_OVERSCAN_X
          y1 = config.GUI_OVERSCAN_Y
!         x2 = screen.width - config.GUI_OVERSCAN_X
          y2 = h
  
--- 99,110 ----
          draw a background and all idlebar plugins
          """
          changed = False
  
!         w = gui.display.width
          h = config.GUI_OVERSCAN_Y + 60
  
          x1 = config.GUI_OVERSCAN_X
          y1 = config.GUI_OVERSCAN_Y
!         x2 = w - config.GUI_OVERSCAN_X
          y2 = h
  
***************
*** 195,233 ****
  
  
!     def eventhandler(self, event):
          """
!         catch the IDENTIFY_MEDIA event to redraw the skin (maybe the cd status
!         plugin wants to redraw). Also catch SCREEN_CONTENT_CHANGE in case we
!         need to hide/show the bar.
          """
!         if event == SCREEN_CONTENT_CHANGE:
!             # react on toggle fullscreen, hide or show the bar, but not update
!             # the screen itself, this is done by the app later
!             app, fullscreen, fade = event.arg
!             if fade:
!                 fade = config.GUI_FADE_STEPS
!             else:
!                 fade = 0
!             if fullscreen:
!                 # add the background behind the bar
!                 self.add_background()
              else:
!                 # remove the background again, it's done by the
!                 # 'not in fullscreen' app.
!                 self.remove_background()
!             if fullscreen == self.visible:
!                 log.info('set visible %s' % (not fullscreen))
!                 if not self.visible:
!                     self.show(False, fade=fade)
!                 else:
!                     self.hide(False, fade=fade)
!                 self.update()
!             return
  
          if not self.visible:
              return False
  
-         if event == THEME_CHANGE:
-             self.update()
          if plugin.isevent(event) == 'IDENTIFY_MEDIA':
              if self.update():
--- 189,248 ----
  
  
!     def app_change(self, app, fullscreen, fade):
          """
!         React on toggle fullscreen, hide or show the bar, but not update
!         the screen itself, this is done by the app later.
          """
!         # get theme informations
!         self.theme_change()
!         
!         if fade:
!             fade = config.GUI_FADE_STEPS
!         else:
!             fade = 0
!         if fullscreen:
!             # add the background behind the bar
!             self.add_background()
!         else:
!             # remove the background again, it's done by the
!             # 'not in fullscreen' app.
!             self.remove_background()
!         if fullscreen == self.visible:
!             log.info('set visible %s' % (not fullscreen))
!             if not self.visible:
!                 self.show(False, fade=fade)
              else:
!                 self.hide(False, fade=fade)
!         return True
! 
  
+     def theme_change(self):
+         """
+         Signal handler for gui theme changes.
+         """
+         w = gui.display.width
+         h = config.GUI_OVERSCAN_Y + 60
+ 
+         f = gui.theme.image('idlebar')
+ 
+         if self.barfile != f:
+             if self.bar:
+                 self.container.remove_child(self.bar)
+             self.barfile = f
+             self.bar = gui.widgets.Image(self.barfile, (0,0), (w, h))
+             self.container.add_child(self.bar)
+             changed = True
+ 
+         self.update()
+ 
+         
+     def eventhandler(self, event):
+         """
+         catch the IDENTIFY_MEDIA event to redraw the skin (maybe the cd status
+         plugin wants to redraw).
+         """
          if not self.visible:
              return False
  
          if plugin.isevent(event) == 'IDENTIFY_MEDIA':
              if self.update():



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to