From f60739a8e00f2d018adf0018d8276074d0a3c49a Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Mon, 9 Oct 2023 20:11:47 +0200 Subject: [PATCH] Move back PyErrorWidget & PyCellViewer into viewer. Script was needlessly including PyCellViewer.h it seems. Removed it. This reverts commit 6963a0baa6a19f538e822d4b254b91123dd1dc66. --- crlcore/python/helpers/io.py | 4 ++-- crlcore/src/ccore/Utilities.cpp | 3 +++ etesian/src/PyEtesianEngine.cpp | 2 +- hurricane/src/isobar/PyHurricane.cpp | 12 +----------- hurricane/src/isobar/Script.cpp | 2 -- hurricane/src/isobar/meson.build | 14 +------------- hurricane/src/meson.build | 2 +- hurricane/src/viewer/CellViewer.cpp | 2 +- hurricane/src/{isobar => viewer}/PyCellViewer.cpp | 2 +- hurricane/src/{isobar => viewer}/PyErrorWidget.cpp | 2 +- hurricane/src/viewer/PyViewer.cpp | 12 ++++++++++++ .../hurricane/viewer}/PyCellViewer.h | 0 .../hurricane/viewer}/PyErrorWidget.h | 0 hurricane/src/viewer/meson.build | 8 ++++++-- katana/src/PyKatanaEngine.cpp | 2 +- unicorn/src/UnicornGui.cpp | 2 +- unicorn/src/unicorn/PyUnicornGui.h | 2 +- 17 files changed, 33 insertions(+), 38 deletions(-) rename hurricane/src/{isobar => viewer}/PyCellViewer.cpp (99%) rename hurricane/src/{isobar => viewer}/PyErrorWidget.cpp (98%) rename hurricane/src/{isobar/hurricane/isobar => viewer/hurricane/viewer}/PyCellViewer.h (100%) rename hurricane/src/{isobar/hurricane/isobar => viewer/hurricane/viewer}/PyErrorWidget.h (100%) diff --git a/crlcore/python/helpers/io.py b/crlcore/python/helpers/io.py index 594aeadd..22f8b247 100644 --- a/crlcore/python/helpers/io.py +++ b/crlcore/python/helpers/io.py @@ -20,8 +20,8 @@ import os.path import re import traceback from .. import Cfg -from ..Hurricane import UpdateSession, ErrorWidget -from ..Viewer import Graphics +from ..Hurricane import UpdateSession +from ..Viewer import Graphics, ErrorWidget def textStackTrace ( trace, showIndent=True, scriptPath=None ): diff --git a/crlcore/src/ccore/Utilities.cpp b/crlcore/src/ccore/Utilities.cpp index 62f59f27..d69f05ec 100644 --- a/crlcore/src/ccore/Utilities.cpp +++ b/crlcore/src/ccore/Utilities.cpp @@ -257,6 +257,9 @@ namespace CRL { if (coriolis_top_env) { coriolis_top = coriolis_top_env; } else { + // In this case, we are running as a binary and PyCRL module hasn't been + // instanciated yet. Use Python to self-locate ourselves. That is, the + // full path to ".../site-packages/coriolis/". std::error_code rvalue; bprocess::ipstream pipeout; string command = "python3 -c 'from coriolis import CRL;" diff --git a/etesian/src/PyEtesianEngine.cpp b/etesian/src/PyEtesianEngine.cpp index 163be087..50075c0d 100644 --- a/etesian/src/PyEtesianEngine.cpp +++ b/etesian/src/PyEtesianEngine.cpp @@ -17,9 +17,9 @@ #include "hurricane/isobar/PyBox.h" #include "hurricane/isobar/PyCell.h" #include "hurricane/isobar/PyInstance.h" -#include "hurricane/isobar/PyCellViewer.h" #include "hurricane/Cell.h" #include "hurricane/viewer/ExceptionWidget.h" +#include "hurricane/viewer/PyCellViewer.h" #include "etesian/PyEtesianEngine.h" # undef ACCESS_OBJECT diff --git a/hurricane/src/isobar/PyHurricane.cpp b/hurricane/src/isobar/PyHurricane.cpp index f684dd87..3abe04ce 100644 --- a/hurricane/src/isobar/PyHurricane.cpp +++ b/hurricane/src/isobar/PyHurricane.cpp @@ -89,8 +89,6 @@ #include "hurricane/isobar/PyUnitRule.h" #include "hurricane/isobar/PyPhysicalRule.h" #include "hurricane/isobar/PyTwoLayersPhysicalRule.h" -#include "hurricane/isobar/PyErrorWidget.h" -#include "hurricane/isobar/PyCellViewer.h" #include "hurricane/NetExternalComponents.h" #include @@ -617,8 +615,6 @@ extern "C" { PyUnitRule_LinkPyType(); PyPhysicalRule_LinkPyType(); PyTwoLayersPhysicalRule_LinkPyType(); - PyErrorWidget_LinkPyType(); - PyCellViewer_LinkPyType(); PYTYPE_READY( AttributesHolder ) PYTYPE_READY( DebugSession ) @@ -687,8 +683,6 @@ extern "C" { PYTYPE_READY( QueryMask ) PYTYPE_READY( DeviceDescriptor ) PYTYPE_READY( Rule ) - PYTYPE_READY( ErrorWidget ) - PYTYPE_READY( CellViewer ) PYTYPE_READY_SUB( BasicLayer , Layer ) PYTYPE_READY_SUB( RegularLayer , Layer ) @@ -886,10 +880,7 @@ extern "C" { PyModule_AddObject ( module, "Polygon" , (PyObject*)&PyTypePolygon ); Py_INCREF( &PyTypeDeviceDescriptor ); PyModule_AddObject( module, "DeviceDescriptor" , (PyObject*)&PyTypeDeviceDescriptor ); - Py_INCREF( &PyTypeErrorWidget ); - PyModule_AddObject( module, "ErrorWidget" , (PyObject*)&PyTypeErrorWidget ); - Py_INCREF( &PyTypeCellViewer ); - PyModule_AddObject( module, "CellViewer" , (PyObject*)&PyTypeCellViewer ); + PyObject* dictionnary = PyModule_GetDict ( module ); @@ -915,7 +906,6 @@ extern "C" { PyCell_postModuleInit(); PyInstance_postModuleInit(); PyQuery_postModuleInit(); - PyCellViewer_postModuleInit(); //Py_AtExit( showAtExit ); diff --git a/hurricane/src/isobar/Script.cpp b/hurricane/src/isobar/Script.cpp index efee1bb4..ae6e628c 100644 --- a/hurricane/src/isobar/Script.cpp +++ b/hurricane/src/isobar/Script.cpp @@ -21,7 +21,6 @@ #include "hurricane/Error.h" #include "hurricane/Cell.h" #include "hurricane/isobar/PyCell.h" -#include "hurricane/isobar/PyCellViewer.h" #include "hurricane/isobar/Script.h" @@ -29,7 +28,6 @@ namespace Isobar { using std::string; using Hurricane::Cell; - using Hurricane::CellViewer; // ------------------------------------------------------------------- diff --git a/hurricane/src/isobar/meson.build b/hurricane/src/isobar/meson.build index 3713f2b6..c493b9d7 100644 --- a/hurricane/src/isobar/meson.build +++ b/hurricane/src/isobar/meson.build @@ -76,9 +76,7 @@ isobar_sources = files([ 'PyUnitRule.cpp', 'PyPhysicalRule.cpp', 'PyTwoLayersPhysicalRule.cpp', - 'Script.cpp', - 'PyCellViewer.cpp', - 'PyErrorWidget.cpp', + 'Script.cpp' ]) isobar = library( @@ -90,13 +88,3 @@ isobar = library( install: true, ) -py.extension_module( - 'Hurricane', - isobar_sources, - dependencies: [qt_deps, py_deps, boost], - link_with: [isobar, hurricane], - include_directories: hurricane_includes, - install: true, - subdir: 'coriolis' -) - diff --git a/hurricane/src/meson.build b/hurricane/src/meson.build index fb9da920..9e4869a3 100644 --- a/hurricane/src/meson.build +++ b/hurricane/src/meson.build @@ -20,7 +20,7 @@ py.extension_module( 'Hurricane', isobar_sources, dependencies: [qt_deps, py_mod_deps, boost], - link_with: [isobar, viewer], + link_with: [isobar], include_directories: hurricane_includes, install: true, subdir: 'coriolis' diff --git a/hurricane/src/viewer/CellViewer.cpp b/hurricane/src/viewer/CellViewer.cpp index 06698c37..a2b3f40e 100644 --- a/hurricane/src/viewer/CellViewer.cpp +++ b/hurricane/src/viewer/CellViewer.cpp @@ -51,7 +51,7 @@ #include "hurricane/viewer/DesignBlob.h" #include "hurricane/viewer/OpenBlobDialog.h" #include "hurricane/viewer/SelectCommand.h" -#include "hurricane/isobar/PyCellViewer.h" +#include "hurricane/viewer/PyCellViewer.h" namespace Hurricane { diff --git a/hurricane/src/isobar/PyCellViewer.cpp b/hurricane/src/viewer/PyCellViewer.cpp similarity index 99% rename from hurricane/src/isobar/PyCellViewer.cpp rename to hurricane/src/viewer/PyCellViewer.cpp index eb160698..e5e62ed8 100644 --- a/hurricane/src/isobar/PyCellViewer.cpp +++ b/hurricane/src/viewer/PyCellViewer.cpp @@ -17,7 +17,7 @@ #include "hurricane/isobar/PyBox.h" #include "hurricane/isobar/PyCell.h" #include "hurricane/isobar/PyOccurrence.h" -#include "hurricane/isobar/PyCellViewer.h" +#include "hurricane/viewer/PyCellViewer.h" #include "hurricane/viewer/CellWidget.h" diff --git a/hurricane/src/isobar/PyErrorWidget.cpp b/hurricane/src/viewer/PyErrorWidget.cpp similarity index 98% rename from hurricane/src/isobar/PyErrorWidget.cpp rename to hurricane/src/viewer/PyErrorWidget.cpp index f5bfddbf..7ae235c6 100644 --- a/hurricane/src/isobar/PyErrorWidget.cpp +++ b/hurricane/src/viewer/PyErrorWidget.cpp @@ -14,7 +14,7 @@ // +-----------------------------------------------------------------+ -#include "hurricane/isobar/PyErrorWidget.h" +#include "hurricane/viewer/PyErrorWidget.h" namespace Isobar { diff --git a/hurricane/src/viewer/PyViewer.cpp b/hurricane/src/viewer/PyViewer.cpp index 22a51179..ebee0029 100644 --- a/hurricane/src/viewer/PyViewer.cpp +++ b/hurricane/src/viewer/PyViewer.cpp @@ -21,6 +21,8 @@ #include "hurricane/viewer/PyDrawingGroup.h" #include "hurricane/viewer/PyDisplayStyle.h" #include "hurricane/viewer/PyHSVr.h" +#include "hurricane/viewer/PyErrorWidget.h" +#include "hurricane/viewer/PyCellViewer.h" #include "hurricane/viewer/PyAboutWindow.h" @@ -89,6 +91,8 @@ extern "C" { PyDisplayStyleVector_LinkPyType (); PyHApplication_LinkPyType (); PyGraphics_LinkPyType (); + PyErrorWidget_LinkPyType (); + PyCellViewer_LinkPyType (); PyAboutWindow_LinkPyType (); PYTYPE_READY ( HSVr ); @@ -103,12 +107,15 @@ extern "C" { PYTYPE_READY ( DisplayStyleVectorIterator ); PYTYPE_READY ( HApplication ); PYTYPE_READY ( Graphics ); + PYTYPE_READY ( ErrorWidget ); + PYTYPE_READY ( CellViewer ); PYTYPE_READY ( AboutWindow ); // Identifier string can take up to 10 characters. __cs.addType ( "hsvr" , &PyTypeHSVr , "" , false ); __cs.addType ( "displaySty", &PyTypeDisplayStyle, "", false ); __cs.addType ( "graphics" , &PyTypeGraphics , "" , false ); + __cs.addType ( "cellView" , &PyTypeCellViewer , "" , false ); PyObject* module = PyModule_Create( &PyViewer_ModuleDef ); if ( module == NULL ) { @@ -123,10 +130,15 @@ extern "C" { PyModule_AddObject ( module, "HApplication", (PyObject*)&PyTypeHApplication ); Py_INCREF ( &PyTypeGraphics ); PyModule_AddObject ( module, "Graphics" , (PyObject*)&PyTypeGraphics ); + Py_INCREF ( &PyTypeCellViewer ); + PyModule_AddObject ( module, "ErrorWidget" , (PyObject*)&PyTypeErrorWidget ); + Py_INCREF ( &PyTypeErrorWidget ); + PyModule_AddObject ( module, "CellViewer" , (PyObject*)&PyTypeCellViewer ); Py_INCREF ( &PyTypeAboutWindow ); PyModule_AddObject ( module, "AboutWindow" , (PyObject*)&PyTypeAboutWindow ); PyDisplayStyle_postModuleInit(); + PyCellViewer_postModuleInit(); cdebug_log(20,0) << "Viewer.so loaded " << (void*)&typeid(string) << endl; diff --git a/hurricane/src/isobar/hurricane/isobar/PyCellViewer.h b/hurricane/src/viewer/hurricane/viewer/PyCellViewer.h similarity index 100% rename from hurricane/src/isobar/hurricane/isobar/PyCellViewer.h rename to hurricane/src/viewer/hurricane/viewer/PyCellViewer.h diff --git a/hurricane/src/isobar/hurricane/isobar/PyErrorWidget.h b/hurricane/src/viewer/hurricane/viewer/PyErrorWidget.h similarity index 100% rename from hurricane/src/isobar/hurricane/isobar/PyErrorWidget.h rename to hurricane/src/viewer/hurricane/viewer/PyErrorWidget.h diff --git a/hurricane/src/viewer/meson.build b/hurricane/src/viewer/meson.build index 53f21e02..556b5258 100644 --- a/hurricane/src/viewer/meson.build +++ b/hurricane/src/viewer/meson.build @@ -32,7 +32,9 @@ viewer_mocs = qt.compile_moc( 'hurricane/viewer/DisplayFilterWidget.h', 'hurricane/viewer/ControllerWidget.h', 'hurricane/viewer/ScriptWidget.h', - 'hurricane/viewer/AboutWindow.h' + 'hurricane/viewer/AboutWindow.h', + 'hurricane/viewer/PyErrorWidget.h', + 'hurricane/viewer/PyCellViewer.h' ], include_directories: hurricane_includes ) @@ -49,7 +51,9 @@ viewer_py = files([ 'PyHApplication.cpp', 'PyGraphics.cpp', 'PyViewer.cpp', - 'PyAboutWindow.cpp' + 'PyAboutWindow.cpp', + 'PyErrorWidget.cpp', + 'PyCellViewer.cpp' ]) viewer = shared_library( diff --git a/katana/src/PyKatanaEngine.cpp b/katana/src/PyKatanaEngine.cpp index 18d702bb..aa0120ba 100644 --- a/katana/src/PyKatanaEngine.cpp +++ b/katana/src/PyKatanaEngine.cpp @@ -16,8 +16,8 @@ #include "hurricane/isobar/PyNet.h" #include "hurricane/isobar/PyCell.h" -#include "hurricane/isobar/PyCellViewer.h" #include "hurricane/viewer/ExceptionWidget.h" +#include "hurricane/viewer/PyCellViewer.h" #include "hurricane/Cell.h" #include "katana/PyKatanaEngine.h" #include "katana/PyKatanaFlags.h" diff --git a/unicorn/src/UnicornGui.cpp b/unicorn/src/UnicornGui.cpp index ac6d2e8a..ccd95bd8 100644 --- a/unicorn/src/UnicornGui.cpp +++ b/unicorn/src/UnicornGui.cpp @@ -22,7 +22,7 @@ #include "hurricane/DataBase.h" #include "hurricane/isobar/Script.h" #include "hurricane/viewer/CellViewer.h" -#include "hurricane/isobar/PyCellViewer.h" +#include "hurricane/viewer/PyCellViewer.h" #include "crlcore/Utilities.h" #include "crlcore/Catalog.h" #include "crlcore/AllianceFramework.h" diff --git a/unicorn/src/unicorn/PyUnicornGui.h b/unicorn/src/unicorn/PyUnicornGui.h index d2cd1e2b..289f8dd0 100644 --- a/unicorn/src/unicorn/PyUnicornGui.h +++ b/unicorn/src/unicorn/PyUnicornGui.h @@ -19,7 +19,7 @@ #define __UNICORN_PY_UNICORN_GUI_H__ #include "hurricane/isobar/PyHurricane.h" -#include "hurricane/isobar/PyCellViewer.h" +#include "hurricane/viewer/PyCellViewer.h" #include "unicorn/UnicornGui.h"