Пример #1
0
 def testPropertyValues(self):
     app = QApplication(sys.argv)
     textEdit = QPlainTextEdit()
     textEdit.insertPlainText("PySide INdT")
     selection = QTextEdit.ExtraSelection()
     selection.cursor = textEdit.textCursor()
     selection.cursor.setPosition(2)
     self.assertEqual(selection.cursor.position(), 2)
Пример #2
0
class Overall(QWizardPage):
    def __init__(self, parent):
        super(Overall, self).__init__(parent)

        self.setTitle("Overall")
        self.setSubTitle("Describe the individual overall.")

        self.comments = QPlainTextEdit(self)
        self.comments.textChanged.connect(self.overall_changed)

        self.registerField("overall.comments*",
                           self.comments,
                           "plainText",
                           SIGNAL("textChanged()"))

        layout = QGridLayout(self)

        layout.addWidget(QLabel(self.tr("Comments:"), self), 0, 0)
        layout.addWidget(self.comments,                      0, 1)

    def overall_changed(self):
        if len(self.comments.toPlainText()) >= 257:
            self.comments.textCursor().deletePreviousChar()
Пример #3
0
    def _create_changes(self):
        c = QPlainTextEdit()
        c.setReadOnly(True)
        txt = ''
        for i in range(10):
            for a, d, m in self.changes:
                txt += '<p>{} {}</p><p><b><pre> {}</pre></b></p>'.format(a, d, m)

        c.appendHtml(txt)
        cur = c.textCursor()
        cur.movePosition(QtGui.QTextCursor.Start)
        c.setTextCursor(cur)
        c.ensureCursorVisible()
        return c
Пример #4
0
    def _create_changes(self):
        c=QPlainTextEdit()
        c.setReadOnly(True)
        txt=''
        for i in range(10):
            for a,d,m in self.changes:
                txt+='<p>{} {}</p><p><b><pre> {}</pre></b></p>'.format(a,d, m)

        c.appendHtml(txt)
        cur=c.textCursor()
        cur.movePosition(QtGui.QTextCursor.Start)
        c.setTextCursor(cur)
        c.ensureCursorVisible()
        return c
Пример #5
0
class AbstractEntry(QWizardPage):
    def __init__(self, parent, title, sub_title):
        super(AbstractEntry, self).__init__(parent)

        self.setTitle(title)
        self.setSubTitle(sub_title)

        self.score = QComboBox(self)

        self.score.insertItems(5,
                               ["1 - Poor",
                                "2 - Fair",
                                "3 - Good",
                                "4 - Great",
                                "5 - Outstanding"])

        self.comments = QPlainTextEdit(self)
        self.comments.textChanged.connect(self.comments_changed)

        field = "%s.comments*" % title

        self.registerField(field,
                           self.comments,
                           "plainText",
                           SIGNAL("textChanged()"))

        layout = QGridLayout(self)

        layout.addWidget(QLabel(self.tr("Score:"), self),    0, 0)
        layout.addWidget(self.score,                         0, 1)
        layout.addWidget(QLabel(self.tr("Comments:"), self), 1, 0)
        layout.addWidget(self.comments,                      1, 1)

    def comments_changed(self):
        if len(self.comments.toPlainText()) >= 257:
            self.comments.textCursor().deletePreviousChar()