Mageia Bugzilla – Attachment 6986 Details for
Bug 16600
Yitems are hard to manage in perl bindings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
Comparison test for python binding
test_yitems.py (text/x-python), 848 bytes, created by
Len Lawrence
on 2015-08-31 20:58:55 CEST
(
hide
)
Description:
Comparison test for python binding
Filename:
MIME Type:
Creator:
Len Lawrence
Created:
2015-08-31 20:58:55 CEST
Size:
848 bytes
patch
obsolete
>import sys >import yui > >factory = yui.YUI.widgetFactory() >dialog = factory.createMainDialog() > >VBox = factory.createVBox(dialog) > >mySelMinSize = factory.createMinSize(VBox, 50, 12) >mySel = factory.createSelectionBox(mySelMinSize, "Selection Box") >mySel.setNotify(True); > >myOK = factory.createPushButton(VBox, "OK") > >myItem = yui.YItem( "foo" ) >mySel.addItem(myItem) >myItem2 = yui.YItem( "bar" ) >mySel.addItem(myItem2) > >while True: > event = dialog.waitForEvent() > if event.eventType() == yui.YEvent.CancelEvent: > break > if event.widget() == myOK: > break > if event.widget() == mySel: > item = mySel.selectedItem(); > if item == myItem: > print "item comparison works and you chose", item.label() > elif item == myItem2: > print "item comparison works and you chose", item.label() > else: > print "item comparison does not work" > >dialog.destroy()
import sys import yui factory = yui.YUI.widgetFactory() dialog = factory.createMainDialog() VBox = factory.createVBox(dialog) mySelMinSize = factory.createMinSize(VBox, 50, 12) mySel = factory.createSelectionBox(mySelMinSize, "Selection Box") mySel.setNotify(True); myOK = factory.createPushButton(VBox, "OK") myItem = yui.YItem( "foo" ) mySel.addItem(myItem) myItem2 = yui.YItem( "bar" ) mySel.addItem(myItem2) while True: event = dialog.waitForEvent() if event.eventType() == yui.YEvent.CancelEvent: break if event.widget() == myOK: break if event.widget() == mySel: item = mySel.selectedItem(); if item == myItem: print "item comparison works and you chose", item.label() elif item == myItem2: print "item comparison works and you chose", item.label() else: print "item comparison does not work" dialog.destroy()
View Attachment As Raw
Actions:
View
Attachments on
bug 16600
:
6983
|
6984
|
6985
| 6986 |
6987