eric6/HexEdit/HexEditWidget.py

changeset 8205
4a0f1f896341
parent 8143
2c730d5fd177
child 8217
385f60c94548
--- a/eric6/HexEdit/HexEditWidget.py	Thu Apr 08 17:27:12 2021 +0200
+++ b/eric6/HexEdit/HexEditWidget.py	Thu Apr 08 18:27:47 2021 +0200
@@ -460,16 +460,17 @@
         @rtype bool
         @exception TypeError raised to indicate a wrong parameter type
         """
+        if not isinstance(dataOrDevice, (bytearray, QByteArray, QIODevice)):
+            raise TypeError(
+                "setData: parameter must be bytearray, "
+                "QByteArray or QIODevice")
+        
         if isinstance(dataOrDevice, (bytearray, QByteArray)):
             self.__data = bytearray(dataOrDevice)
             self.__bData.setData(self.__data)
             return self.__setData(self.__bData)
-        elif isinstance(dataOrDevice, QIODevice):
+        else:
             return self.__setData(dataOrDevice)
-        else:
-            raise TypeError(
-                "setData: parameter must be bytearray, "
-                "QByteArray or QIODevice")
     
     def __setData(self, ioDevice):
         """

eric ide

mercurial