Update of /cvsroot/freevo/freevo/src/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv8884/src/plugins

Modified Files:
        lcd.py 
Log Message:
Added some clauses to avoid exceptions.


Index: lcd.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/plugins/lcd.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** lcd.py      4 Aug 2003 04:08:10 -0000       1.3
--- lcd.py      4 Aug 2003 20:30:33 -0000       1.4
***************
*** 14,17 ****
--- 14,20 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.4  2003/08/04 20:30:33  gsbarbieri
+ # Added some clauses to avoid exceptions.
+ #
  # Revision 1.3  2003/08/04 04:08:10  gsbarbieri
  # Now you can have screens for Lines x Columns, before we could just have screens 
for Lines.
***************
*** 348,353 ****
          """
          plugin.DaemonPlugin.__init__( self )
!         self.lcd = pylcd.client()
!         cm = self.lcd.connect()
          if DEBUG > 0:
              print "Connecting to LCD: %s" % cm
--- 351,363 ----
          """
          plugin.DaemonPlugin.__init__( self )
!         try:
!             self.lcd = pylcd.client()
!             cm = self.lcd.connect()
!         except:
!             print "ERROR: LCD plugin will not load! " + \
!                   "Maybe you don't have LCDd (lcdproc daemon) running?"
!             self.disable = 1
!             return
!         
          if DEBUG > 0:
              print "Connecting to LCD: %s" % cm
***************
*** 368,372 ****
              type, param, val = self.screens[ "welcome" ][ w ]            
              if val: param = param % eval( val )
!             self.lcd.widget_set( "welcome", w, param )
          self.lcd.screen_set( "welcome", "-priority 192 -duration 2 -heartbeat off" )
          self.last_screen = "welcome"
--- 378,387 ----
              type, param, val = self.screens[ "welcome" ][ w ]            
              if val: param = param % eval( val )
! 
!             try:
!                 self.lcd.widget_set( "welcome", w, param.encode( 'latin1' ) )
!             except UnicodeError:
!                 self.lcd.widget_set( "welcome", w, param )
!                 
          self.lcd.screen_set( "welcome", "-priority 192 -duration 2 -heartbeat off" )
          self.last_screen = "welcome"
***************
*** 437,443 ****
              t, param, val = s[ w ]
              try:
-                 #print "param=%s \tval=%s" % ( param, val )
                  if val: param = param % eval( val )
-                 #print "   -> %s" % param
              except:
                  pass
--- 452,456 ----
***************
*** 453,464 ****
                  self.lcd.widget_set( sname, w, param.encode( 'latin1' ) )
              except UnicodeError:
-                 # Comment from Magnus:
-                 # With param.encode python crashes with:
-                 # File "src/plugins/lcd.py", line 364, in draw
-                 #    self.lcd.widget_set( sname, w, param.encode( 'latin1' ) )
-                 # UnicodeError: ASCII decoding error: ordinal not in range(128)
-                 # when a file contains a german encoding for an umlaut, eg 'oe',
-                 # which is then converted to '�', however without the param.encode
-                 # the umlaut gets still magically converted ?!
                  self.lcd.widget_set( sname, w, param )
  
--- 466,469 ----
***************
*** 484,488 ****
                  
                  if val: param = param % eval( val )
!                 self.lcd.widget_set( s, w, param )
          
  
--- 489,496 ----
                  
                  if val: param = param % eval( val )
!                 try:
!                     self.lcd.widget_set( s, w, param.encode( 'latin1' ) )
!                 except UnicodeError:
!                     self.lcd.widget_set( s, w, param )
          
  




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to