Fix standalone LUA
This commit is contained in:
committed by
Raphael Coeffic
parent
7417b6568b
commit
ab76639301
@@ -136,7 +136,8 @@ void buildLuaUi(std::vector<LuaScript> luaScripts, FormWindow *window, FormGridL
|
||||
f_chdir(toolPath);
|
||||
|
||||
luaExec(luaScript.path.c_str());
|
||||
StandaloneLuaWindow::instance()->attach(window);
|
||||
auto lua_win = StandaloneLuaWindow::instance();
|
||||
lua_win->attach(window);
|
||||
|
||||
return 0;
|
||||
},
|
||||
|
||||
@@ -76,8 +76,18 @@ StandaloneLuaWindow* StandaloneLuaWindow::instance()
|
||||
|
||||
void StandaloneLuaWindow::attach(Window* newParent)
|
||||
{
|
||||
Window::attach(newParent->getFullScreenWindow());
|
||||
Layer::push(this);
|
||||
if (!prevScreen) {
|
||||
|
||||
// backup previous screen
|
||||
prevScreen = lv_scr_act();
|
||||
|
||||
Window::attach(newParent->getFullScreenWindow());
|
||||
|
||||
// and load new one
|
||||
lv_scr_load(lvobj);
|
||||
|
||||
Layer::push(this);
|
||||
}
|
||||
setFocus();
|
||||
}
|
||||
|
||||
@@ -90,9 +100,15 @@ void StandaloneLuaWindow::deleteLater(bool detach, bool /*trash*/)
|
||||
focusWindow = nullptr;
|
||||
}
|
||||
|
||||
if (prevScreen) {
|
||||
lv_scr_load(prevScreen);
|
||||
prevScreen = nullptr;
|
||||
}
|
||||
|
||||
// detach from parent
|
||||
if (detach)
|
||||
if (detach) {
|
||||
this->detach();
|
||||
}
|
||||
|
||||
if (closeHandler) {
|
||||
closeHandler();
|
||||
@@ -221,4 +237,4 @@ bool StandaloneLuaWindow::displayPopup(event_t event, uint8_t type, const char*
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ public:
|
||||
const char* info, bool& result);
|
||||
|
||||
protected:
|
||||
lv_obj_t* prevScreen = nullptr;
|
||||
|
||||
// GFX
|
||||
BitmapBuffer lcdBuffer;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user