Author: duncan
Date: Sun Feb 18 08:47:52 2007
New Revision: 9225

Modified:
   branches/rel-1/freevo/src/plugins/tiny_xosd.py

Log:
[ 1662693 ] Xods doesn't always map 100% to freevo's osd
Patch from Frank Naude applied


Modified: branches/rel-1/freevo/src/plugins/tiny_xosd.py
==============================================================================
--- branches/rel-1/freevo/src/plugins/tiny_xosd.py      (original)
+++ branches/rel-1/freevo/src/plugins/tiny_xosd.py      Sun Feb 18 08:47:52 2007
@@ -33,7 +33,7 @@
 Plugin for PyOSDd which facilitates controling Freevo
 """
 
-import time, re, string, pyosd
+import time, re, string, pyosd, config
 
 import config, plugin
 from event import *
@@ -45,7 +45,7 @@
 OSD_MESSAGE_OFFSET  = 20 + config.OSD_OVERSCAN_Y  # Offset of 20 pixels
 
 # Labels which are displayed with percent
-PERCENT = [ 'Volume', 
+PERCENT = [ 'Volume',
             'Volume - unmuted',
             'Bass',
             'Treble',
@@ -84,10 +84,10 @@
     the screen for 3 seconds.
     This is a replacement for tiny_osd which works with PyOSD (XOsd)
 
-    activate with :
+    activate with:
     plugin.remove('tiny_osd')
     plugin.activate('tiny_xosd')
-    
+
     """
     def __init__(self):
         """
@@ -112,40 +112,46 @@
         Display a message on the screen.
         """
 
-        if not self.message == '' :
+        if not self.message == '':
             re_percent = self.re_percent.search(self.message)
 
-            if re_percent :
+            if re_percent:
                 # A percentage was sent
                 label   = self.message[0:re_percent.start() - 1]
                 percent = int(self.message[re_percent.start() + 
1:re_percent.end() - 1])
 
-                if label in SLIDER :
+                if label in SLIDER:
                     type = pyosd.TYPE_SLIDER
-                else :
+                else:
                     type = pyosd.TYPE_PERCENT
-                
-                if percent < 0 :
+
+                if percent < 0:
                     percent = 0
-                elif percent > 100 :
+                elif percent > 100:
                     percent = 100
 
                 # Display it on the bottom of the screen
-                self.osd.set_pos(pyosd.POS_BOT)
+                if config.START_FULLSCREEN_X == 1:
+                    # Map xosd to Freevo osd
+                    self.osd.set_pos(pyosd.POS_TOP)
+                    self.osd.set_offset(config.CONF.height - 
3*config.OSD_DEFAULT_FONTSIZE - config.OSD_OVERSCAN_Y)
+                else:
+                    self.osd.set_pos(pyosd.POS_BOT)
+
                 # First line is the label with the value
                 self.osd.display('%s (%d%%)' % (_(label), percent), 
pyosd.TYPE_STRING, line=0)
                 # Second line is the progress bar
                 self.osd.display(percent, type, line=1)
 
-            else :
+            else:
                 # This is text, display it on top
                 self.osd.set_pos(pyosd.POS_TOP)
-                if re.search('\n', self.message) :
+                if re.search('\n', self.message):
                     # If message contains one or more \n, display two first 
lines.
                     s_msg = self.message.split('\n')
                     self.osd.display(s_msg[0], pyosd.TYPE_STRING, line=0)
                     self.osd.display(s_msg[1], pyosd.TYPE_STRING, line=1)
-                else :
+                else:
                     # If not, display only the first line
                     self.osd.display(self.message, pyosd.TYPE_STRING, line=0)
                     self.osd.display('', pyosd.TYPE_STRING, line=1)
@@ -156,7 +162,7 @@
         """
 
         _debug_('%s: %s app got %s event' % (time.time(), self.plugin_name, 
event))
-        if event == OSD_MESSAGE :
+        if event == OSD_MESSAGE:
             self.poll_counter = 1
             self.message = event.arg
             self.draw_osd()

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to