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

Modified Files:
        idlebar.py 
Log Message:
patches from Magus Schmidt

Index: idlebar.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/plugins/idlebar.py,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** idlebar.py  1 Oct 2003 19:02:09 -0000       1.42
--- idlebar.py  14 Oct 2003 18:11:22 -0000      1.43
***************
*** 6,45 ****
  # $Id$
  #
! # Notes:
! #   To activate the idle bar, put the following in your local_conf.py. The
! #   plugins inside the idlebar are sorted based on the level (except the
! #   clock, it's always on the right side)
! #
! #   plugin.activate('idlebar')
! #   
! #   plugin.activate('idlebar.mail',    level=10, args=('/var/spool/mail/dmeyer', ))
! #
! #   plugin.activate('idlebar.tv',      level=20, args=(listings_threshold, ))
! #     listings_threshold must be a number in hours.  For example if you put
! #     args=(12, ) then 12 hours befor your xmltv listings run out the tv icon
! #     will present a warning.  Once your xmltv data is expired it will present
! #     a more severe warning.  If no args are given then no warnings will be
! #     given.
! #
! #   plugin.activate('idlebar.weather', level=30, args=('4-letter code', ))
! #     For weather station codes see: http://www.nws.noaa.gov/tg/siteloc.shtml
! #     You can also set the unit as second parameter in args ('C', 'F', or 'K')
! #
! #   plugin.activate('idlebar.sensors', level=40, args=('cpusensor', 'casesensor', 
'meminfo'))
! #     cpu and case sensor are the corresponding lm_sensors : this should be
! #     temp1, temp2 or temp3. defaults to temp3 for cpu and temp2 for case
! #     meminfo is the memory info u want, types ar the same as in /proc/meminfo :
! #     MemTotal -> SwapFree.
! #     casesensor and meminfo can be set to None if u don't want them
! #     This requires a properly configure lm_sensors! If the standard sensors frontend
! #     delivered with lm_sensors works your OK.
! #   
! #   plugin.activate('idlebar.clock',   level=50)
! #   plugin.activate('idlebar.cdstatus', level=30)
! #   plugin.activate('idlebar.clock',    level=50)
! #   
  #
  # -----------------------------------------------------------------------
  # $Log$
  # Revision 1.42  2003/10/01 19:02:09  dischi
  # add cpu usage patch from Viggo Fredriksen
--- 6,27 ----
  # $Id$
  #
! # Documentation moved to the corresponding classes, so that the help
! # interface returns something usefull.
! # Available plugins:
! #       idlebar
! #       idlebar.clock
! #       idlebar.cdstatus
! #       idlebar.mail
! #       idlebar.tv
! #       idlebar.weather
! #       idlebar.holidays
! #       idlebar.procstats
! #       idlebar.sensors
  #
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.43  2003/10/14 18:11:22  dischi
+ # patches from Magus Schmidt
+ #
  # Revision 1.42  2003/10/01 19:02:09  dischi
  # add cpu usage patch from Viggo Fredriksen
***************
*** 82,85 ****
--- 64,68 ----
  import sys
  import string
+ import types
  import mailbox
  import skin
***************
*** 139,143 ****
  class IdleBarPlugin(plugin.Plugin):
      """
!     parent for all idlebar plugins
      """
      def __init__(self):
--- 122,131 ----
  class IdleBarPlugin(plugin.Plugin):
      """
!     To activate the idle bar, put the following in your local_conf.py:
!         plugin.activate('idlebar')
!     You can then add various plugins. Plugins inside the idlebar are 
!     sorted based on the level (except the clock, it's always on the 
!     right side). Use "freevo plugins -l" to see all available plugins,
!     and "freevo plugins -i idlebar.<plugin>" for a specific plugin.
      """
      def __init__(self):
***************
*** 151,155 ****
  class clock(IdleBarPlugin):
      """
!     show the current time
      """
      def __init__(self, format='%a %I:%M %P'):
--- 139,148 ----
  class clock(IdleBarPlugin):
      """
!     Shows the current time.
! 
!     Activate with:
!     plugin.activate('idlebar.clock',   level=50)
!     Note: The clock will always be displayed on the right side of
!     the idlebar.
      """
      def __init__(self, format='%a %I:%M %P'):
***************
*** 176,180 ****
  class cdstatus(IdleBarPlugin):
      """
!     show the status of all rom drives
      """
      def __init__(self):
--- 169,176 ----
  class cdstatus(IdleBarPlugin):
      """
!     Show the status of all rom drives.
! 
!     Activate with:
!     plugin.activate('idlebar.cdstatus')
      """
      def __init__(self):
***************
*** 210,214 ****
  class mail(IdleBarPlugin):
      """
!     show if new mail is in the mailbox
      """
      def __init__(self, mailbox):
--- 206,214 ----
  class mail(IdleBarPlugin):
      """
!     Shows if new mail is in the mailbox.
!     
!     Activate with:
!     plugin.activate('idlebar.mail',    level=10, args=('path to mailbox', ))
!     
      """
      def __init__(self, mailbox):
***************
*** 243,247 ****
  class tv(IdleBarPlugin):
      """
!     show if the tv is locked or not
      """
      def __init__(self, listings_threshold=-1):
