Added waypoints for bot

This commit is contained in:
OTCv8
2019-11-01 03:44:56 +01:00
parent 85a7fbf0a6
commit 62ff2b1cf5
22 changed files with 865 additions and 32 deletions

View File

@@ -51,6 +51,64 @@ function show(widget)
activeWindow:focus()
end
function singlelineEditor(text, callback)
if activeWindow then
destroyWindow()
end
local window = g_ui.createWidget('TextEditWindow', rootWidget)
local destroy = function()
window:destroy()
if window == activeWindow then
activeWindow = nil
end
end
window.okButton.onClick = function()
local text = window.text:getText()
destroy()
callback(text)
end
window.cancelButton.onClick = destroy
window.onEscape = destroy
window.onEnter = window.okButton.onClick
window.text:setText(text)
activeWindow = window
activeWindow:raise()
activeWindow:focus()
end
function multilineEditor(description, text, callback)
if activeWindow then
destroyWindow()
end
local window = g_ui.createWidget('TextEditMultilineWindow', rootWidget)
local destroy = function()
window:destroy()
if window == activeWindow then
activeWindow = nil
end
end
window.okButton.onClick = function()
local text = window.text:getText()
destroy()
callback(text)
end
window.cancelButton.onClick = destroy
window.onEscape = destroy
window.description:setText(description)
window.text:setText(text)
activeWindow = window
activeWindow:raise()
activeWindow:focus()
end
function hide()
destroyWindow()
end

View File

@@ -23,3 +23,51 @@ TextEditWindow < MainWindow
anchors.bottom: parent.bottom
anchors.right: parent.right
width: 60
TextEditMultilineWindow < MainWindow
id: texteditmultiline
size: 650 497
!text: tr("Edit text")
Label
id: description
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
text-auto-resize: true
text-align: center
text-wrap: true
MultilineTextEdit
id: text
anchors.top: textScroll.top
anchors.left: parent.left
anchors.right: textScroll.left
anchors.bottom: textScroll.bottom
vertical-scrollbar: textScroll
text-wrap: true
VerticalScrollBar
id: textScroll
anchors.top: description.bottom
anchors.bottom: okButton.top
anchors.right: parent.right
margin-bottom: 10
step: 16
pixels-scroll: true
Button
id: okButton
!text: tr('Ok')
anchors.bottom: parent.bottom
anchors.right: next.left
margin-right: 10
width: 60
Button
id: cancelButton
!text: tr('Cancel')
anchors.bottom: parent.bottom
anchors.right: parent.right
width: 60