def checkWeather(self):
     wi = WeatherInfo()
     wi.parse(self._location)
     
     newWeather = Weather()
     newWeather.extractData(wi,self._unit)
     self._weather = newWeather 
   
     self.update()
Beispiel #2
0
    def checkWeather(self):
        wi = WeatherInfo()
        mapper = ConditionMapper()
        wi.parse()
        weather = Weather()
        weather.extractData(wi, self._unit)

        self.lb_location.setText("Location: " + weather.location)

        self.lb_temperature.setText(weather.current_temperature)
        self.lb_condition.setText("Condition: " + weather.current_condition)
        self.lb_humidity.setText(weather.current_humidity)
        self.lb_wind.setText(weather.current_wind)

        # current condition image
        self.svg_current.setImagePath(self._image_prefix + mapper.getMappedImageName(weather.current_condition))
        self.svg_current.resize(self._big_img_width, self._big_img_height)
        self.svg_w_current.setSvg(self.svg_current)

        # load forecast days
        fc_day = weather.fc_dl[0]
        # self.lb_day_fc1.setText("Tomorrow")
        self.lb_day_fc1.setText(fc_day)

        fc_day = weather.fc_dl[1]
        self.lb_day_fc2.setText(fc_day)

        fc_day = weather.fc_dl[2]
        self.lb_day_fc3.setText(fc_day)

        # load forecast images
        fc = weather.fc_conditions[0]
        print fc
        self.svg_fc1.setImagePath(self._image_prefix + mapper.getMappedImageName(fc))
        self.svg_fc1.resize(self._img_width, self._img_height)
        self.svg_w_fc1.setSvg(self.svg_fc1)

        fc = weather.fc_conditions[1]
        print fc
        self.svg_fc2.setImagePath(self._image_prefix + mapper.getMappedImageName(fc))
        self.svg_fc2.resize(self._img_width, self._img_height)
        self.svg_w_fc2.setSvg(self.svg_fc2)

        fc = weather.fc_conditions[2]
        print fc
        self.svg_fc3.setImagePath(self._image_prefix + mapper.getMappedImageName(fc))
        self.svg_fc3.resize(self._img_width, self._img_height)
        self.svg_w_fc3.setSvg(self.svg_fc3)

        self.lb_temp_fc1.setText(weather.fc_low_high[0])
        self.lb_temp_fc2.setText(weather.fc_low_high[1])
        self.lb_temp_fc3.setText(weather.fc_low_high[2])

        # self.layout.addItem(label)
        # self.setLayout(self.layout)
        self.update()
#!/usr/bin/env python
 
from weatherInfo import WeatherInfo
from weather import Weather
 
wi = WeatherInfo()
wi.parse()
 
weather = Weather()
weather.extractData(wi,"SI")
weather.show()
#!/usr/bin/env python
 
from weatherInfo import WeatherInfo
from weather import Weather
 
wi = WeatherInfo()
wi.parse("Munich,Germany")
 
weather = Weather()
#weather.extractData(wi,"Metric")
weather.extractData(wi,"Imperial")
weather.show()