Skip to content

shapeworks::PythonWorker

Inherits from QObject

Public Slots

Name
bool init()
void start_job(QSharedPointer< Job > job)
void finalize_python()

Public Signals

Name
void result_ready()
void finished()

Public Functions

Name
PythonWorker()
~PythonWorker()
void set_vtk_output_window(vtkSmartPointer< ShapeWorksVtkOutputWindow > output_window)
void set_cli_mode(bool cli_mode)
void run_job(QSharedPointer< Job > job)
void set_current_job(QSharedPointer< Job > job)
void incoming_python_message(std::string message_string)
void incoming_python_progress(double value, std::string message)
void end_python()
void abort_job()
bool is_torch_available()
bool install_torch(std::function< void(std::string)> output_callback =nullptr)
std::string get_user_site_packages()

Public Attributes

Name
constexpr static const char * python_api_version

Public Slots Documentation

slot init

bool init()

slot start_job

void start_job(
    QSharedPointer< Job > job
)

slot finalize_python

void finalize_python()

Public Signals Documentation

signal result_ready

void result_ready()

signal finished

void finished()

Public Functions Documentation

function PythonWorker

PythonWorker()

function ~PythonWorker

~PythonWorker()

function set_vtk_output_window

void set_vtk_output_window(
    vtkSmartPointer< ShapeWorksVtkOutputWindow > output_window
)

function set_cli_mode

void set_cli_mode(
    bool cli_mode
)

function run_job

void run_job(
    QSharedPointer< Job > job
)

function set_current_job

void set_current_job(
    QSharedPointer< Job > job
)

function incoming_python_message

void incoming_python_message(
    std::string message_string
)

function incoming_python_progress

void incoming_python_progress(
    double value,
    std::string message
)

function end_python

void end_python()

function abort_job

void abort_job()

function is_torch_available

static bool is_torch_available()

Check if PyTorch is available in the bundled Python. Returns true if torch can be imported successfully.

function install_torch

static bool install_torch(
    std::function< void(std::string)> output_callback =nullptr
)

Install PyTorch via light-the-torch into the user site-packages directory. The output_callback receives lines of output from the install process. Returns true on success.

function get_user_site_packages

static std::string get_user_site_packages()

Get the versioned user site-packages directory for on-demand package installs. e.g. ~/Library/Application Support/ShapeWorks/6.7/site-packages/

Public Attributes Documentation

variable python_api_version

static constexpr static const char * python_api_version = "6.8";

Updated on 2026-06-30 at 16:03:27 +0000