-
Notifications
You must be signed in to change notification settings - Fork 121
Open
Labels
UIRelated to user interfaceRelated to user interfacebugSomething isn't workingSomething isn't workingtodoSomething that needs to be doneSomething that needs to be done
Description
Description
if a plugin makes a window inside on_app_running then it errors out in cpp
# ba_meta require api 9
import babase
import bauiv1 as bui
class MyUI(bui.Window):
def __init__(self):
self._root_widget = bui.containerwidget(
size=(10, 10), scale=1.2, transition='in_right', stack_offset=(0, 0)
)
# ba_meta export babase.Plugin
class EntryPoint(babase.Plugin):
def on_app_running(self):
MyUI()0.675 ba: Error in plugin on_app_running().
Traceback (most recent call last):
File "/home/loup/github/ballistica/build/prefab/full/linux_x86_64_gui/release/ba_data/python/babase/_plugin.py", line 175, in on_app_running
plugin.on_app_running()
~~~~~~~~~~~~~~~~~~~~~^^
File "/home/loup/.ballisticakit/mods/test.py", line 25, in on_app_running
AccountSwitcherUI()
~~~~~~~~~~~~~~~~~^^
File "/home/loup/.ballisticakit/mods/test.py", line 18, in __init__
self._root_widget = bui.containerwidget(
~~~~~~~~~~~~~~~~~~~^
size=(self._width, self._height), scale=1.2, transition='in_right', stack_offset=(0, 0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
RuntimeError: Precondition failed @ python_methods_ui_v1.cc:1282: g_ui_v1 && g_ui_v1->screen_root_widget() != nullptr
solution
it goes away if we add a timer
the app gets to a running state and then it activates an app-mode and asks the mode to do something. ui-v1 gets inited by the classic app mode. So I'd try to run that sort of thing in an on-app-mode-active type callback if possible.
It could maybe make sense for plugins to be informed when app-mode is changing. Since something written for ui-v1 should really only fire when ui-v1 is actually in use.
If squads-mode app-mode rolls around using ui-v2 or whatnot then it'll just fail
-efro
the solution should be to add a callback like that
Metadata
Metadata
Assignees
Labels
UIRelated to user interfaceRelated to user interfacebugSomething isn't workingSomething isn't workingtodoSomething that needs to be doneSomething that needs to be done