Skip to content

IODeviceMixin

Sub classes

Name Children Inherits
IODevice
prettyqt.core.iodevice
The base interface class of all I/O devices in Qt.
    FileDeviceMixin
    prettyqt.core.filedevice
    Interface for reading from and writing to open files.
    Buffer
    prettyqt.core.buffer
    QIODevice interface for a QByteArray.
      Process
      prettyqt.core.process
      Used to start external programs and to communicate with them.
        BluetoothSocket
        prettyqt.bluetooth.bluetoothsocket
        Enables connection to a Bluetooth device running a bluetooth server.
          AbstractSocketMixin
          prettyqt.network.abstractsocket
          LocalSocket
          prettyqt.network.localsocket
          Local socket.

            Base classes

            Name Children Inherits
            ObjectMixin
            prettyqt.core.object
            object
            builtins
            The base class of the class hierarchy.
            • type
            • async_generator
            • bytearray_iterator
            • bytearray
            • bytes_iterator
            • bytes
            • builtin_function_or_method
            • callable_iterator
            • PyCapsule
            • cell
            • classmethod_descriptor
            • ...

              ⋔ Inheritance diagram

              graph TD
                1351663398["core.IODeviceMixin"]
                3227531497["core.ObjectMixin"]
                2751680898["builtins.object"]
                3227531497 --> 1351663398
                2751680898 --> 3227531497
                2751680898 --> 1351663398

              🛈 DocStrings

              Bases: ObjectMixin, _IODeviceBase

              Source code in prettyqt/core/iodevice.py
              class IODeviceMixin(core.ObjectMixin, _IODeviceBase):
                  def __len__(self):
                      return self.size()
              
                  @contextlib.contextmanager
                  def open_file(self, mode: OpenModeStr | mod.OpenModeFlag):
                      self.open(OPEN_MODES.get_enum_value(mode))
                      try:
                          yield self
                      finally:
                          self.close()
              
                  def get_open_mode(self) -> OpenModeStr:
                      return OPEN_MODES.inverse[self.openMode()]
              

              :fa-brands-github: Show source on GitHub