Author: dmeyer
Date: Sun Oct 29 10:10:21 2006
New Revision: 8502

Added:
   trunk/WIP/broken_plugins/freevoscreensaver.py
      - copied unchanged from r8462, /trunk/ui/src/plugins/freevoscreensaver.py
Removed:
   trunk/ui/src/plugins/freevoscreensaver.py
Modified:
   trunk/ui/src/plugin.py
   trunk/ui/src/plugins/autocolor.py
   trunk/ui/src/plugins/idlebar/__init__.py
   trunk/ui/src/plugins/lcd.py
   trunk/ui/src/plugins/mixer.py
   trunk/ui/src/plugins/osd.py
   trunk/ui/src/plugins/ossmixer.py

Log:
remove DaemonPlugin

Modified: trunk/ui/src/plugin.py
==============================================================================
--- trunk/ui/src/plugin.py      (original)
+++ trunk/ui/src/plugin.py      Sun Oct 29 10:10:21 2006
@@ -137,46 +137,6 @@
         return False
 
 
-class DaemonPlugin(Plugin):
-    """
-    Plugin class for daemon objects who will be activate in the
-    background while Freevo is running
-    """
-    def __init__(self):
-        Plugin.__init__(self)
-        self.poll_interval  = 100       # poll every x milliseconds
-        self.events         = []        # events to register to ([] == all)
-
-
-    def poll(self):
-        """
-        This function will be called every poll_interval milliseconds.
-        """
-        pass
-
-
-    def plugin_activate(self):
-        """
-        Execute on activation of the plugin.
-        """
-        Plugin.plugin_activate(self)
-        if self.__class__.poll != DaemonPlugin.poll:
-            # plugin has a self defined poll function, register it
-            self.__timer = kaa.notifier.Timer(self.poll)
-            self.__timer.start(self.poll_interval)
-
-        if self.__class__.eventhandler != DaemonPlugin.eventhandler:
-            # plugin has a self defined eventhandler
-            kaa.notifier.EventHandler(self.eventhandler).register(self.events)
-
-
-    def eventhandler(self, event):
-        """
-        Handle events passed to the eventhandler.
-        """
-        return False
-
-
 class MimetypePlugin(Plugin):
     """
     Plugin class for mimetypes handled in a directory/playlist.

Modified: trunk/ui/src/plugins/autocolor.py
==============================================================================
--- trunk/ui/src/plugins/autocolor.py   (original)
+++ trunk/ui/src/plugins/autocolor.py   Sun Oct 29 10:10:21 2006
@@ -58,6 +58,8 @@
 import sys
 import copy
 
+from kaa.notifier import EventHandler
+
 import config
 import plugin
 
@@ -66,7 +68,7 @@
 import logging
 log = logging.getLogger()
 
-class PluginInterface(plugin.DaemonPlugin):
+class PluginInterface(plugin.Plugin):
     """
     autocolor plugin.
 
@@ -83,15 +85,18 @@
         """
         init the autocolor plugin
         """
-        plugin.DaemonPlugin.__init__(self)
+        plugin.Plugin.__init__(self)
         self.plugins = None
         plugin.register(self, 'autocolor')
         self.before = before
         self.after = after
+
+        EventHandler(self.eventhandler).register([VIDEO_START, VIDEO_END])
+
         
     def eventhandler(self, event):
         """
-        catch VIDEO_START/VIDEOEND and run a command, return False, maybe
+        catch VIDEO_START/VIDEO_END and run a command, return False, maybe
         someone else is watching for the event.
         """
 

Modified: trunk/ui/src/plugins/idlebar/__init__.py
==============================================================================
--- trunk/ui/src/plugins/idlebar/__init__.py    (original)
+++ trunk/ui/src/plugins/idlebar/__init__.py    Sun Oct 29 10:10:21 2006
@@ -52,7 +52,7 @@
 log = logging.getLogger()
 
 
-class PluginInterface(plugin.DaemonPlugin):
+class PluginInterface(plugin.Plugin):
     """
     To activate the idle bar, put the following in your local_conf.py:
         plugin.activate('idlebar')
@@ -65,7 +65,7 @@
         """
         init the idlebar
         """
-        plugin.DaemonPlugin.__init__(self)
+        plugin.Plugin.__init__(self)
         plugin.register(self, 'idlebar')
 
         # register for events
@@ -75,7 +75,6 @@
         # register for signals
         application.signals['application change'].connect(self.app_change)
 
-        self.poll_interval  = 30
         self.plugins        = None
         self.visible        = False
         self.bar            = None
@@ -86,6 +85,9 @@
         self.container.set_zindex(10)
         gui.display.add_child(self.container)
 
+        self._timer = kaa.notifier.Timer(self.poll)
+        self._timer.start(30)
+
         # Getting current LOCALE
         try:
             locale.resetlocale()

Modified: trunk/ui/src/plugins/lcd.py
==============================================================================
--- trunk/ui/src/plugins/lcd.py (original)
+++ trunk/ui/src/plugins/lcd.py Sun Oct 29 10:10:21 2006
@@ -37,6 +37,7 @@
 import time
 
 from kaa.strutils import to_str
+import kaa.notifier
 
 import plugin
 from event import *
@@ -630,7 +631,7 @@
     return info
 
     
-class PluginInterface( plugin.DaemonPlugin ):
+class PluginInterface( plugin.Plugin ):
     """
     Display context info in LCD using lcdproc daemon.
 
