lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Saturday 19 February 2011 15:16:32 Dirk Laurie wrote:
> On Sat, Feb 19, 2011 at 08:11:56PM +0200, Steve Litt wrote:
> > Thanks to all of you for helping me with the presentation!
> 
> Will our reward be that you post the slides somewhere?
> 
> D.

:-)

It wasn't slides, but instead most of it was a combination of Lua based 
"countdown slides", gvim hosted source code, and rxvt hosted output.

Everything I covered except the IUP stuff is already up on 
Troubleshooters.Com's "Litt's Lua Laboratory" in a form that, at least in my 
opinion, is optimized for learning as well as reference.

Time permitting, I'll see if I can convert the countdown slides into a 
slideshow and post it, but believe me, that won't be half as helpful as what's 
already on Troubleshooters.Com.

Meanwhile, I'm attaching the source code to showhead.lua, the countdown slide 
displayer, and the directory scr, which contains all data for the countdown 
slides, and leap_slides.pdf, the short slideshow I showed at the very 
beginning. A countdown slide file has the following line specification:

Line 1: Number of seconds to count down
Line 2: "Slide" title
Line 3 and beyond: Bullet points

If you have Lua and IUP installed, this should work.

Have fun.

Thanks

SteveT

Steve Litt
Recession Relief Package
http://www.recession-relief.US
Twitter: http://www.twitter.com/stevelitt

#!/usr/bin/lua

-- #######################################################################
--  showhead.lua: Countdown slide displayer. version 0.1
--   Copyright (C) 2011 by Steve Litt (slitt@troubleshooters.com)
--
--   This program is free software; you can redistribute it and/or modify
--   it under the terms of the MIT License: See the accompanying
--   COPYING file.
--
--
--   Copyright (C) 2011 by Steve Litt, slitt@troubleshooters.com
--   
--   Permission is hereby granted, free of charge, to any person obtaining a copy
--   of this software and associated documentation files (the "Software"), to deal
--   in the Software without restriction, including without limitation the rights
--   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
--   copies of the Software, and to permit persons to whom the Software is
--   furnished to do so, subject to the following conditions:
--   
--   The above copyright notice and this permission notice shall be included in
--   all copies or substantial portions of the Software.
--   
--   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
--   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
--   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
--   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
--   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
--   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
--   THE SOFTWARE.

-- #######################################################################


require("iuplua")

local fname = tostring(arg[1])
local lineno = 0
local seconds
local headline
local list = {""}
for line in io.lines("scr/" .. fname .. ".scr") do
	lineno = lineno + 1
	if lineno == 1 then
		seconds = tonumber(line) or 3
	elseif lineno == 2 then
		headline = line
	else
		if string.match(line, "%S") then line = "* " .. line end
		table.insert(list, "")
		table.insert(list, line)
	end
end

list.EXPAND="YES"
list.font="HELVETICA_BOLD_24"

local mylist = iup.list(list)
function mylist:action()
	return iup.CLOSE
end       

local mybutton = iup.button({
	title= "*              " .. tostring(seconds) .. "              *",
	font="HELVETICA_BOLD_14",
	size="HALFxHALF"
})

function mybutton:action()
	return iup.CLOSE
end       


local vbox = iup.vbox({ 
	iup.label {title=headline, font="HELVETICA_BOLD_40"}, 
	mylist,
	mybutton
})

local timer = iup.timer{time=1000}
function timer:action_cb()
	seconds = seconds - 1
	vbox[3].title = tostring(seconds)
	if seconds == 0 then return iup.CLOSE end
--	if seconds == 0 then iup.ExitLoop() end
end
timer.run = "YES"

local dlg = iup.dialog{vbox; title="Litt's timed slide", size="FULLxFULL"}

dlg:show()

iup.MainLoop()

Attachment: scr.tgz
Description: application/compressed-tar

Attachment: leap_slides.pdf
Description: Adobe PDF document