Code review comment for lp:~samuel-buffet/entertainer/bug_379824

Revision history for this message
Samuel Buffet (samuel-buffet) wrote :

Matt,

Branch updated an pushed.

incremental diff :

=== modified file 'entertainerlib/frontend/gui/screens/weather.py'
--- entertainerlib/frontend/gui/screens/weather.py 2009-05-09 17:03:51 +0000
+++ entertainerlib/frontend/gui/screens/weather.py 2009-05-25 16:43:06 +0000
@@ -20,11 +20,11 @@
         screen_title = Label(0.13, "screentitle", 0, 0.87, _("Weather"))
         self.add(screen_title)

- if (self.weather.get_location() == ''):
+ if (self.weather.location == ''):
             self.add(Label(0.04167, "text", 0.30, 0.20,
                 _("No weather location defined!"), font_weight="bold"))
         else:
- location_text = self.weather.get_location()
+ location_text = self.weather.location

             location = Label(0.04167, "text", 0.40, 0.13, location_text,
                 font_weight="bold")

=== modified file 'entertainerlib/tests/test_weather.py'
--- entertainerlib/tests/test_weather.py 2009-05-23 21:08:16 +0000
+++ entertainerlib/tests/test_weather.py 2009-05-25 16:46:12 +0000
@@ -74,7 +74,7 @@
                     return ZERO
         england = EnglandTimeZone()

- self.weather.set_location('Bath,England')
+ self.weather.location = 'Bath,England'
         self.weather.refresh()
         forecasts = self.weather.get_forecasts()
         today = forecasts[0]
@@ -93,57 +93,52 @@
         self.assertEqual(today["High"], 20)
         self.assertEqual(today["Condition"],"Sunny")

- def testWeatherSetLocation(self):
- """Tests the location setting of the weather module"""
- self.weather.set_location('Bradford,England')
- self.assertEqual(self.weather.get_location(), 'Bradford,England')
-
     def testWeatherLocationLatinEncoding(self):
         """Tests whether code can handle Latin-1 encoding back from google"""
         #Check for Montreal which gets info back from google in Latin-1
- self.weather.set_location("Montreal")
+ self.weather.location = "Montreal"
         self.weather.refresh()
         results = self.weather.get_forecasts()
         #if there are results then it's working
         self.assertTrue(len(results) > 0)

     def test_yuma_conditions(self):
- """Tests that there's no 'weather-na' in Yuma"""
+ """Tests that there's no 'weather-na' in Yuma."""
         # Here we expect sun http://en.wikipedia.org/wiki/Yuma,_Arizona.
         # `Yuma is the sunniest place on earth` (90% of the time)
- self.weather.set_location("Yuma")
+ self.weather.location = "Yuma"
         self.weather.refresh()
         forecasts = self.weather.get_forecasts()
         for day in forecasts:
             self.assertFalse(day["Image"] == 'weather-na')

     def test_london_conditions(self):
- """Tests that there's no 'weather-na' in London"""
- self.weather.set_location("London")
+ """Tests that there's no 'weather-na' in London."""
+ self.weather.location = "London"
         self.weather.refresh()
         forecasts = self.weather.get_forecasts()
         for day in forecasts:
             self.assertFalse(day["Image"] == 'weather-na')

     def test_perth_conditions(self):
- """Tests that there's no 'weather-na' in Perth"""
- self.weather.set_location("Perth")
+ """Tests that there's no 'weather-na' in Perth."""
+ self.weather.location = "Perth"
         self.weather.refresh()
         forecasts = self.weather.get_forecasts()
         for day in forecasts:
             self.assertFalse(day["Image"] == 'weather-na')

     def test_nyc_conditions(self):
- """Tests that there's no 'weather-na' in New York"""
- self.weather.set_location("New York")
+ """Tests that there's no 'weather-na' in New York."""
+ self.weather.location = "New York"
         self.weather.refresh()
         forecasts = self.weather.get_forecasts()
         for day in forecasts:
             self.assertFalse(day["Image"] == 'weather-na')

     def test_north_pole_conditions(self):
- """Tests that there's no 'weather-na' in North Pole"""
- self.weather.set_location("North Pole")
+ """Tests that there's no 'weather-na' in North Pole."""
+ self.weather.location = "North Pole"
         self.weather.refresh()
         forecasts = self.weather.get_forecasts()
         for day in forecasts:

=== modified file 'entertainerlib/utils/content_management_dialog.py'
--- entertainerlib/utils/content_management_dialog.py 2009-05-06 02:58:08 +0000
+++ entertainerlib/utils/content_management_dialog.py 2009-05-25 16:54:32 +0000
@@ -484,7 +484,7 @@
         model = result_list.get_model()
         model.clear()
         if search_term != "":
- self.weather.set_location(search_term)
+ self.weather.location = search_term
             self.weather.refresh()
             results = self.weather.get_forecasts()
             if len(results) > 0:

=== modified file 'entertainerlib/utils/weather.py'
--- entertainerlib/utils/weather.py 2009-05-23 21:08:16 +0000
+++ entertainerlib/utils/weather.py 2009-05-25 16:41:29 +0000
@@ -32,10 +32,9 @@
     """

     def __init__(self, location=""):
- self._location = ''
+ self.location = location
         self._forecasts = []
         self.theme = Configuration().theme
- self.set_location(location)
         self.locale = self._get_locale()
         self.refresh()

@@ -116,14 +115,6 @@

         return self._forecasts

- def set_location(self, location):
- """Sets the current location."""
- self._location = location
-
- def get_location(self):
- """Gets the current location."""
- return self._location
-
     def clear_forecasts(self):
         """Resets the forecast array."""
         self._forecasts = []
@@ -149,7 +140,7 @@

     def refresh(self):
         """Clear current weather and forecasts and then loads new data."""
- if (self._location):
+ if self.location:
             self.clear_forecasts()
- self.find_forecast(self._location)
+ self.find_forecast(self.location)

Samuel-

« Back to merge proposal