# # Table example # taken from https://bugzilla.novell.com/show_bug.cgi?id=449842#c10 # # ensure we're using the latest build, if called from our build environment import sys sys.path.insert(0,'../../../build/swig/python') import yui # enable logging for debug log = yui.YUILog.instance() log.setLogFileName("debug.log") log.enableDebugLogging( True ) factory = yui.YUI.widgetFactory() dialog = factory.createMainDialog() #yui.YUILoader.loadWE("mga", "_Z8createWEv") yui.YUILoader.loadWE("mga") #weFactory = yui.YMGAWidgetFactory(yui.YExternalWidgets.widgetExtensionFactory()) weFactory = yui.YMGAWidgetFactory.getYMGAWidgetFactory(yui.YExternalWidgets.widgetExtensionFactory()) VBox = factory.createVBox(dialog) yTableHeader = yui.YTableHeader() yTableHeader.addColumn("aaaaa") yTableHeader.addColumn("bbbbb") yTableHeader.addColumn("ccccc") yTableHeader.addColumn("ddddd") myTableMinSize = factory.createMinSize(VBox, 50, 12) myTable = weFactory.createTable(myTableMinSize, yTableHeader, 3) #myTable = factory.createTable(myTableMinSize, yTableHeader, 2) mySelBox = factory.createSelectionBox(VBox, "testSelectionBox") myOK = factory.createPushButton(VBox, "OK") pp = yui.YItemCollection() # note YItemCollection seems unavailable ! myItem = yui.YTableItem("X", "foo", "1.2.1", "qwertz") print myItem.thisown pp.push_back(myItem) myItem.thisown = 0 print myItem.thisown print pp[0].thisown #myTable.addItem(myItem) myItem = yui.YTableItem("", "bar", "1.3.1", "asdasdasd") #myItem = yui.YTableItem() #myCell = factory.createCheckBox(0,"uffa"); pp.push_back(myItem) myItem.thisown = 0 print myItem.thisown print pp[1].thisown #myTable.addItem(myItem2) myTable.addItems(pp) pp.clear() event1 = dialog.waitForEvent() print 1 #pp.clear() myTable.deleteAllItems() print 2 #crashes now. print 3 # if not "del" before, crashes here. myItem= yui.YTableItem("X3", "foo3", "1.2.13", "qwertz3") print 4 pp.push_back(myItem) myItem.thisown = 0 print 5 myItem = yui.YTableItem("4", "bar4", "1.3.14", "asdasdasd4") print 6 pp.push_back(myItem) myItem.thisown = 0 #myTable.addItem(myItem2) print 7 myTable.addItems(pp) print 8 # should already have crashed event2 = dialog.waitForEvent() print 9 #myTable.deleteAllItems() dialog.destroy()