[tekui-devel] tekui: Class: illegal variable accesses now raise an error in de...

Timm S. Mueller tmueller at neoscientists.org
Sat Mar 29 05:06:46 CET 2008


details:   http://hg.teklib.org/tekui/rev/600306bd8b98
changeset: 393:600306bd8b98
user:      Timm S. Mueller <tmueller at neoscientists.org>
date:      Fri Mar 28 16:59:26 2008 +0100
description:
Class: illegal variable accesses now raise an error in debug mode;
Application:addMember() was passing self.Display to children, fixed;
Area:setWeight() now ensures that weight isn't nil; Button: removed
notifications; Family: Children initialized correctly; FloatText, Image,
PopItem, PopRadioItem, ScrollGroup, Window: added missing initializations

diffs (truncated from 348 to 100 lines):

diff -r ddb0d8f605aa -r 600306bd8b98 tek/app/ui/dynamic.lua
--- a/tek/app/ui/dynamic.lua	Fri Mar 28 16:02:33 2008 +0100
+++ b/tek/app/ui/dynamic.lua	Fri Mar 28 16:59:26 2008 +0100
@@ -81,12 +81,23 @@ ui.application:new
 						ui.button:new {
 							MaxWidth = 0,
 							Label = "Reset",
-							onRelease = function(self)
-								local e = self.Application:getElementById("1")
-								self.Application:getElementById("s3"):setPosition(0x8000)
-								e:setValue("Weight", nil)
-								e:setValue("Label", "nil")
-							end,
+							Notifications =
+							{
+								["Pressed"] =
+								{
+									[false] =
+									{
+										{
+											ui.NOTIFY_SELF, function(self)
+												local e = self.Application:getElementById("1")
+												self.Application:getElementById("s3"):setPosition(0x8000)
+												e:setValue("Weight", false)
+												e:setValue("Label", "unset")
+											end
+										}
+									}
+								}
+							}
 						},
 					},
 				},
diff -r ddb0d8f605aa -r 600306bd8b98 tek/class.lua
--- a/tek/class.lua	Fri Mar 28 16:02:33 2008 +0100
+++ b/tek/class.lua	Fri Mar 28 16:59:26 2008 +0100
@@ -20,15 +20,15 @@
 -------------------------------------------------------------------------------
 
 local db = require "tek.lib.debug"
-local assert = assert
+local error = error
 local tostring = tostring
 local getmetatable = getmetatable
 local setmetatable = setmetatable
 
-local DEBUG = true
+-- local DEBUG = true
 
 module "tek.class"
-_VERSION = "Class 4.2"
+_VERSION = "Class 4.3"
 
 local Class = _M
 
@@ -51,13 +51,14 @@ if DEBUG then
 		function mt.__index(tab, key)
 			local val = mt[key]
 			if not val then
-				db.warn("%s <= %s", tab:getClassName(), key)
+				error(("Uninitialized read: %s.%s"):format(tab:getClassName(), key))
 			end
 			return val
 		end
 
 		function mt.__newindex(tab, key, val)
-			db.warn("%s => %s=%s", tab:getClassName(), key, val)
+			error(("Uninitialized write: %s.%s=%s"):format(tab:getClassName(), key,
+				tostring(val)))
 			mt[key] = val
 		end
 
diff -r ddb0d8f605aa -r 600306bd8b98 tek/class/ui/application.lua
--- a/tek/class/ui/application.lua	Fri Mar 28 16:02:33 2008 +0100
+++ b/tek/class/ui/application.lua	Fri Mar 28 16:59:26 2008 +0100
@@ -20,7 +20,7 @@ local unpack = unpack
 local unpack = unpack
 
 module("tek.class.ui.application", tek.class.ui.family)
-_VERSION = "Application 1.9"
+_VERSION = "Application 1.10"
 
 -------------------------------------------------------------------------------
 --	class implementation:
@@ -93,7 +93,7 @@ function Application:addMember(child, po
 	if self:checkMember(child) then
 		assert(child:getClass() == ui.Window)
 		child:connectGlobal(self, child)
-		if child:setupDisplay(self.Display, self.Drawable) then
+		if child:setupDisplay(self.Display) then
 			-- this will also invoke checkMember():
 			if Family.addMember(self, child, pos) then
 				return child
diff -r ddb0d8f605aa -r 600306bd8b98 tek/class/ui/area.lua
--- a/tek/class/ui/area.lua	Fri Mar 28 16:02:33 2008 +0100
+++ b/tek/class/ui/area.lua	Fri Mar 28 16:59:26 2008 +0100
@@ -34,7 +34,7 @@ local floor = math.floor
 local floor = math.floor
 
 module("tek.class.ui.area", tek.class.ui.element)


More information about the tekui-devel mailing list