PyQt dialog modality

Previous topic - Next topic

Juha

I have Scribus 1.4.4 on windows 7 system and I want to build own extented scripts. I have chosen PyQt4 that I have installed. I am trying to run my own PyQt scripts from Scribus menu. PyQt modality seems to be the problem. Problem: If I use QDialog show() function the dialog will not be modal(not shown) and script returns instantly. I do not now how to implement QDialog modality correcly? I can have dialog remain modal if I use window.exec_() but it is blocking everything else and mouse cursor remains in wait state.

I have followed these instructions:
http://www.scribus.net/svn/Scribus/trunk/Scribus/doc/en/scripter-extensions.html

My script:

import sys
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import *
import scribus

app = QtGui.qApp

window = QtGui.QDialog()

window.setWindowTitle("Hello World")
window.setModal(True)

nameLabel = QLabel("Name:")
nameEdit = QLineEdit()
addressLabel = QLabel("Address:")
addressEdit = QTextEdit()

layout = QGridLayout(window)
layout.addWidget(nameLabel, 0, 0)
layout.addWidget(nameEdit, 0, 1)
layout.addWidget(addressLabel, 1, 0)
layout.addWidget(addressEdit, 1, 1)
layout.setRowStretch(2, 1)

window.resize(480, 160)

window.show()