diff options
author | unknown <Pixel@.(none)> | 2010-01-05 22:22:01 -0800 |
---|---|---|
committer | unknown <Pixel@.(none)> | 2010-01-05 22:22:01 -0800 |
commit | 628ed8138210d0f67cc35835f6fba96fcc7d932f (patch) | |
tree | 0357420e905b42533170ad2d71961373d82c7803 /dalos-input.lua | |
parent | 36624b05efae3fa82280a945fa2eb1dedc84e0b0 (diff) | |
parent | 69836d15333d9d48aecf3e0aef139c7eacf59214 (diff) |
Merge branch 'master' of ssh+git://git.grumpycoder.net/pub/repo.git/Dalos
Diffstat (limited to 'dalos-input.lua')
-rw-r--r-- | dalos-input.lua | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/dalos-input.lua b/dalos-input.lua new file mode 100644 index 0000000..bf37b9d --- /dev/null +++ b/dalos-input.lua @@ -0,0 +1,44 @@ +dalosp.input = { + get_settings = function (self) + return { filename = self.extra.filename } + end, + + configure = function (self) + local dlg = iup.filedlg { + dialogtype = "Open", + file = self.extra.filename, + } + iup.Popup(dlg) + if dlg.status ~= -1 then + local s, v = pcall(Input, dlg.value) + if s then + self:set_houtput(v) + return + end + end + self:set_houtput(nil) + end, + + create = function (d, tab, settings) + tab.ninputs = 0 + tab.noutputs = 1 + tab.otype = dalos.objtype.HANDLE + tab.configure = dalosp.input.configure + tab.default_name = "Input" + tab.ntype = "Input" + tab.get_settings = dalosp.input.get_settings + local extra = { } + if settings then extra.filename = settings.filename end + local obj = dalos.object(d, tab, extra) + + if extra.filename then + local s, v = pcall(Input, extra.filename) + if s then obj:set_houtput(v) end + end + + return obj + end, +} + +dalos.input = dalosp.input.create +dalos:register_obj("Input", dalos.input, "Basic Inputs") |