mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
lua hotkeys system
This commit is contained in:
@@ -124,7 +124,8 @@ function Terminal.init()
|
||||
terminalWidget = displayUI('terminal.otui')
|
||||
terminalWidget:setVisible(false)
|
||||
|
||||
terminalButton = TopMenu.addButton('terminalButton', 'Terminal', '/core_styles/icons/terminal.png', Terminal.show)
|
||||
terminalButton = TopMenu.addButton('terminalButton', 'Terminal (Ctrl + T)', '/core_styles/icons/terminal.png', Terminal.toggle)
|
||||
Hotkeys.bind('Ctrl+T', Terminal.toggle)
|
||||
|
||||
commandLineEdit = terminalWidget:getChildById('commandLineEdit')
|
||||
connect(commandLineEdit, { onKeyPress = onCommandLineKeyPress })
|
||||
@@ -135,6 +136,7 @@ function Terminal.init()
|
||||
end
|
||||
|
||||
function Terminal.terminate()
|
||||
Hotkeys.unbind('Ctrl+T')
|
||||
Logger.setOnLog(nil)
|
||||
terminalButton:destroy()
|
||||
terminalButton = nil
|
||||
@@ -145,6 +147,14 @@ function Terminal.terminate()
|
||||
commandEnv = nil
|
||||
end
|
||||
|
||||
function Terminal.toggle()
|
||||
if terminalWidget:isVisible() then
|
||||
Terminal.hide()
|
||||
else
|
||||
Terminal.show()
|
||||
end
|
||||
end
|
||||
|
||||
function Terminal.show()
|
||||
terminalWidget:show()
|
||||
terminalWidget:lock()
|
||||
|
@@ -7,6 +7,7 @@ RectPanel
|
||||
background-color: #000000
|
||||
opacity: 216
|
||||
anchors.fill: parent
|
||||
@onEscape: Terminal.hide()
|
||||
|
||||
Panel
|
||||
id: terminalBuffer
|
||||
|
Reference in New Issue
Block a user