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);
|
f_chdir(toolPath);
|
||||||
|
|
||||||
luaExec(luaScript.path.c_str());
|
luaExec(luaScript.path.c_str());
|
||||||
StandaloneLuaWindow::instance()->attach(window);
|
auto lua_win = StandaloneLuaWindow::instance();
|
||||||
|
lua_win->attach(window);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -76,8 +76,18 @@ StandaloneLuaWindow* StandaloneLuaWindow::instance()
|
|||||||
|
|
||||||
void StandaloneLuaWindow::attach(Window* newParent)
|
void StandaloneLuaWindow::attach(Window* newParent)
|
||||||
{
|
{
|
||||||
Window::attach(newParent->getFullScreenWindow());
|
if (!prevScreen) {
|
||||||
Layer::push(this);
|
|
||||||
|
// backup previous screen
|
||||||
|
prevScreen = lv_scr_act();
|
||||||
|
|
||||||
|
Window::attach(newParent->getFullScreenWindow());
|
||||||
|
|
||||||
|
// and load new one
|
||||||
|
lv_scr_load(lvobj);
|
||||||
|
|
||||||
|
Layer::push(this);
|
||||||
|
}
|
||||||
setFocus();
|
setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,9 +100,15 @@ void StandaloneLuaWindow::deleteLater(bool detach, bool /*trash*/)
|
|||||||
focusWindow = nullptr;
|
focusWindow = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (prevScreen) {
|
||||||
|
lv_scr_load(prevScreen);
|
||||||
|
prevScreen = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
// detach from parent
|
// detach from parent
|
||||||
if (detach)
|
if (detach) {
|
||||||
this->detach();
|
this->detach();
|
||||||
|
}
|
||||||
|
|
||||||
if (closeHandler) {
|
if (closeHandler) {
|
||||||
closeHandler();
|
closeHandler();
|
||||||
@@ -221,4 +237,4 @@ bool StandaloneLuaWindow::displayPopup(event_t event, uint8_t type, const char*
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,8 @@ public:
|
|||||||
const char* info, bool& result);
|
const char* info, bool& result);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
lv_obj_t* prevScreen = nullptr;
|
||||||
|
|
||||||
// GFX
|
// GFX
|
||||||
BitmapBuffer lcdBuffer;
|
BitmapBuffer lcdBuffer;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user