Skip to content

Commit a0b5b7e

Browse files
committed
Upgrade to pybind11 3.0
First step of the upgrade process. The smart_holder capabilities are probably going to interest us. Some py::enum_ where empty, this made 'finalization' of pybind11's internals fail, som we had to populate these enums.
1 parent 5bf5a9f commit a0b5b7e

File tree

7 files changed

+57
-8
lines changed

7 files changed

+57
-8
lines changed

cmake/PythonEnvHelper.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
macro(ensure_pybind11_cmake_module_is_in_path)
22
execute_process(
3-
COMMAND "${Python_EXECUTABLE}" "-m" "pybind11" "--cmake"
3+
COMMAND "${Python_EXECUTABLE}" "-m" "pybind11" "--cmakedir"
44
RESULT_VARIABLE _PYTHON_SUCCESS
55
OUTPUT_VARIABLE PYBIND11_CMAKE_MODULES_PATH
66
)

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
numpy>=2.0
2-
pybind11>=2.13.0
2+
pybind11>=3.0
33
sphinx>=8.0.0
44
sphinx-rtd-theme
55
pytest>=8.0.0

requirements-release.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
numpy>=2.0
2-
pybind11>=2.13.0
2+
pybind11>=3.0

src/PythonRepl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ void PythonRepl::reset()
195195

196196
void PythonRepl::importNeededPackages()
197197
{
198-
executeCode(replArrows + "import pycc");
199198
executeCode(replArrows + "import cccorelib");
199+
executeCode(replArrows + "import pycc");
200200
executeCode(replArrows + "cc = pycc.GetInstance()");
201201
}
202202

src/Runtime/Runtime.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,27 @@ void unsetCmdLineInterfaceInstance() noexcept
126126

127127
PYBIND11_EMBEDDED_MODULE(ccinternals, m)
128128
{
129-
py::enum_<Qt::GlobalColor>(m, "GlobalColor");
129+
py::enum_<Qt::GlobalColor>(m, "GlobalColor")
130+
.value("color0", Qt::color0)
131+
.value("color1", Qt::color1)
132+
.value("black", Qt::black)
133+
.value("white", Qt::white)
134+
.value("darkGray", Qt::darkGray)
135+
.value("gray", Qt::gray)
136+
.value("lightGray", Qt::lightGray)
137+
.value("red", Qt::red)
138+
.value("green", Qt::green)
139+
.value("blue", Qt::blue)
140+
.value("cyan", Qt::cyan)
141+
.value("magenta", Qt::magenta)
142+
.value("yellow", Qt::yellow)
143+
.value("darkRed", Qt::darkRed)
144+
.value("darkGreen", Qt::darkGreen)
145+
.value("darkBlue", Qt::darkBlue)
146+
.value("darkCyan", Qt::darkCyan)
147+
.value("darkMagenta", Qt::darkMagenta)
148+
.value("darkYellow", Qt::darkYellow)
149+
.value("transparent", Qt::transparent);
130150

131151
py::class_<QColor>(m, "QColor");
132152

src/Runtime/ccCommandLine.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,13 @@ void define_ccCommandLine(py::module &m)
6060

6161
py::class_<ccCommandLineInterface> PyccCommandLineInterface(m, "ccCommandLineInterface");
6262

63-
py::enum_<ccCommandLineInterface::ExportOption>(PyccCommandLineInterface, "ExportOption");
63+
py::enum_<ccCommandLineInterface::ExportOption>(
64+
PyccCommandLineInterface, "ExportOption", py::arithmetic())
65+
.value("NoOptions", ccCommandLineInterface::ExportOption::NoOptions)
66+
.value("ForceCloud", ccCommandLineInterface::ExportOption::ForceCloud)
67+
.value("ForceMesh", ccCommandLineInterface::ExportOption::ForceMesh)
68+
.value("ForceHierarchy", ccCommandLineInterface::ExportOption::ForceHierarchy)
69+
.value("ForceNoTimestamp", ccCommandLineInterface::ExportOption::ForceNoTimestamp);
6470

6571
py::class_<ccCommandLineInterface::GlobalShiftOptions> PyGlobalShiftOptions(
6672
PyccCommandLineInterface, "GlobalShiftOptions");

wrapper/pycc/src/pycc.cpp

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,31 @@ void define_someQtThings(py::module &m)
132132
});
133133

134134
py::class_<QPointF>(m, "QPointF");
135-
// TODO: https://doc.qt.io/qt-5/qt.html#CursorShape-enum
136-
py::enum_<Qt::CursorShape>(m, "QtCursorShape");
135+
py::enum_<Qt::CursorShape>(m, "QtCursorShape")
136+
.value("ArrowCursor", Qt::CursorShape::ArrowCursor)
137+
.value("UpArrowCursor", Qt::CursorShape::UpArrowCursor)
138+
.value("CrossCursor", Qt::CursorShape::CrossCursor)
139+
.value("WaitCursor", Qt::CursorShape::WaitCursor)
140+
.value("IBeamCursor", Qt::CursorShape::IBeamCursor)
141+
.value("SizeVerCursor", Qt::CursorShape::SizeVerCursor)
142+
.value("SizeHorCursor", Qt::CursorShape::SizeHorCursor)
143+
.value("SizeBDiagCursor", Qt::CursorShape::SizeBDiagCursor)
144+
.value("SizeFDiagCursor", Qt::CursorShape::SizeFDiagCursor)
145+
.value("SizeAllCursor", Qt::CursorShape::SizeAllCursor)
146+
.value("BlankCursor", Qt::CursorShape::BlankCursor)
147+
.value("SplitVCursor", Qt::CursorShape::SplitVCursor)
148+
.value("SplitHCursor", Qt::CursorShape::SplitHCursor)
149+
.value("PointingHandCursor", Qt::CursorShape::PointingHandCursor)
150+
.value("ForbiddenCursor", Qt::CursorShape::ForbiddenCursor)
151+
.value("WhatsThisCursor", Qt::CursorShape::WhatsThisCursor)
152+
.value("BusyCursor", Qt::CursorShape::BusyCursor)
153+
.value("OpenHandCursor", Qt::CursorShape::OpenHandCursor)
154+
.value("ClosedHandCursor", Qt::CursorShape::ClosedHandCursor)
155+
.value("DragCopyCursor", Qt::CursorShape::DragCopyCursor)
156+
.value("DragLinkCursor", Qt::CursorShape::DragLinkCursor)
157+
.value("LastCursor", Qt::CursorShape::LastCursor)
158+
.value("BitmapCursor", Qt::CursorShape::BitmapCursor)
159+
.value("CustomCursor", Qt::CursorShape::CustomCursor);
137160
}
138161

139162
void define_pycc(py::module &m)

0 commit comments

Comments
 (0)