def add(self, item): """add a Text MessageElement to the existing Text Strings can be passed and are automatically converted in to item.Text() Args: Text text, an element to add to the text Returns: None Raises: Errors are propagated """ if self._is_stringable(item) or self._is_qstring(item): self.items.append(PlainText(item)) elif isinstance(item, MessageElement): self.items.append(item) elif isinstance(item, QPyNullVariant): self.items.append( PlainText( tr('Null (PyQt4.QtCore.QPyNullVariant) found from the data.' ))) else: raise InvalidMessageItemError(item, item.__class__)
def add(self, item): """add a Text MessageElement to the existing Text Strings can be passed and are automatically converted in to item.Text() :param item: Text text, an element to add to the text """ if self._is_stringable(item) or self._is_qstring(item): self.items.append(PlainText(item)) elif isinstance(item, MessageElement): self.items.append(item) elif isinstance(item, QPyNullVariant): self.items.append( PlainText( tr('Null (PyQt4.QtCore.QPyNullVariant) found from the data.' ))) elif isinstance(item, tuple) or isinstance(item, list): for i in item: # Recursive call self.add(i) else: raise InvalidMessageItemError(item, item.__class__)
def add(self, item): """add a Text MessageElement to the existing Text Strings can be passed and are automatically converted in to item.Text() Args: Text text, an element to add to the text Returns: None Raises: Errors are propagated """ if isinstance(item, basestring) or self._is_qstring(item): self.items.append(PlainText(item)) elif isinstance(item, MessageElement): self.items.append(item) else: raise InvalidMessageItemError(item, item.__class__)