diff -Nru my-weather-indicator-0.7.11/debian/changelog my-weather-indicator-0.7.11/debian/changelog --- my-weather-indicator-0.7.11/debian/changelog 2016-04-18 21:41:12.000000000 +0000 +++ my-weather-indicator-0.7.11/debian/changelog 2016-04-20 20:22:40.000000000 +0000 @@ -1,10 +1,10 @@ -my-weather-indicator (0.7.11-0extras15.10.1) wily; urgency=medium +my-weather-indicator (0.7.11-0extras15.10.2) wily; urgency=medium * Fixed Weather Underground * Fixed Weather World Online * Removed tries in Yahoo and in OpenWeatherMap - -- Lorenzo Carbonell Mon, 18 Apr 2016 23:41:07 +0200 + -- Lorenzo Carbonell Wed, 20 Apr 2016 22:22:31 +0200 my-weather-indicator (0.7.10-0extras15.10.1) wily; urgency=medium diff -Nru my-weather-indicator-0.7.11/src/myweatherindicator.py my-weather-indicator-0.7.11/src/myweatherindicator.py --- my-weather-indicator-0.7.11/src/myweatherindicator.py 2016-04-18 20:59:23.000000000 +0000 +++ my-weather-indicator-0.7.11/src/myweatherindicator.py 2016-04-20 20:20:23.000000000 +0000 @@ -99,6 +99,7 @@ self.weathers = [] self.current_conditions = [] self.preferences = [] + self.last_update_time = 0 # Iniciate variables for i in range(INDICATORS): self.menus.append(None) @@ -121,27 +122,19 @@ for i in range(INDICATORS): self.create_menu(i) # - ''' - while internet_on() == False: - print('Waiting for internet') - time_start = time.time() - time_end = (time_start + 1) - while time_end > time.time(): - while Gtk.events_pending(): - Gtk.main_iteration() - time.sleep(0.3) - ''' - if not os.path.exists(comun.CONFIG_FILE) and internet_on(): - configuration = Configuration() - configuration.reset() - latitude, longitude = ipaddress.get_current_location() - city = geocodeapi.get_inv_direction(latitude, longitude)['city'] - if city is None: - city = '' - configuration.set('latitude', latitude) - configuration.set('longitude', longitude) - configuration.set('location', city) - configuration.save() + if not os.path.exists(comun.CONFIG_FILE): + if internet_on(): + configuration = Configuration() + configuration.reset() + latitude, longitude = ipaddress.get_current_location() + city = geocodeapi.get_inv_direction( + latitude, longitude)['city'] + if city is None: + city = '' + configuration.set('latitude', latitude) + configuration.set('longitude', longitude) + configuration.set('location', city) + configuration.save() cm = preferences.CM() if cm.run() == Gtk.ResponseType.ACCEPT: cm.save_preferences() @@ -578,6 +571,7 @@ def update_menu(self, index): if not internet_on(): + print('--- Not internet connection ---') if self.icon_light: icon = os.path.join( comun.ICONDIR, @@ -785,6 +779,7 @@ while Gtk.events_pending(): Gtk.main_iteration() print('--- End of updating data in location %s ---' % (index)) + self.last_update_time = time.time() def menu_offon(self, ison): for i in range(INDICATORS): @@ -839,7 +834,8 @@ self.menu_offon(True) def menu_refresh_weather_response(self, widget, index): - self.work() + if self.last_update_time + 600 < time.time(): + self.start_weather_updater() def menu_exit_response(self, widget): exit(0)