458 @type bytearray, QByteArray or QIODevice |
458 @type bytearray, QByteArray or QIODevice |
459 @return flag indicating success |
459 @return flag indicating success |
460 @rtype bool |
460 @rtype bool |
461 @exception TypeError raised to indicate a wrong parameter type |
461 @exception TypeError raised to indicate a wrong parameter type |
462 """ |
462 """ |
|
463 if not isinstance(dataOrDevice, (bytearray, QByteArray, QIODevice)): |
|
464 raise TypeError( |
|
465 "setData: parameter must be bytearray, " |
|
466 "QByteArray or QIODevice") |
|
467 |
463 if isinstance(dataOrDevice, (bytearray, QByteArray)): |
468 if isinstance(dataOrDevice, (bytearray, QByteArray)): |
464 self.__data = bytearray(dataOrDevice) |
469 self.__data = bytearray(dataOrDevice) |
465 self.__bData.setData(self.__data) |
470 self.__bData.setData(self.__data) |
466 return self.__setData(self.__bData) |
471 return self.__setData(self.__bData) |
467 elif isinstance(dataOrDevice, QIODevice): |
472 else: |
468 return self.__setData(dataOrDevice) |
473 return self.__setData(dataOrDevice) |
469 else: |
|
470 raise TypeError( |
|
471 "setData: parameter must be bytearray, " |
|
472 "QByteArray or QIODevice") |
|
473 |
474 |
474 def __setData(self, ioDevice): |
475 def __setData(self, ioDevice): |
475 """ |
476 """ |
476 Private method to set the data to show. |
477 Private method to set the data to show. |
477 |
478 |