| a | b | |
|---|
| 0 | + | import sys |
|---|
| 0 | + | from PySide.QtCore import * |
|---|
| 0 | + | from PySide.QtGui import * |
|---|
| 0 | + | from PySide.QtMaemo5 import * |
|---|
| 0 | + | |
|---|
| 0 | + | class FreezeDialog(QMainWindow): |
|---|
| 0 | + | def __init__(self): |
|---|
| 0 | + | QMainWindow.__init__(self) |
|---|
| 0 | + | self.cw = QWidget(self) |
|---|
| 0 | + | self.setCentralWidget(self.cw) |
|---|
| 0 | + | self.vbox = QVBoxLayout(self.cw) |
|---|
| 0 | + | self.dialog = Dialog(self) |
|---|
| 0 | + | self.button = QPushButton(self) |
|---|
| 0 | + | self.button.setText(QString("Open Dialog")) |
|---|
| 0 | + | self.connect(self.button, SIGNAL("clicked()"), self.dialog.show) |
|---|
| 0 | + | self.vbox.addWidget(self.button) |
|---|
| 0 | + | |
|---|
| 0 | + | class Dialog(QDialog): |
|---|
| 0 | + | def __init__(self, parent): |
|---|
| 0 | + | QDialog.__init__(self) |
|---|
| 0 | + | self.vbox = QVBoxLayout(self) |
|---|
| 0 | + | self.button = QPushButton(self) |
|---|
| 0 | + | self.button.setText(QString("Close")) |
|---|
| 0 | + | self.vbox.addWidget(self.button) |
|---|
| 0 | + | self.connect(self.button, SIGNAL("clicked()"), self.hideDialog) |
|---|
| 0 | + | def hideDialog(self): |
|---|
| 0 | + | # These two ibox rows cause problems. Without them, everything works nicely. |
|---|
| 0 | + | self.ibox = QMaemo5InformationBox() |
|---|
| 0 | + | self.ibox.information(self, "This message will freeze the screen", 3000) |
|---|
| 0 | + | self.hide() |
|---|
| 0 | + | |
|---|
| 0 | + | if __name__ == '__main__': |
|---|
| 0 | + | app = QApplication(sys.argv) |
|---|
| 0 | + | fd = FreezeDialog() |
|---|
| 0 | + | fd.show() |
|---|
| 0 | + | sys.exit(app.exec_()) |
|---|
| ... | |
|---|