diff -Nru indicator-china-weather-2.2.4/debian/bzr-builder.manifest indicator-china-weather-2.2.6/debian/bzr-builder.manifest --- indicator-china-weather-2.2.4/debian/bzr-builder.manifest 2017-08-10 01:50:57.000000000 +0000 +++ indicator-china-weather-2.2.6/debian/bzr-builder.manifest 2018-03-01 01:24:37.000000000 +0000 @@ -1,2 +1,2 @@ -# bzr-builder format 0.3 deb-version {debupstream}-0~124 -lp:indicator-china-weather revid:lixiang@kylinos.cn-20170810014725-jl35smbiayt4tgob +# bzr-builder format 0.3 deb-version {debupstream}-0~126 +lp:indicator-china-weather revid:lixiang@kylinos.cn-20170831093736-94bzjs532rbt440c diff -Nru indicator-china-weather-2.2.4/debian/changelog indicator-china-weather-2.2.6/debian/changelog --- indicator-china-weather-2.2.4/debian/changelog 2017-08-10 01:50:57.000000000 +0000 +++ indicator-china-weather-2.2.6/debian/changelog 2018-03-01 01:24:37.000000000 +0000 @@ -1,8 +1,21 @@ -indicator-china-weather (2.2.4-0~124~ubuntu14.04.1) trusty; urgency=low +indicator-china-weather (2.2.6-0~126~ubuntu14.04.1) trusty; urgency=low * Auto build. - -- kobe Thu, 10 Aug 2017 01:50:57 +0000 + -- kobe Thu, 01 Mar 2018 01:24:37 +0000 + +indicator-china-weather (2.2.6-0ubuntu1) artful; urgency=medium + + * Optimize data processing at weather server. + * Optimize city additions with GObject.idle. + + -- lixiang Thu, 31 Aug 2017 17:34:05 +0800 + +indicator-china-weather (2.2.5-0ubuntu1) artful; urgency=medium + + * Determine the whether data is empty or not. + + -- lixiang Tue, 29 Aug 2017 17:06:02 +0800 indicator-china-weather (2.2.4-0ubuntu1) artful; urgency=medium diff -Nru indicator-china-weather-2.2.4/indicator-china-weather.py indicator-china-weather-2.2.6/indicator-china-weather.py --- indicator-china-weather-2.2.4/indicator-china-weather.py 2017-08-10 01:50:56.000000000 +0000 +++ indicator-china-weather-2.2.6/indicator-china-weather.py 2018-03-01 01:24:37.000000000 +0000 @@ -420,11 +420,13 @@ observe_weather = None except Exception as e: observe_weather = None - #20170627 -# observe_weather = {'city': u'\u957f\u6c99', 'WD': u'\u4e1c\u98ce', 'ptime': u'2017-06-27 18:50', 'temp': u'23', 'temp2': u'25\u2103', 'temp1': u'23\u2103', 'weather': u'\u9634', 'WS': u'\u5fae\u98ce', 'time': u'2017-06-27 18:50', 'img2': 'd2.gif', 'img1': 'd2.gif', 'aqi': u'\u4f18(30)', 'SD': u'90'} - if 'temp' in observe_weather.keys(): - self.now_temperature = observe_weather['temp'] - queue.put((10,observe_weather)) + if observe_weather in (False, None, '[]', ''): + self.show_notification("实时天气获取异常", "weather-indicator-unknown", severe=True) + else: + # observe_weather = {'city': u'\u957f\u6c99', 'WD': u'\u4e1c\u98ce', 'ptime': u'2017-06-27 18:50', 'temp': u'23', 'temp2': u'25\u2103', 'temp1': u'23\u2103', 'weather': u'\u9634', 'WS': u'\u5fae\u98ce', 'time': u'2017-06-27 18:50', 'img2': 'd2.gif', 'img1': 'd2.gif', 'aqi': u'\u4f18(30)', 'SD': u'90'} + if 'temp' in observe_weather.keys(): + self.now_temperature = observe_weather['temp'] + queue.put((10,observe_weather)) def set_new_observe_weather(self, weather): # self.ptime = weather['ptime'] @@ -573,6 +575,19 @@ else: iw.forecast_ui.show_error_status() +def add_city_ok(county, selected_id): + # 将新增城市添加到配置页面的城市列表中 + iw.prefswindow.builder.get_object('citieslist').append([county]) + # 将新增城市id和名字写入对应的dict中,然后写入配置 + iw.places[selected_id] = county + iw.settings.set_value("places", str(iw.places)) + # 将新增城市的id告诉配置界面程序 + iw.prefswindow.pre_cur_id = selected_id + iw.city_id = selected_id + iw.settings.set_value("city_id", str(iw.city_id)) + iw.menu_normal() + iw.update_observe_data() + class ForecastModel(threading.Thread):#20170627 def __init__(self, server, id): threading.Thread.__init__(self)#20170627 @@ -890,6 +905,7 @@ return True def handle_ok(self, widget, data=None): +# GObject.idle_add(add_city_ok, county, selected_id) new_show_label = self.show_label.get_active() if (iw.temp != new_show_label): iw.temp = new_show_label @@ -1195,17 +1211,7 @@ dialog.run() dialog.destroy() else: - # 将新增城市添加到配置页面的城市列表中 - iw.prefswindow.builder.get_object('citieslist').append([county]) - # 将新增城市id和名字写入对应的dict中,然后写入配置 - iw.places[selected_id] = county - iw.settings.set_value("places", str(iw.places)) - # 将新增城市的id告诉配置界面程序 - iw.prefswindow.pre_cur_id = selected_id - iw.city_id = selected_id - iw.settings.set_value("city_id", str(iw.city_id)) - iw.menu_normal() - iw.update_observe_data() + GObject.idle_add(add_city_ok, county, selected_id) # self.dialog.destroy() # self.dialog.hide() self.close() diff -Nru indicator-china-weather-2.2.4/src/base.py indicator-china-weather-2.2.6/src/base.py --- indicator-china-weather-2.2.4/src/base.py 2017-08-10 01:50:56.000000000 +0000 +++ indicator-china-weather-2.2.6/src/base.py 2018-03-01 01:24:37.000000000 +0000 @@ -29,7 +29,7 @@ HOME = os.path.expandvars('$HOME') -VERSION = '2.2.4' +VERSION = '2.2.6' province_list = [ '北京',