@@ -665,7 +666,7 @@
         """
         init the lcd
         """
-        plugin.DaemonPlugin.__init__( self )
+        plugin.Plugin.__init__( self )
         try:
             self.lcd = pylcd.client()
             cm = self.lcd.connect()
@@ -680,7 +681,6 @@
         #     self.lcd.getinfo()
         #     print ""
             
-        self.poll_interval = 0.01
         self.disable = 0
         self.height = self.lcd.d_height
         self.width  = self.lcd.d_width
@@ -690,7 +690,9 @@
             return
         plugin.register( self, "lcd" )
 
-
+        self._timer = kaa.notifier.Timer(self.poll)
+        self._timer.start(0.01)
+        kaa.notifier.EventHandler(self.eventhandler).register()
         
         # Show welcome screen:
         for w in self.screens[ "welcome" ]:

Modified: trunk/ui/src/plugins/mixer.py
==============================================================================
--- trunk/ui/src/plugins/mixer.py       (original)
+++ trunk/ui/src/plugins/mixer.py       Sun Oct 29 10:10:21 2006
@@ -74,11 +74,12 @@
 import plugin
 from event import *
 from kaa.ioctl import *
+from kaa.notifier import EventHandler
 
 import logging
 log = logging.getLogger()
 
-class PluginInterface(plugin.DaemonPlugin):
+class PluginInterface(plugin.Plugin):
     # These magic numbers were determined by writing a C-program using the
     # macros in /usr/include/linux/... and printing the values.
     # They seem to work on my machine. XXX Is there a real python interface?
@@ -104,7 +105,11 @@
                 log.error('Couldn\'t open mixer %s' % config.DEV_MIXER)
                 return
 
-        plugin.DaemonPlugin.__init__(self)
+        plugin.Plugin.__init__(self)
+
+        events = [MIXER_VOLUP, MIXER_VOLDOWN, MIXER_MUTE]
+        EventHandler(self.eventhandler).register(events)
+
         if 0:
             self.mainVolume   = 0
             self.pcmVolume    = 0

Modified: trunk/ui/src/plugins/osd.py
==============================================================================
--- trunk/ui/src/plugins/osd.py (original)
+++ trunk/ui/src/plugins/osd.py Sun Oct 29 10:10:21 2006
@@ -36,7 +36,7 @@
 import logging
 
 # kaa imports
-from kaa.notifier import OneShotTimer
+from kaa.notifier import OneShotTimer, EventHandler
 
 # freevo imports
 import config
@@ -51,7 +51,7 @@
 log = logging.getLogger()
 
 
-class PluginInterface(plugin.DaemonPlugin):
+class PluginInterface(plugin.Plugin):
     """
     osd plugin.
 
@@ -64,8 +64,8 @@
         """
         init the osd
         """
-        plugin.DaemonPlugin.__init__(self)
-        self.events = [ 'OSD_MESSAGE' ]
+        plugin.Plugin.__init__(self)
+        EventHandler(self.eventhandler).register([ 'OSD_MESSAGE' ])
         self.message = ''
         self.gui_object = None
         self.hide_timer = OneShotTimer(self.hide)

Modified: trunk/ui/src/plugins/ossmixer.py
==============================================================================
--- trunk/ui/src/plugins/ossmixer.py    (original)
+++ trunk/ui/src/plugins/ossmixer.py    Sun Oct 29 10:10:21 2006
@@ -84,12 +84,13 @@
 import plugin
 from event import *
 
+from kaa.notifier import EventHandler
 import ossaudiodev
 
 import logging
 log = logging.getLogger()
 
-class PluginInterface(plugin.DaemonPlugin):
+class PluginInterface(plugin.Plugin):
     SOUND_MIXER_LINE = 7
     SOUND_MASK_LINE = 64
     
@@ -107,7 +108,11 @@
                 log.error('Couldn\'t open mixer %s' % config.DEV_MIXER)
                 return
 
-        plugin.DaemonPlugin.__init__(self)
+        plugin.Plugin.__init__(self)
+
+        events = [MIXER_VOLUP, MIXER_VOLDOWN, MIXER_MUTE]
+        EventHandler(self.eventhandler).register(events)
+
         if 0:
             self.mainVolume   = 0
             self.pcmVolume    = 0

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to