PDA

View Full Version : vizdlg inside a vizinfo


sbilleter
12-02-2015, 07:57 AM
Is it possible to integrate a AskDialog into an InfoPanel ?

It seems that it is possible to add a vizdlg.Panel as a simple part of the InfoPanel
(Custom GUI Layout of the Vizard documentation). And as the AdkDialog is inheritating from the Dialog and then the Panel, it should be possible, but for the moment, my InfoPanel is just empty

Can you help me ?

it would be much easier than recreating the Askdialog inside the InfoPanel.
Thanks.

Stéphane

Jeff
12-04-2015, 10:53 AM
Yes, here's an example:

import viz
import vizinfo
import vizdlg
import viztask

viz.go()

dojo = viz.addChild('dojo.osgb')

info = vizinfo.InfoPanel('An InfoPanel with Dialog')
info.addSeparator()

options = [('Option 1'),('Option 2')]
dialog = vizdlg.AskDialog(options=options, title='Ask Dialog')
info.addItem(dialog)

def showdialog():
while True:
dialog.selection = 0
yield dialog.show()

if dialog.accepted:
print 'accepted', options[dialog.selection]
else:
print 'cancelled'

yield viztask.waitTime(1)

viztask.schedule(showdialog())