@@ -25,6 +25,7 @@
|
||||
#include "opentx.h"
|
||||
#include "libopenui.h"
|
||||
#include "lua/lua_api.h"
|
||||
#include "standalone_lua.h"
|
||||
|
||||
extern uint8_t g_moduleIdx;
|
||||
|
||||
@@ -106,7 +107,7 @@ void RadioToolsPage::rebuild(FormWindow * window)
|
||||
char toolName[TOOL_NAME_MAXLEN + 1];
|
||||
const char * label;
|
||||
char * ext = (char *)getFileExtension(path);
|
||||
if (readToolName(path, toolName)) {
|
||||
if (readToolName(toolName, path)) {
|
||||
label = toolName;
|
||||
}
|
||||
else {
|
||||
@@ -114,11 +115,18 @@ void RadioToolsPage::rebuild(FormWindow * window)
|
||||
label = getBasename(path);
|
||||
}
|
||||
new StaticText(window, grid.getLabelSlot(), "lua", BUTTON_BACKGROUND, CENTERED);
|
||||
new TextButton(window, grid.getFieldSlot(1), label, [=]() -> uint8_t {
|
||||
f_chdir("/SCRIPTS/TOOLS/");
|
||||
//luaExec(path);
|
||||
return 0;
|
||||
}, 0);
|
||||
|
||||
std::string path_str(path);
|
||||
new TextButton(
|
||||
window, grid.getFieldSlot(1), label,
|
||||
[window, path_str]() -> uint8_t {
|
||||
f_chdir("/SCRIPTS/TOOLS/");
|
||||
luaExec(path_str.c_str());
|
||||
// TODO: check 'luaState'
|
||||
new StandaloneLuaWindow(window);
|
||||
return 0;
|
||||
},
|
||||
0);
|
||||
grid.nextLine();
|
||||
}
|
||||
}
|
||||
@@ -187,4 +195,4 @@ void RadioToolsPage::rebuild(FormWindow * window)
|
||||
#endif
|
||||
|
||||
window->setInnerHeight(grid.getWindowHeight());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user