diff --git a/ftui/screens/dashboard_screen.py b/ftui/screens/dashboard_screen.py index 72ffb1d..c7c1d6c 100644 --- a/ftui/screens/dashboard_screen.py +++ b/ftui/screens/dashboard_screen.py @@ -468,8 +468,7 @@ def update_cumulative_profit_plot(self, bot_list=None): worker = get_current_worker() if not worker.is_cancelled: - self.app.call_from_thread(chart_container.refresh) - chart_container.loading = False + self.app.call_from_thread(chart_container.set_loading, False) @on(SelectionList.SelectedChanged) def update_cum_plot_from_list(self) -> None: diff --git a/ftui/screens/main_bot_screen.py b/ftui/screens/main_bot_screen.py index 8a40bd9..43a28bc 100644 --- a/ftui/screens/main_bot_screen.py +++ b/ftui/screens/main_bot_screen.py @@ -188,6 +188,9 @@ def refresh_chart_button_pressed(self) -> None: bot_id = self._get_bot_id_from_client_list() chart_container = self.query_one("#bot-chart") + #worker = get_current_worker() + #if not worker.is_cancelled: + # self.app.call_from_thread(chart_container.loading, True) chart_container.loading = True self.update_chart(bot_id, pair=self.prev_chart_pair, refresh=True) @@ -564,7 +567,10 @@ def update_chart(self, bot_id, pair=None, refresh=False): ckey = f"{pair}_{cl.get_client_config()['timeframe']}" if ckey not in self.chart_data or refresh: - chart_container.loading = True + worker = get_current_worker() + if not worker.is_cancelled: + self.app.call_from_thread(chart_container.set_loading, True) + data = cl.get_pair_dataframe(pair, limit=min(max(round(cw / 2), 50), 200)) if data is not None and not data.empty: self.chart_data[ckey] = data[["date", "Open", "Close", "High", "Low"]] @@ -588,7 +594,10 @@ def update_chart(self, bot_id, pair=None, refresh=False): data["date"] > last_date ] if not new_data.empty: - chart_container.loading = True + worker = get_current_worker() + if not worker.is_cancelled: + self.app.call_from_thread(chart_container.set_loading, True) + self.chart_data[ckey] = pd.concat([self.chart_data[ckey], new_data]) self.chart_data[ckey].drop(self.chart_data[ckey].head(1).index, inplace=True) @@ -735,6 +744,10 @@ def _render_chart(self, ftuic, pair, data): title=f"Error: No data available for {pair}", severity="warning", ) + + #worker = get_current_worker() + #if not worker.is_cancelled: + # self.app.call_from_thread(chart_container.loading, False) chart_container.loading = False # bot performance tab diff --git a/requirements.txt b/requirements.txt index a6ecdd3..45d7e75 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,5 +5,5 @@ python-rapidjson PyYaml textual==0.85.0 plotext==5.2.8 -textual_plotext +textual_plotext==0.2.1 freqtrade-client