--- 243,255 ----
  class tv(IdleBarPlugin):
      """
!     Informs you, when the xmltv-listings expires.
! 
!     Activate with:
!     plugin.activate('idlebar.tv', level=20, args=(listings_threshold,))
!     listings_threshold must be a number in hours.  For example if you put
!     args=(12, ) then 12 hours befor your xmltv listings run out the tv icon
!     will present a warning.  Once your xmltv data is expired it will present
!     a more severe warning.  If no args are given then no warnings will be
!     given.
      """
      def __init__(self, listings_threshold=-1):
***************
*** 289,293 ****
  class weather(IdleBarPlugin):
      """
!     show the current weather
      """
      def __init__(self, zone='CYYZ', units='C'):
--- 297,307 ----
  class weather(IdleBarPlugin):
      """
!     Shows the current weather.
! 
!     Activate with:
!     plugin.activate('idlebar.weather', level=30, args=('4-letter code', ))
! 
!     For weather station codes see: http://www.nws.noaa.gov/tg/siteloc.shtml
!     You can also set the unit as second parameter in args ('C', 'F', or 'K')
      """
      def __init__(self, zone='CYYZ', units='C'):
***************
*** 518,522 ****
  class sensors(IdleBarPlugin):
      """
!     read lm_sensors data for cpu temperature
      """
      class sensor:
--- 532,556 ----
  class sensors(IdleBarPlugin):
      """
!     Displays sensor temperature information (cpu,case) and memory-stats.
! 
!     Activate with:
!        plugin.activate('idlebar.sensors', level=40, args=('cpusensor', 'casesensor', 
'meminfo'))
!        plugin.activate('idlebar.sensors', level=40, args=(('cpusensor','compute 
expression'), 
!                                                           
('casesensor','compute_expression'),
!                                                           'meminfo'))
!     cpu and case sensor are the corresponding lm_sensors : this should be
!     temp1, temp2 or temp3. defaults to temp3 for cpu and temp2 for case
!     meminfo is the memory info u want, types ar the same as in /proc/meminfo :
!     MemTotal -> SwapFree.
!     casesensor and meminfo can be set to None if u don't want them
!     This requires a properly configure lm_sensors! If the standard sensors frontend
!     delivered with lm_sensors works your OK.
!     Some sensors return raw-values, which have to be computed in order 
!     to get correct values. This is normally stored in your /etc/sensors.conf.
!     Search in the corresponding section for your chipset, and search the 
!     compute statement, e.g. "compute temp3 @*2, @/2". Only the third
!     argument is of interest. Insert this into the plugin activation line, e.g.: 
!     "[...] args=(('temp3','@*2'),[...]". The @ stands for the raw value.
!     The compute expression  works for the cpu- and casesensor.
      """
      class sensor:
***************
*** 524,535 ****
          small class defining a temperature sensor
          """
!         def __init__(self, sensor, hotstack):
              self.initpath = "/proc/sys/dev/sensors/"
              self.senspath = self.getSensorPath()
              self.sensor = sensor
              self.hotstack = hotstack
              self.washot = False
              
          def temp(self):
              if self.senspath == -1 or not self.senspath:
                  return "?"        
--- 558,578 ----
          small class defining a temperature sensor
          """
!         def __init__(self, sensor, compute_expression, hotstack):
              self.initpath = "/proc/sys/dev/sensors/"
              self.senspath = self.getSensorPath()
              self.sensor = sensor
+             self.compute_expression = compute_expression
              self.hotstack = hotstack
              self.washot = False
              
          def temp(self):
+             def temp_compute (rawvalue):
+                 try:
+                     temperature = eval(self.compute_expression.replace 
("@",str(rawvalue)))
+                 except:
+                     print "ERROR in idlebar.sensors: Compute expression does not 
evaluate"
+                     temperature = rawvalue
+                 return int(temperature)
+ 
              if self.senspath == -1 or not self.senspath:
                  return "?"        
***************
*** 540,550 ****
              f.close()
              
!             temp = int(float(string.split(data)[2]))
!             hot = int(float(string.split(data)[0]))
              if temp > hot:
                  if self.washot == False:
                      self.hotstack = self.hotstack + 1
                      self.washot == True
-                     print temp
              else:
                  if self.washot == True:
--- 583,592 ----
              f.close()
              
!             temp = int(temp_compute (float(string.split(data)[2])))
!             hot = int(temp_compute (float(string.split(data)[0])))
              if temp > hot:
                  if self.washot == False:
                      self.hotstack = self.hotstack + 1
                      self.washot == True
              else:
                  if self.washot == True:
***************
*** 576,582 ****
          self.case = None
      
!         self.cpu = self.sensor(cpu, self.hotstack)
          if case: 
!             self.case = self.sensor(case, self.hotstack)
  
          self.ram = ram
--- 618,632 ----
          self.case = None
      
!         if isinstance (cpu,types.StringType):
!             self.cpu = self.sensor(cpu, '@', self.hotstack)
!         else:
!             self.cpu = self.sensor(cpu[0], cpu[1], self.hotstack)
!     
          if case: 
!             if isinstance (case,types.StringType):
!                 self.cpu = self.sensor(case, '@', self.hotstack)
!             else:
!                 self.cpu = self.sensor(case[0], case[1], self.hotstack)
! 
  
          self.ram = ram




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to