replace require with dofile, rename Hotkeys to Keyboard

This commit is contained in:
Eduardo Bart
2012-02-06 02:39:52 -02:00
parent 64c9e4f1d5
commit f97104f12e
41 changed files with 284 additions and 126 deletions

View File

@@ -44,3 +44,20 @@ end
function quit()
exit()
end
function reloadModule(name)
local module = g_modules.getModule(name)
if module then
module:unload()
module:load()
end
end
function autoReloadModule(name)
local function reloadEvent()
reloadModule(name)
scheduleEvent(reloadEvent, 1000)
end
reloadEvent()
end

View File

@@ -108,15 +108,15 @@ function Terminal.init()
terminalWidget:setVisible(false)
terminalButton = TopMenu.addButton('terminalButton', 'Terminal (Ctrl + T)', 'terminal.png', Terminal.toggle)
Hotkeys.bindKeyDown('Ctrl+T', Terminal.toggle)
Keyboard.bindKeyDown('Ctrl+T', Terminal.toggle)
commandHistory = Settings.getList('terminal-history')
commandLineEdit = terminalWidget:getChildById('commandLineEdit')
Hotkeys.bindKeyDown('Up', function() navigateCommand(1) end, commandLineEdit)
Hotkeys.bindKeyDown('Down', function() navigateCommand(-1) end, commandLineEdit)
Hotkeys.bindKeyDown('Tab', completeCommand, commandLineEdit)
Hotkeys.bindKeyDown('Enter', doCommand, commandLineEdit)
Keyboard.bindKeyDown('Up', function() navigateCommand(1) end, commandLineEdit)
Keyboard.bindKeyDown('Down', function() navigateCommand(-1) end, commandLineEdit)
Keyboard.bindKeyDown('Tab', completeCommand, commandLineEdit)
Keyboard.bindKeyDown('Enter', doCommand, commandLineEdit)
terminalBuffer = terminalWidget:getChildById('terminalBuffer')
Logger.setOnLog(onLog)
@@ -125,7 +125,7 @@ end
function Terminal.terminate()
Settings.setList('terminal-history', commandHistory)
Hotkeys.unbindKeyDown('Ctrl+T')
Keyboard.unbindKeyDown('Ctrl+T')
Logger.setOnLog(nil)
terminalButton:destroy()
terminalButton = nil

View File

@@ -8,8 +8,8 @@ Module
autoLoadAntecedence: 200
onLoad: |
require 'terminal'
require 'commands'
dofile 'terminal'
dofile 'commands'
Terminal.init()
onUnload: |