diff --git a/ftui/ftui.py b/ftui/ftui.py index 390a090..1252629 100644 --- a/ftui/ftui.py +++ b/ftui/ftui.py @@ -33,7 +33,6 @@ from ftui.screens.dashboard_screen import DashboardScreen from ftui.screens.help_screen import HelpScreen from ftui.screens.main_bot_screen import MainBotScreen -from ftui.screens.modal_screens import TradeInfoScreen from ftui.screens.settings_screen import SettingsScreen urlre = r"^\[([a-zA-Z0-9]+)\]*([a-zA-Z0-9\-._~%!$&'()*+,;=]+)?:([ a-zA-Z0-9\-._~%!$&'()*+,;=]+)@?([a-z0-9\-._~%]+|\[[a-f0-9:.]+\]|\[v[a-f0-9][a-z0-9\-._~%!$&'()*+,;=:]+\]):([0-9]+)?" @@ -395,18 +394,6 @@ def watch_show_clients(self, show_clients: bool) -> None: async def action_switch_ftui_mode(self, mode) -> None: await self.switch_mode(mode) - def action_update_chart(self, bot_id, pair) -> None: - self.MODES["bots"].update_chart(bot_id, pair) - - def action_force_chart_refresh(self, bot_id, pair) -> None: - self.MODES["bots"].update_chart(bot_id, pair, refresh=True) - - def action_show_trade_info_dialog(self, trade_id, cl_name) -> None: - tis = TradeInfoScreen() - tis.trade_id = trade_id - tis.client = self.client_dict[cl_name] - self.push_screen(tis) - def setup(args): config = args.config diff --git a/ftui/screens/main_bot_screen.py b/ftui/screens/main_bot_screen.py index f18d705..9868e21 100644 --- a/ftui/screens/main_bot_screen.py +++ b/ftui/screens/main_bot_screen.py @@ -25,6 +25,7 @@ from textual_plotext import PlotextPlot import ftui.ftui_helpers as fth +from ftui.screens.modal_screens import TradeInfoScreen from ftui.widgets.label_item import LabelItem from ftui.widgets.linkable_markdown_viewer import LinkableMarkdown from ftui.widgets.timed_screen import TimedScreen @@ -155,6 +156,15 @@ async def update_per_one_min(self): self.update_chart(bot_id, pair=self.prev_chart_pair) self.update_whitelist(bot_id) + def action_update_chart(self, bot_id, pair) -> None: + self.update_chart(bot_id, pair) + + def action_show_trade_info_dialog(self, trade_id, cl_name) -> None: + tis = TradeInfoScreen() + tis.trade_id = trade_id + tis.client = self.app.client_dict[cl_name] + self.app.push_screen(tis) + # TAB EVENT STUFF def _get_bot_id_from_client_list(self): try: @@ -386,8 +396,8 @@ def _render_open_trade_summary(self, ftuic): ) render_data = ( - f"[@click=show_trade_info_dialog('{t['trade_id']}', '{ftuic.name}')]{t['trade_id']}[/]", - f"[@click=update_chart('{ftuic.name}', '{pairstr}')]{pairstr}[/]", + f"[@click=screen.show_trade_info_dialog('{t['trade_id']}', '{ftuic.name}')]{t['trade_id']}[/]", + f"[@click=screen.update_chart('{ftuic.name}', '{pairstr}')]{pairstr}[/]", f"{round(t['stake_amount'], 3)}", ) @@ -441,8 +451,8 @@ def _render_closed_trades_summary(self, ftuic): # meta={"@click": f"show_trade_info_dialog('{str(v['ID'])}', '{ftuic.name}')"}, # color=self.app.COLOURS['link_col'] # )), - f"[@click=show_trade_info_dialog('{v['ID']}', '{ftuic.name}')]{v['ID']}[/]", - f"[@click=update_chart('{ftuic.name}', '{v['Pair']}')]{v['Pair']}[/]", + f"[@click=screen.show_trade_info_dialog('{v['ID']}', '{ftuic.name}')]{v['ID']}[/]", + f"[@click=screen.update_chart('{ftuic.name}', '{v['Pair']}')]{v['Pair']}[/]", f"{v['Stake Amount']}", )