eric6/HexEdit/HexEditChunks.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8207
d359172d11be
--- a/eric6/HexEdit/HexEditChunks.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/HexEdit/HexEditChunks.py	Tue Mar 02 17:17:09 2021 +0100
@@ -33,9 +33,9 @@
     interface. When the app uses a QByteArray or Python bytearray interface,
     QBuffer is used to provide again a QIODevice like interface. No data will
     be changed, therefore HexEditChunks opens the QIODevice in
-    QIODevice.ReadOnly mode. After every access HexEditChunks closes the
-    QIODevice. That's why external applications can overwrite files while
-    HexEditWidget shows them.
+    QIODevice.OpenModeFlag.ReadOnly mode. After every access HexEditChunks
+    closes the QIODevice. That's why external applications can overwrite
+    files while HexEditWidget shows them.
 
     When the the user starts to edit the data, HexEditChunks creates a local
     copy of a chunk of data (4 kilobytes) and notes all changes there. Parallel
@@ -74,7 +74,7 @@
         @rtype bool
         """
         self.__ioDevice = ioDevice
-        ok = self.__ioDevice.open(QIODevice.ReadOnly)
+        ok = self.__ioDevice.open(QIODevice.OpenModeFlag.ReadOnly)
         if ok:
             # open successfully
             self.__size = self.__ioDevice.size()
@@ -119,7 +119,7 @@
         elif (pos + maxSize) > self.__size:
             maxSize = self.__size - pos
         
-        self.__ioDevice.open(QIODevice.ReadOnly)
+        self.__ioDevice.open(QIODevice.OpenModeFlag.ReadOnly)
         
         while maxSize > 0:
             chunk.absPos = sys.maxsize
@@ -185,7 +185,7 @@
             # write all data
             count = self.__size
         
-        ok = ioDevice.open(QIODevice.WriteOnly)
+        ok = ioDevice.open(QIODevice.OpenModeFlag.WriteOnly)
         if ok:
             idx = pos
             while idx < count:
@@ -434,7 +434,7 @@
             newChunk = HexEditChunk()
             readAbsPos = absPos - ioDelta
             readPos = readAbsPos & self.READ_CHUNK_MASK
-            self.__ioDevice.open(QIODevice.ReadOnly)
+            self.__ioDevice.open(QIODevice.OpenModeFlag.ReadOnly)
             self.__ioDevice.seek(readPos)
             newChunk.data = bytearray(self.__ioDevice.read(self.CHUNK_SIZE))
             self.__ioDevice.close()

eric ide

mercurial