Skip to content

Process

Qt Base Class: QProcess

Signature: QProcess(self, parent: Optional[PySide6.QtCore.QObject] = None) -> None

Base classes

Name Children Inherits
IODeviceMixin
prettyqt.core.iodevice
QProcess
PySide6.QtCore
QProcess(self, parent: Optional[PySide6.QtCore.QObject] \= None) -> None

⋔ Inheritance diagram

graph TD
  1473299878464["core.Process"]
  1473299871632["core.IODeviceMixin"]
  1473299815024["core.ObjectMixin"]
  140713234304496["builtins.object"]
  1473288852976["QtCore.QProcess"]
  1473288885184["QtCore.QIODevice"]
  1473288842240["QtCore.QObject"]
  1473291690208["Shiboken.Object"]
  1473243629040["QtCore.QIODeviceBase"]
  1473299871632 --> 1473299878464
  1473299815024 --> 1473299871632
  140713234304496 --> 1473299815024
  1473288852976 --> 1473299878464
  1473288885184 --> 1473288852976
  1473288842240 --> 1473288885184
  1473291690208 --> 1473288842240
  140713234304496 --> 1473291690208
  1473243629040 --> 1473288885184
  1473291690208 --> 1473243629040

🛈 DocStrings

Bases: IODeviceMixin, QProcess

Used to start external programs and to communicate with them.

Source code in prettyqt\core\process.py
class Process(core.IODeviceMixin, core.QProcess):
    """Used to start external programs and to communicate with them."""

    def set_read_channel(
        self, channel: ProcessChannelStr | core.QProcess.ProcessChannelMode
    ):
        """Set the input channel channel.

        Args:
            channel: channel to set
        """
        self.setReadChannel(PROCESS_CHANNELS.get_enum_value(channel))

    def get_read_channel(self) -> ProcessChannelStr:
        return PROCESS_CHANNELS.inverse[self.readChannel()]

    def close_read_channel(self, channel: ProcessChannelStr):
        self.closeReadChannel(PROCESS_CHANNELS[channel])

    def set_input_channel_mode(
        self, mode: InputChannelModeStr | core.QProcess.InputChannelMode
    ):
        """Set the input channel mode.

        Args:
            mode: mode to set
        """
        self.setInputChannelMode(INPUT_CHANNEL_MODES.get_enum_value(mode))

    def get_input_channel_mode(self) -> InputChannelModeStr:
        return INPUT_CHANNEL_MODES.inverse[self.inputChannelMode()]

    def set_process_channel_mode(
        self, mode: ProcessChannelModeStr | core.QProcess.ProcessChannelMode
    ):
        """Set the process channel mode.

        Args:
            mode: mode to set
        """
        self.setProcessChannelMode(PROCESS_CHANNEL_MODES.get_enum_value(mode))

    def get_process_channel_mode(self) -> ProcessChannelModeStr:
        return PROCESS_CHANNEL_MODES.inverse[self.processChannelMode()]

    def set_state(self, state: ProcessStateStr | core.QProcess.ProcessState):
        """Set the process state.

        Args:
            state: state to set
        """
        self.setProcessState(PROCESS_STATES.get_enum_value(state))

    def get_state(self) -> ProcessStateStr:
        return PROCESS_STATES.inverse[self.state()]

    def get_error(self) -> ProcessErrorStr:
        return PROCESS_ERRORS.inverse[self.error()]

    def get_exit_status(self) -> ExitStatusStr:
        return EXIT_STATUS.inverse[self.exitStatus()]

    def get_process_environment(self) -> core.ProcessEnvironment:
        return core.ProcessEnvironment(self.processEnvironment())

    @contextlib.contextmanager
    def edit_process_environment(self):
        env = self.get_process_environment()
        yield env
        self.setProcessEnvironment(env)

set_input_channel_mode(mode: InputChannelModeStr | core.QProcess.InputChannelMode)

Set the input channel mode.

Parameters:

Name Type Description Default
mode InputChannelModeStr | InputChannelMode

mode to set

required
Source code in prettyqt\core\process.py
def set_input_channel_mode(
    self, mode: InputChannelModeStr | core.QProcess.InputChannelMode
):
    """Set the input channel mode.

    Args:
        mode: mode to set
    """
    self.setInputChannelMode(INPUT_CHANNEL_MODES.get_enum_value(mode))

set_process_channel_mode(mode: ProcessChannelModeStr | core.QProcess.ProcessChannelMode)

Set the process channel mode.

Parameters:

Name Type Description Default
mode ProcessChannelModeStr | ProcessChannelMode

mode to set

required
Source code in prettyqt\core\process.py
def set_process_channel_mode(
    self, mode: ProcessChannelModeStr | core.QProcess.ProcessChannelMode
):
    """Set the process channel mode.

    Args:
        mode: mode to set
    """
    self.setProcessChannelMode(PROCESS_CHANNEL_MODES.get_enum_value(mode))

set_read_channel(channel: ProcessChannelStr | core.QProcess.ProcessChannelMode)

Set the input channel channel.

Parameters:

Name Type Description Default
channel ProcessChannelStr | ProcessChannelMode

channel to set

required
Source code in prettyqt\core\process.py
def set_read_channel(
    self, channel: ProcessChannelStr | core.QProcess.ProcessChannelMode
):
    """Set the input channel channel.

    Args:
        channel: channel to set
    """
    self.setReadChannel(PROCESS_CHANNELS.get_enum_value(channel))

set_state(state: ProcessStateStr | core.QProcess.ProcessState)

Set the process state.

Parameters:

Name Type Description Default
state ProcessStateStr | ProcessState

state to set

required
Source code in prettyqt\core\process.py
def set_state(self, state: ProcessStateStr | core.QProcess.ProcessState):
    """Set the process state.

    Args:
        state: state to set
    """
    self.setProcessState(PROCESS_STATES.get_enum_value(state))

⌗ Property table

Qt Property Type Doc
objectName QString