2 from PyQt4.QtGui import QTextEdit,QPushButton,QGridLayout,QTextCursor,QDialog,QMessageBox
5 """ QDialog object to edit text by using an editor window.
7 def __init__(self, parent=None, title="Edit text...", text="", readonly=False, help=None):
8 super(TextDialog,self).
__init__(parent)
9 self.setWindowTitle(title)
13 self.
ok = QPushButton(
'Ok', self)
14 self.connect(self.
ok, SIGNAL(
'clicked()'), self.accept)
16 self.
cancel = QPushButton(
'Cancel', self)
17 self.connect(self.
cancel, SIGNAL(
'clicked()'), self.reject)
22 self.edit.setPlainText(self.
text)
24 layout.addWidget(self.
edit,0,0,1,4)
25 layout.addWidget(self.
ok,1,3)
27 layout.addWidget(self.
cancel,1,0)
30 self.setLayout(layout)
31 self.edit.setReadOnly(readonly)
33 self.edit.moveCursor(QTextCursor.End)
36 return self.edit.toPlainText().toAscii()
39 QMessageBox.about(self,
'Info', self.
help)