def _on_config_change(self):
self._last_graph_update = 0
market_ids = set([get_market_id(mc) for mc in config['markets']])
removed_market_ids = self._last_ticer.keys() - market_ids
[self._last_ticer.pop(market_id, None) for market_id in removed_market_ids]
market_ids = set([get_market_id(mc) for mc in config['markets'] if mc['graph']])
removed_graph_market_ids = self._graph_data_dict.keys() - market_ids
[self._graph_data_dict.pop(market_id, None) for market_id in removed_graph_market_ids]
self._main_win.remove_graph_markets(removed_graph_market_ids)
for market_id in self._last_ticer:
last_price = self._last_ticer[market_id]['close']
market_config, _ = config.get_market_by_id(market_id)
price_str = btcwidget.currency.service.format_price(last_price, market_config['market'][3:])
GObject.idle_add(self._main_win.set_current_price, market_id, price_str)
for market_id in self._graph_data_dict:
self._update_market_graph(market_id)
评论列表
文章目录