[tekui-devel] tekui: Corrections in Sudoku example

Timm S. Mueller tmueller at neoscientists.org
Tue Apr 15 21:59:00 CEST 2008


details:   http://hg.teklib.org/tekui/rev/c56fc02047ea
changeset: 427:c56fc02047ea
user:      Timm S. Mueller <tmueller at neoscientists.org>
date:      Mon Apr 14 18:03:16 2008 +0200
description:
Corrections in Sudoku example

diffs (65 lines):

diff -r 8ac3a97a1ba6 -r c56fc02047ea tek/app/ui/sudoku.lua
--- a/tek/app/ui/sudoku.lua	Mon Apr 14 17:46:20 2008 +0200
+++ b/tek/app/ui/sudoku.lua	Mon Apr 14 18:03:16 2008 +0200
@@ -1,7 +1,7 @@
 #!/usr/bin/env lua
 
 --
---	Sudoku Geli Geburtstag Edition
+--	Sudoku -
 --	Written by Timm S. Mueller <tmueller at schulze-mueller.de>
 --	Dependencies: gnome-base/librsvg, kdeprint
 --
@@ -96,6 +96,8 @@ end
 --	sudokubutton class:
 -------------------------------------------------------------------------------
 
+local NOTIFY_RELEASE = { ui.NOTIFY_SELF, "onRelease" }
+
 sudokubutton = ui.text:newClass()
 
 function sudokubutton.init(self)
@@ -104,6 +106,16 @@ function sudokubutton.init(self)
 	self.FontSpec = self.FontSpec or "__main:24"
 	self.Height = "free"
 	return ui.text.init(self)
+end
+
+function sudokubutton:connectGlobal(app, window)
+	ui.Text.connectGlobal(self, app, window)
+	self:addNotify("Pressed", false, NOTIFY_RELEASE)
+end
+
+function sudokubutton:disconnectGlobal()
+	self:remNotify("Pressed", false, NOTIFY_RELEASE)
+	ui.Text.disconnectGlobal(self)
 end
 
 function sudokubutton:onRelease()
@@ -293,13 +305,18 @@ field = {
 -------------------------------------------------------------------------------
 
 ui.application:new {
+
+	help = false,
+
 	modify = function(self)
 		field.current, field.current_c = nil, nil
 	end,
+
 	newcode = function(self, val)
 		field:newcode(val)
 		self:newsudoku()
 	end,
+
 	newsudoku = function(self)
 		field:new() -- new field on empty stack
 		field:fresh() -- new sudoku
@@ -312,6 +329,7 @@ ui.application:new {
 		field.riddle = field:pop() -- save riddle
 		self:modify()
 	end,
+
 	Children = {
 		ui.window:new {
 			Title = "Sudoku",


More information about the tekui-devel mailing list