mirror of
https://gitlab.com/Syping/luaengineapp.git
synced 2025-09-10 10:46:28 +02:00
add getDirectoryPath
This commit is contained in:
parent
e1c5e46af5
commit
be98a790e5
8 changed files with 93 additions and 13 deletions
60
scripts/luaenginert.lea
Normal file
60
scripts/luaenginert.lea
Normal file
|
@ -0,0 +1,60 @@
|
|||
#!/usr/bin/env luaengine
|
||||
--[[
|
||||
******************************************************************************
|
||||
* luaengine LuaEngine Runtime
|
||||
* Copyright (C) 2019 Syping
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
******************************************************************************
|
||||
--]]
|
||||
|
||||
local mainWindow
|
||||
local scriptLineEdit
|
||||
|
||||
function main()
|
||||
mainWindow = createMainWindow("LuaEngine Runtime")
|
||||
local mainLayout = createLayout(VerticalLayout, mainWindow)
|
||||
|
||||
createLabel("<strong>LuaEngine Runtime</strong>", mainLayout)
|
||||
|
||||
local scriptLayout = createLayout(HorizontalLayout, mainLayout)
|
||||
createLabel("Script:", scriptLayout)
|
||||
scriptLineEdit = createLineEdit("", scriptLayout)
|
||||
setWidgetReadOnly(scriptLineEdit)
|
||||
local scriptToolButton = createToolButton("...", scriptLayout)
|
||||
connect(scriptToolButton, "clicked()", "scriptButtonPressed")
|
||||
|
||||
createSpacerItem(SizePolicyMinimum, SizePolicyExpanding, mainLayout)
|
||||
|
||||
local buttonLayout = createLayout(HorizontalLayout, mainLayout)
|
||||
createSpacerItem(SizePolicyExpanding, SizePolicyMinimum, buttonLayout)
|
||||
local runButton = createPushButton("&Run", buttonLayout)
|
||||
connect(runButton, "clicked()", "runScript")
|
||||
|
||||
setWidgetSize(mainWindow, 300, 0)
|
||||
setWidgetFixed(mainWindow, true)
|
||||
showWidget(mainWindow, ShowDefault)
|
||||
|
||||
return GuiExecuted
|
||||
end
|
||||
|
||||
function scriptButtonPressed()
|
||||
local filePath = showFileDialog(OpenFileDialog, "Select LuaEngine script...", "LuaEngine scripts (*.lua *.lea)", mainWindow)
|
||||
if (filePath ~= nil) then
|
||||
setWidgetText(scriptLineEdit, filePath)
|
||||
end
|
||||
end
|
||||
|
||||
function runScript()
|
||||
executeProcess(_LuaEngineRT, getWidgetText(scriptLineEdit), true)
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue