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

Modified Files:
        __init__.py 
Log Message:
Merge of the new version of the pymetar library from upstream.

Changes:
    * (to upstream) Added back timeoutsocket code which upstream doesn't use,
        and removed some print statements
    * We now use the pymetar Fahrenheit function instead of doing it in the idle
        bar; it was already being calculated by pymetar anyway.
    * When we don't have a temperature, use '?' instead of '0' which is misleading
        since it's Winter now :) 
    * minor cleanups




Index: __init__.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/plugins/idlebar/__init__.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** __init__.py 15 Nov 2003 17:22:48 -0000      1.3
--- __init__.py 22 Nov 2003 21:06:41 -0000      1.4
***************
*** 19,22 ****
--- 19,34 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.4  2003/11/22 21:06:41  outlyer
+ # Merge of the new version of the pymetar library from upstream.
+ #
+ # Changes:
+ #     * (to upstream) Added back timeoutsocket code which upstream doesn't use,
+ #         and removed some print statements
+ #     * We now use the pymetar Fahrenheit function instead of doing it in the idle
+ #         bar; it was already being calculated by pymetar anyway.
+ #     * When we don't have a temperature, use '?' instead of '0' which is misleading
+ #         since it's Winter now :)
+ #     * minor cleanups
+ #
  # Revision 1.3  2003/11/15 17:22:48  dischi
  # format patch from Davin Sagnol
***************
*** 323,343 ****
          if (os.path.isfile(self.WEATHERCACHE) == 0 or \
              (abs(time.time() - os.path.getmtime(self.WEATHERCACHE)) > 3600)):
-             weather = pymetar.MetarReport()
              try:
!                 weather.fetchMetarReport(self.METARCODE)
!                 if (weather.getTemperatureCelsius()):
                      if self.TEMPUNITS == 'F':
!                         ctemp = weather.getTemperatureCelsius()
!                         ftemp = ((ctemp + 40) * 9 / 5) - 40
!                         temperature = '%2d' % ftemp
                      elif self.TEMPUNITS == 'K':
!                         ktemp = weather.getTemperatureCelsius() + 273
                          temperature = '%3d' % ktemp
                      else:
!                         temperature = '%2d' % weather.getTemperatureCelsius()
                  else:
!                     temperature = '0'  # Make it a string to match above.
!                 if weather.getPixmap():
!                     icon = weather.getPixmap() + '.png'
                  else:
                      icon = 'sun.png'
--- 335,355 ----
          if (os.path.isfile(self.WEATHERCACHE) == 0 or \
              (abs(time.time() - os.path.getmtime(self.WEATHERCACHE)) > 3600)):
              try:
!                 rf=pymetar.ReportFetcher(self.METARCODE)
!                 rep=rf.FetchReport()
!                 rp=pymetar.ReportParser()
!                 pr=rp.ParseReport(rep)
!                 if (pr.getTemperatureCelsius()):
                      if self.TEMPUNITS == 'F':
!                         temperature = '%2d' % pr.getTemperatureFahrenheit()
                      elif self.TEMPUNITS == 'K':
!                         ktemp = pr.getTemperatureCelsius() + 273
                          temperature = '%3d' % ktemp
                      else:
!                         temperature = '%2d' % pr.getTemperatureCelsius()
                  else:
!                     temperature = '?'  # Make it a string to match above.
!                 if pr.getPixmap():
!                     icon = pr.getPixmap() + '.png'
                  else:
                      icon = 'sun.png'
***************
*** 347,352 ****
                  cachefile.close()
              except:
-                 # HTTP Problems, use cache. Wait till next try.
                  try:
                      cachefile = open(self.WEATHERCACHE,'r')
                      newlist = map(string.rstrip, cachefile.readlines())
--- 359,364 ----
                  cachefile.close()
              except:
                  try:
+                     # HTTP Problems, use cache. Wait till next try.
                      cachefile = open(self.WEATHERCACHE,'r')
                      newlist = map(string.rstrip, cachefile.readlines())
***************
*** 357,361 ****
                      try:
                          cachefile = open(self.WEATHERCACHE,'w+')
!                         cachefile.write('0' + '\n')
                          cachefile.write('sun.png' + '\n')
                          cachefile.close()
--- 369,373 ----
                      try:
                          cachefile = open(self.WEATHERCACHE,'w+')
!                         cachefile.write('?' + '\n')
                          cachefile.write('sun.png' + '\n')
                          cachefile.close()
***************
*** 363,366 ****
--- 375,379 ----
                          print 'You have no permission to write %s' % 
self.WEATHERCACHE
                      return '0', 'sun.png'
+ 
  
          else:




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to