~conky-companions/+junk/conkyforecast

« back to all changes in this revision

Viewing changes to conkyForecast.py

  • Committer: Mark Buck (Kaivalagi)
  • Date: 2009-03-14 14:28:48 UTC
  • Revision ID: m_buck@hotmail.com-20090314142848-sh6xvdr9uldlnkkw
translation updates and made CT behave like CC

Show diffs side-by-side

added added

removed removed

Lines of Context:
126
126
#    16/11/2008    Updated translation code to fallback to english if no translation found for locale requested
127
127
#    17/11/2008    Added unused text arrays to aid the translation process, all translatable text will now be picked up by pygettext - thanks foppeh
128
128
#    06/01/2009    Refactored cache based location checking
 
129
#    04/03/2009    Made CT datatype behave like CC to make sure full translation occurs
 
130
#    06/03/2009    Fixed error handling in forecast plugin for maximum forecast threshold error reporting
129
131
import sys, os, socket, urllib2, gettext, locale, re, codecs
130
132
 
131
133
from optparse import OptionParser
981
983
            elif datatype == "CC":
982
984
                output = _(ForecastText.conditions_text[set.condition_code])
983
985
            elif datatype == "CT":
984
 
                output = _(set.condition_text)
 
986
                #output = _(set.condition_text)
 
987
                output = _(ForecastText.conditions_text[set.condition_code])
985
988
            elif datatype == "PC":
986
989
                if self.isNumeric(set.precip) == True:
987
990
                    string = set.precip + u"%"
1182
1185
                self.logError("--startday set beyond forecast limit, reset to minimum of 0")
1183
1186
            elif startday > self.MAX_DAY_NUMBER:
1184
1187
                startday = self.MAX_DAY_NUMBER
1185
 
                self.logError("--startday set beyond forecast limit, reset to maximum of " + self.MAX_DAY_NUMBER)
 
1188
                self.logError("--startday set beyond forecast limit, reset to maximum of " + str(self.MAX_DAY_NUMBER))
1186
1189
                
1187
1190
            if endday == None: # if no endday was set use startday
1188
1191
                endday = startday
1191
1194
                self.logError("--endday set beyond forecast limit, reset to minimum of 0")
1192
1195
            elif endday > self.MAX_DAY_NUMBER:
1193
1196
                endday = self.MAX_DAY_NUMBER
1194
 
                self.logError("--endday set beyond forecast limit, reset to maximum of " + self.MAX_DAY_NUMBER)
 
1197
                self.logError("--endday set beyond forecast limit, reset to maximum of " + str(self.MAX_DAY_NUMBER))
1195
1198
                
1196
1199
            for daynumber in range(startday, endday + 1):
1197
1200
                
1465
1468
 
1466
1469
    if options.version == True:
1467
1470
        
1468
 
        print >> sys.stdout,"conkyForecast v.2.03"
 
1471
        print >> sys.stdout,"conkyForecast v.2.04"
1469
1472
        
1470
1473
    else:
1471
1474