예제 #1
0
class WeatherMSN:
	TIMER_INTERVAL = 1800
	def __init__(self):
		self.weatherData = MSNWeather()
		self.callbacks = [ ]
		self.callbacksAllIconsDownloaded = []
		self.timer = eTimer()
		self.timer_conn = self.timer.timeout.connect(self.getData)
	
	def getData(self):
		self.timer.stop()
		self.weatherData.getDefaultWeatherData(self.callback, self.callbackAllIconsDownloaded)
		self.timer.startLongTimer(self.TIMER_INTERVAL)
		
	def updateWeather(self, weather, result, errortext):
		if result == MSNWeather.OK:
			self.timer.stop()
			self.weatherData = weather
			self.weatherData.callback = None
			self.weatherData.callbackShowIcon = None
			self.weatherData.callbackAllIconsDownloaded = None
			self.callback(result, errortext)
			self.callbackAllIconsDownloaded()
			self.timer.startLongTimer(self.TIMER_INTERVAL)

	def callbackAllIconsDownloaded(self):
		for x in self.callbacksAllIconsDownloaded:
			x()

	def callback(self, result, errortext):
		for x in self.callbacks:
			x(result, errortext)
예제 #2
0
class WeatherMSN:
    TIMER_INTERVAL = 1800

    def __init__(self):
        self.weatherData = MSNWeather()
        self.callbacks = []
        self.callbacksAllIconsDownloaded = []
        self.timer = eTimer()
        self.timer.callback.append(self.getData)

    def getData(self):
        self.timer.stop()
        self.weatherData.getDefaultWeatherData(self.callback,
                                               self.callbackAllIconsDownloaded)
        self.timer.startLongTimer(self.TIMER_INTERVAL)

    def updateWeather(self, weather, result, errortext):
        if result == MSNWeather.OK:
            self.timer.stop()
            self.weatherData = weather
            self.weatherData.callback = None
            self.weatherData.callbackShowIcon = None
            self.weatherData.callbackAllIconsDownloaded = None
            self.callback(result, errortext)
            self.callbackAllIconsDownloaded()
            self.timer.startLongTimer(self.TIMER_INTERVAL)
        return

    def callbackAllIconsDownloaded(self):
        for x in self.callbacksAllIconsDownloaded:
            x()

    def callback(self, result, errortext):
        for x in self.callbacks:
            x(result, errortext)
예제 #3
0
 def __init__(self):
     self.weatherData = MSNWeather()
     self.callbacks = []
     self.callbacksAllIconsDownloaded = []
     self.timer = eTimer()
     self.timer.callback.append(self.getData)
     self.sleepTime = 0.01
예제 #4
0
	def __init__(self):
		self.weatherData = MSNWeather()
		self.callbacks = [ ]
		self.callbacksAllIconsDownloaded = []
		self.timer = eTimer()
		self.timer_conn = self.timer.timeout.connect(self.getData)
예제 #5
0
	def __init__(self):
		self.weatherData = MSNWeather()
		self.callbacks = [ ]
		self.callbacksAllIconsDownloaded = []
		self.timer = eTimer()
		self.timer.callback.append(self.getData)