Author: dmeyer
Date: Sat May 12 08:31:01 2007
New Revision: 9564

Modified:
   trunk/ui/src/plugins/config.cxml
   trunk/ui/src/plugins/dpms.py

Log:
improvde dpms

Modified: trunk/ui/src/plugins/config.cxml
==============================================================================
--- trunk/ui/src/plugins/config.cxml    (original)
+++ trunk/ui/src/plugins/config.cxml    Sat May 12 08:31:01 2007
@@ -71,25 +71,33 @@
         <desc>
             This plugin turns off DPMS (Energy Star) and screen blanking when
             using Freevo with X. The program "xset" needs to be installed. On
-            Freevo shutdown the plugin turns on DPMS again.
-            The plugin defines an event called DPMS_BLANK_SCREEN which can be
-            used to turn off the monitor or tv and keep Freevo running. Every
-            key pressed after that will turn on the monitor again. The key
-            itself is also processed by Freevo, so e.g. pressing SELECT while
-            the screen is blank would result in SELECT being handled by
-            Freevo. The only exception is the DPMS_BLANK_SCREEN event itself.
-            The event can be mapped to any key, see the documentation about the
-            input selction itself. The following will send the event when
-            pressing 'b' on the keyboard or sending DPMS_BLANK_SCREEN from the
-            lircrc:
+            Freevo shutdown the plugin turns on DPMS again. The plugin defines
+            an event called DPMS_BLANK_SCREEN which can be used to turn off the
+            monitor or tv and keep Freevo running. The same event will turn on
+            the monitor again. The event can be mapped to any key, see the
+            documentation about the input selction itself. The following will
+            send the event when pressing 'b' on the keyboard or sending
+            DPMS_BLANK_SCREEN from the lircrc:
             input.keyboardmap[B] = DPMS_BLANK_SCREEN
             input.eventmap[global][DPMS_BLANK_SCREEN] = DPMS_BLANK_SCREEN
         </desc>
         <var name="timeout" default="0">
             <desc>
                 If timeout is greater zero the screen will blank after
-                timeout minutes when in Freevo shows the menu.
+                timeout minutes when in Freevo shows the menu. Every key
+                pressed later will turn on the monitor again. The key itself is
+                also processed by Freevo, so e.g. pressing SELECT while the
+                screen is blank would result in SELECT being handled by
+                Freevo. The only exception is the DPMS_BLANK_SCREEN event
+                itself.
             </desc>
+            <ui name="Monitor blanking" category="Video">
+                <option name="off" value="0"/>
+                <option name="10 min" value="600"/>
+                <option name="20 min" value="1200"/>
+                <option name="30 min" value="1800"/>
+                <option name="60 min" value="3600"/>
+            </ui>
         </var>
     </group>
 

Modified: trunk/ui/src/plugins/dpms.py
==============================================================================
--- trunk/ui/src/plugins/dpms.py        (original)
+++ trunk/ui/src/plugins/dpms.py        Sat May 12 08:31:01 2007
@@ -44,6 +44,8 @@
 from freevo.ui.event import Event, DPMS_BLANK_SCREEN
 from freevo.ui.application import signals as app_signals
 
+# blanking modes
+OFF, AUTO, USER = range(3)
 
 class PluginInterface(Plugin):
 
@@ -53,7 +55,7 @@
         # get xset process to call
         self.xset = kaa.notifier.Process(kaa.utils.which('xset')).start
         self.counter = 0
-        self.is_blank = False
+        self._mode = OFF
         # Timer to poll and increase counter. It willbe started when the
         # menu is shown.
         self.timer = kaa.notifier.Timer(self.poll)
@@ -74,7 +76,7 @@
         self.counter += 1
         if self.counter == config.plugin.dpms.timeout:
             # timeout, force dpms and turn off the monitor
-            self.is_blank = True
+            self._mode = AUTO
             self.xset('dpms force off')
             # stop poll timer
             self.timer.stop()
@@ -84,7 +86,7 @@
         """
         Callback on application changes.
         """
-        if app.get_name() == 'menu':
+        if app.get_name() == 'menu' and self._mode == OFF:
             # menu is shown, start timer
             self.timer.start(60)
             self.counter = 0
@@ -100,16 +102,17 @@
         if event.source == 'user':
             # user generated event (key/button), reset timeout counter
             self.counter = 0
-            if self.is_blank:
-                # screen is blank right now, restore it
-                self.is_blank = False
-                self.xset('dpms force on s reset')
-                kaa.notifier.OneShotTimer(self.xset, '-dpms s off').start(1)
-                self.timer.start(60)
-                return
+        if (event.source == 'user' and self._mode == AUTO) or \
+               (self._mode == USER and event == DPMS_BLANK_SCREEN):
+            # screen is blank right now, restore it
+            self._mode = OFF
+            self.xset('dpms force on s reset')
+            kaa.notifier.OneShotTimer(self.xset, '-dpms s off').start(1)
+            self.timer.start(60)
+            return
 
         if event == DPMS_BLANK_SCREEN:
             # event to turn off the monitor
-            self.is_blank = True
+            self._mode = USER
             self.xset('dpms force off')
             self.timer.stop()

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to