Skip to content

Commit

Permalink
Set toolbar commands on start instead of on init, to allow game initi…
Browse files Browse the repository at this point in the history
…alization. (#1177)
  • Loading branch information
TheMaximum committed May 22, 2022
1 parent e687b37 commit 59e341a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions pyplanet/apps/core/pyplanet/toolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ async def on_start(self):
)

self.app.context.signals.listen(mp_signals.player.player_connect, self.player_connect)
await self.widget.on_start()

if await self.setting_display_toolbar.get_value():
await self.widget.display()
Expand Down
2 changes: 2 additions & 0 deletions pyplanet/apps/core/pyplanet/views/toolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def __init__(self, app, *args, **kwargs):
self.app = app
self.manager = self.app.context.ui

async def on_start(self):
self.commands = {
'bar_button_list': '/list',
'bar_button_mf': '/mf',
Expand All @@ -40,4 +41,5 @@ async def get_context_data(self):
async def handle_catch_all(self, player, action, values, **kwargs):
if action not in self.commands:
return

await self.app.instance.command_manager.execute(player, self.commands[action])

0 comments on commit 59e341a

Please sign in to comment.