Skip to content

Instantly share code, notes, and snippets.

@anaselli
Created March 22, 2016 09:11
Show Gist options
  • Save anaselli/2b32620a938053e184e9 to your computer and use it in GitHub Desktop.
Save anaselli/2b32620a938053e184e9 to your computer and use it in GitHub Desktop.
YItemCollection issue in python bindings
import yui
# enable logging for debug
log = yui.YUILog.instance()
log.setLogFileName("debug.log")
log.enableDebugLogging( True )
factory = yui.YUI.widgetFactory()
dialog = factory.createMainDialog()
VBox = factory.createVBox(dialog)
yTableHeader = yui.YTableHeader()
yTableHeader.addColumn("package")
yTableHeader.addColumn("version")
yTableHeader.addColumn("release")
yTableHeader.addColumn("arch")
myTableMinSize = factory.createMinSize(VBox, 50, 12)
myTable = factory.createTable(myTableMinSize, yTableHeader)
myOK = factory.createPushButton(VBox, "OK")
# note YItemCollection have problems
# uncomment (1) to see the layout (10 elements is not so slow with addItem)
# and comment (2) to remove addItems
ic = yui.YItemCollection()
for pkg in range(1,10):
name = "name-{0}".format(pkg)
item = yui.YTableItem(name , "1.0", "1", "i585")
#myTable.addItem(item) # (1)
ic.push_back(item) # (2)
myTable.addItems(ic) #(2)
event1 = dialog.waitForEvent()
dialog.destroy()
@anaselli
Copy link
Author

To fix this issue item must be disowned the syntax is
item.this.own(False)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment