Ejemplo n.º 1
0
 def setContents(self, value, silent=False):
     self.setPlainText(expression.evaluate_expressions(value))
     if not silent:
         self.update_parent()
     block = self.document().firstBlock()
     w = self.document().documentLayout().blockBoundingRect(block).width()
     self.offset = max(w - 140, 0)
     block.layout().lineAt(0).setPosition(QtCore.QPointF(-self.offset,0))
     self.validate(value)
Ejemplo n.º 2
0
 def setContents(self, value, silent=False):
     self.setPlainText(expression.evaluate_expressions(value))
     if not silent:
         self.update_parent()
     block = self.document().firstBlock()
     w = self.document().documentLayout().blockBoundingRect(block).width()
     self.offset = max(w - 140, 0)
     block.layout().lineAt(0).setPosition(QtCore.QPointF(-self.offset, 0))
     self.validate(value)
    def update_text(self):
        """ update_text() -> None
        Update the text to the result of the evaluation

        """
        # FIXME: eval should pretty much never be used
        base = expression.evaluate_expressions(self.text())
        if self._contentType == 'String':
            self.setText(base)
        else:
            try:
                self.setText(str(eval(str(base), None, None)))
            except:
                self.setText(base)
 def contents(self):
     contents = expression.evaluate_expressions(unicode(self.toPlainText()))
     self.setPlainText(contents)
     return contents
 def setContents(self, contents):
     self.setPlainText(expression.evaluate_expressions(contents))
Ejemplo n.º 6
0
 def contents(self):
     contents = expression.evaluate_expressions(unicode(self.text()))
     self.setText(contents)
     self.validate(contents)
     return contents
Ejemplo n.º 7
0
 def setContents(self, value, silent=False):
     self.setText(expression.evaluate_expressions(value))
     self.validate(value)
     if not silent:
         self.update_parent()
Ejemplo n.º 8
0
 def contents(self):
     contents = expression.evaluate_expressions(unicode(self.toPlainText()))
     self.setPlainText(contents)
     return contents
Ejemplo n.º 9
0
 def setContents(self, contents):
     self.setPlainText(expression.evaluate_expressions(contents))
Ejemplo n.º 10
0
 def contents(self):
     contents = expression.evaluate_expressions(unicode(self.text()))
     self.setText(contents)
     self.validate(contents)
     return contents
Ejemplo n.º 11
0
 def setContents(self, value, silent=False):
     self.setText(expression.evaluate_expressions(value))
     self.validate(value)
     if not silent:
         self.update_parent()