enthought/enaml — Issue #104: Dialog is not modal when used inside another application
Author: punchagan
Created: 2012-03-07 14:45:55+00:00
State: open
Labels: BUG

The `show` method of `Dialog` returns immediately to the caller, even when the modality is set to `application_modal`. Below is a minimal example to reproduce the problem.

enamldef ConfirmDialog(Dialog):
attr message: basestring
title = "Confirm"
modality = "application_modal"
Container:
constraints = [
vbox(
label,
hbox(_space_, ok_button, cancel_button),
),
]
Label:
id: label
text = message
PushButton:
id: ok_button
text = "OK"
clicked :: accept()
PushButton:
id: cancel_button
text = "Cancel"
clicked :: reject()

import sys
from PyQt4 import QtCore, QtGui

app = QtGui.QApplication(sys.argv)
hello = QtGui.QLabel("Hello, World")
hello.show()
print 1
dialog = ConfirmDialog(message='foo bar')
dialog.show()
print 2
print dialog.result
sys.exit(app.exec_())