From: John L. <jr...@us...> - 2007-06-05 21:07:29
|
Update of /cvsroot/wxlua/wxLua/samples In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv30959/wxLua/samples Modified Files: choices.wx.lua editor.wx.lua unittest.wx.lua wxluasudoku.wx.lua Log Message: Fix a number of bugs with the new bindings fix override wxConfig::Get fix looking up overloaded static and non static class member functions fix looking up class member functions overloaded from a base class Index: choices.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/choices.wx.lua,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** choices.wx.lua 31 May 2007 17:18:55 -0000 1.11 --- choices.wx.lua 5 Jun 2007 21:07:26 -0000 1.12 *************** *** 58,61 **** --- 58,66 ---- wx.wxDefaultPosition, wx.wxDefaultSize, choices) + -- Test the binding generator to properly overload + -- wxComboBox::SetSelection(int from, int to) (to mark text) and + -- wxControlWithItems::SetSelection(int sel) + comboBox:SetSelection(2) + comboBox:SetSelection(1, 3) local choice = wx.wxChoice(panel2, wx.wxID_ANY, wx.wxDefaultPosition, wx.wxDefaultSize, Index: wxluasudoku.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/wxluasudoku.wx.lua,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** wxluasudoku.wx.lua 31 May 2007 21:38:49 -0000 1.68 --- wxluasudoku.wx.lua 5 Jun 2007 21:07:26 -0000 1.69 *************** *** 2042,2045 **** --- 2042,2047 ---- pageSetupData = wx.wxPageSetupDialogData(), + config = nil, -- the wxFileConfig for saving preferences + Colours = {}, -- table of wxColours to use, indexes below VALUE_COLOUR = 1, *************** *** 4247,4256 **** function sudokuGUI.ConfigSave(save_prefs) ! local config = wx.wxConfigBase.Get(false) ! if not config then ! config = wx.wxFileConfig("wxLuaSudoku", "wxLua") end ! if not config then return end -- write the frame position so we can restore it --- 4249,4257 ---- function sudokuGUI.ConfigSave(save_prefs) ! if not sudokuGUI.config then ! sudokuGUI.config = wx.wxFileConfig("wxLuaSudoku", "wxLua") end ! if not sudokuGUI.config then return end -- write the frame position so we can restore it *************** *** 4258,4262 **** local w, h = sudokuGUI.frame:GetClientSizeWH() local max = booltoint(sudokuGUI.frame:IsMaximized()) ! config:Write("wxLuaSudoku/Frame", string.format("x:%d y:%d w:%d h:%d maximized:%d", x, y, w, h, max)) if not save_prefs then return end --- 4259,4263 ---- local w, h = sudokuGUI.frame:GetClientSizeWH() local max = booltoint(sudokuGUI.frame:IsMaximized()) ! sudokuGUI.config:Write("wxLuaSudoku/Frame", string.format("x:%d y:%d w:%d h:%d maximized:%d", x, y, w, h, max)) if not save_prefs then return end *************** *** 4278,4296 **** end ! if config then ! sudokuGUI.ConfigReadWrite(false, config) ! config:Flush(true) end end function sudokuGUI.ConfigLoad() ! local config = wx.wxConfigBase.Get(false) ! if not config then ! config = wx.wxFileConfig("wxLuaSudoku", "wxLua") end ! if config then local dispX, dispY, dispW, dispH = wx.wxClientDisplayRect() ! local _, str = config:Read("wxLuaSudoku/Frame") local x, y, w, h, max = string.match(str, "x:(%d+) y:(%d+) w:(%d+) h:(%d+) maximized:(%d+)") if (x ~= nil) and (y ~= nil) and (w ~= nil) and (h ~= nil) and (max ~= nil) then --- 4279,4296 ---- end ! if sudokuGUI.config then ! sudokuGUI.ConfigReadWrite(false, sudokuGUI.config) ! sudokuGUI.config:Flush(true) end end function sudokuGUI.ConfigLoad() ! if not sudokuGUI.config then ! sudokuGUI.config = wx.wxFileConfig("wxLuaSudoku", "wxLua") end ! if sudokuGUI.config then local dispX, dispY, dispW, dispH = wx.wxClientDisplayRect() ! local _, str = sudokuGUI.config:Read("wxLuaSudoku/Frame") local x, y, w, h, max = string.match(str, "x:(%d+) y:(%d+) w:(%d+) h:(%d+) maximized:(%d+)") if (x ~= nil) and (y ~= nil) and (w ~= nil) and (h ~= nil) and (max ~= nil) then *************** *** 4310,4314 **** end ! sudokuGUI.ConfigReadWrite(true, config) end --- 4310,4314 ---- end ! sudokuGUI.ConfigReadWrite(true, sudokuGUI.config) end Index: editor.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/editor.wx.lua,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** editor.wx.lua 31 May 2007 21:38:49 -0000 1.51 --- editor.wx.lua 5 Jun 2007 21:07:26 -0000 1.52 *************** *** 174,181 **** -- ---------------------------------------------------------------------------- -- Initialize the wxConfig for loading/saving the preferences - editorApp:SetVendorName("Lomtick Software") - editorApp:SetAppName("wxLua IDE") ! config = wx.wxConfigBase.Get() if config then config:SetRecordDefaults() --- 174,179 ---- -- ---------------------------------------------------------------------------- -- Initialize the wxConfig for loading/saving the preferences ! config = wx.wxFileConfig("wxLuaIDE", "WXLUA") if config then config:SetRecordDefaults() *************** *** 2327,2331 **** ConfigSaveFramePosition(frame, "MainFrame") ! config:Set():Delete() event:Skip() CloseWatchWindow() --- 2325,2329 ---- ConfigSaveFramePosition(frame, "MainFrame") ! config:Delete() -- always delete the config event:Skip() CloseWatchWindow() Index: unittest.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/unittest.wx.lua,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** unittest.wx.lua 31 May 2007 17:18:56 -0000 1.7 --- unittest.wx.lua 5 Jun 2007 21:07:26 -0000 1.8 *************** *** 47,51 **** -- --------------------------------------------------------------------------- ! print("\nSimple bindings tests.\n") -- --------------------------------------------------------------------------- --- 47,51 ---- -- --------------------------------------------------------------------------- ! print("\nSimple bindings tests of numbers, strings, objects.\n") -- --------------------------------------------------------------------------- *************** *** 53,68 **** PrintOk(a == wx.wxID_ANY and a == -1, "Test %define wxID_ANY == -1") a = wx.wxEVT_NULL ! PrintOk(a == wx.wxEVT_NULL, "Test %define %event wxEVT_NULL == -1") a = wx.wxIMAGE_OPTION_CUR_HOTSPOT_X ! PrintOk(a == wx.wxIMAGE_OPTION_CUR_HOTSPOT_X and a == "HotSpotX", "Test %define %string wxIMAGE_OPTION_CUR_HOTSPOT_X") a = wx.wxNullColour ! PrintOk(a:Ok() == false, "Test %define %object wxNullColour is not Ok()") a = wx.wxThePenList ! PrintOk(a:FindOrCreatePen(wx.wxColour(1,2,3), 1, wx.wxSOLID):Ok(), "Test %define %pointer wxThePenList:FindOrCreatePen(wx.wxColour, 1, wx.wxSOLID)") ! PrintOk(a:FindOrCreatePen(wx.wxRED, 1, wx.wxSOLID):Ok(), "Test %define %pointer wxThePenList:FindOrCreatePen(wx.wxRED, 1, wx.wxSOLID)") -- --------------------------------------------------------------------------- --- 53,77 ---- PrintOk(a == wx.wxID_ANY and a == -1, "Test %define wxID_ANY == -1") + a = wx.wxACCEL_NORMAL + PrintOk(a == wx.wxACCEL_NORMAL and a == 0, "Test %enum wxACCEL_NORMAL == 0") + + a = wx.wxFILE_KIND_UNKNOWN + PrintOk(a == wx.wxFILE_KIND_UNKNOWN and a == 0, "Test %enum wxFileKind::wxFILE_KIND_UNKNOWN == 0") + + a = wx.wxFile.read + PrintOk(a == wx.wxFile.read and a == 0, "Test %enum wxFile::OpenMode::read == 0") + a = wx.wxEVT_NULL ! PrintOk(a == wx.wxEVT_NULL, "Test %define_event wxEVT_NULL == -1") a = wx.wxIMAGE_OPTION_CUR_HOTSPOT_X ! PrintOk(a == wx.wxIMAGE_OPTION_CUR_HOTSPOT_X and a == "HotSpotX", "Test %define_string wxIMAGE_OPTION_CUR_HOTSPOT_X") a = wx.wxNullColour ! PrintOk(a:Ok() == false, "Test %define_object wxNullColour is not Ok()") a = wx.wxThePenList ! PrintOk(a:FindOrCreatePen(wx.wxColour(1,2,3), 1, wx.wxSOLID):Ok(), "Test %define_pointer wxThePenList:FindOrCreatePen(wx.wxColour, 1, wx.wxSOLID) is Ok()") ! PrintOk(a:FindOrCreatePen(wx.wxRED, 1, wx.wxSOLID):Ok(), "Test %define_pointer wxThePenList:FindOrCreatePen(wx.wxRED, 1, wx.wxSOLID) is Ok()") -- --------------------------------------------------------------------------- *************** *** 82,85 **** --- 91,95 ---- pt.x = 10 PrintOk(pt:GetX() == 10, "%rename %member using wxPoint.x = 10; wxPoint:GetX()") + PrintOk(pt.GetX(pt) == 10, "%rename %member using wxPoint.x = 10; wxPoint.GetX(self)") pt:SetX(20) PrintOk(pt.x == 20, "%rename %member using wxPoint:SetX(20); wxPoint.x") *************** *** 105,110 **** -- Test static functions and calling them ! f = wx.wxFileName('a') ! PrintOk(f:GetCwd() == wx.wxFileName.GetCwd(), "Calling static wxString wxFileName::GetCwd(), as member and static.") -- Test new() constructor function and copying it --- 115,124 ---- -- Test static functions and calling them ! fname = 'a321.123X!x!' ! f = wx.wxFileName(fname) ! PrintOk(f.GetCwd() == wx.wxFileName.GetCwd(), "Calling static wxString wxFileName::GetCwd(), as static member and static global.") ! ! -- Test overloaded static and non static functions ! PrintOk(f:FileExists() == wx.wxFileName.FileExists(fname), "Calling static wxFileName::FileExists(str) == member wxFileName::FileExists.") -- Test new() constructor function and copying it |