Skip to content

Commit

Permalink
Fix text links in main bot screen
Browse files Browse the repository at this point in the history
  • Loading branch information
froggleston committed Aug 24, 2024
1 parent 194642a commit fba85da
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
13 changes: 0 additions & 13 deletions ftui/ftui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]+)?"
Expand Down Expand Up @@ -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
Expand Down
18 changes: 14 additions & 4 deletions ftui/screens/main_bot_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)}",
)

Expand Down Expand Up @@ -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']}",
)

Expand Down

0 comments on commit fba85da

Please sign in to comment.