From 1334caad6dd596c98e173bce5a85341734980f11 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Mon, 3 Dec 2012 08:26:28 +0000 Subject: [PATCH] * All Tools: - New: Added FreeBSD/Ubuntu patches from Otacilio De Araujo (). * ./hurricane: - Change: In CellViewer, one unificated method to lauch Python scripts whatever they are Stratus or not. - Change: In ScriptWidget, the function lauched is now "ScriptMain()". - New: In PyCellViewer, add the refresh method. --- hurricane/CMakeLists.txt | 1 + hurricane/src/hurricane/Backtrace.cpp | 4 +-- hurricane/src/isobar/PyHurricane.cpp | 1 + hurricane/src/viewer/CellViewer.cpp | 26 +++++++++---------- hurricane/src/viewer/CellWidget.cpp | 2 +- hurricane/src/viewer/PyCellViewer.cpp | 15 +++++++++++ hurricane/src/viewer/ScriptWidget.cpp | 2 +- hurricane/src/viewer/SelectCommand.cpp | 1 + .../src/viewer/hurricane/viewer/CellViewer.h | 2 +- hurricane/tests/CMakeLists.txt | 2 +- 10 files changed, 37 insertions(+), 19 deletions(-) diff --git a/hurricane/CMakeLists.txt b/hurricane/CMakeLists.txt index 6d70e038..b39150f1 100644 --- a/hurricane/CMakeLists.txt +++ b/hurricane/CMakeLists.txt @@ -23,6 +23,7 @@ find_package(PythonLibs REQUIRED) find_package(PythonSitePackages REQUIRED) find_package(VLSISAPD REQUIRED) + find_package(Libexecinfo REQUIRED) if(BUILD_DOC) find_package(Doxygen) endif(BUILD_DOC) diff --git a/hurricane/src/hurricane/Backtrace.cpp b/hurricane/src/hurricane/Backtrace.cpp index 13e9425c..d18f7141 100644 --- a/hurricane/src/hurricane/Backtrace.cpp +++ b/hurricane/src/hurricane/Backtrace.cpp @@ -76,7 +76,7 @@ namespace Hurricane { size_t depth = backtrace ( rawStack, _stackSize ); char** symbols = backtrace_symbols ( rawStack, depth ); -#ifdef __linux__ +#if (defined __linux__ || defined __FreeBSD__) boost::regex re ( "([^/]+)\\(([^+]+)\\+" ); boost::cmatch match; @@ -116,7 +116,7 @@ namespace Hurricane { } } # else - _stack.push_back ( "Backtrace only supported under Linux & OSX." ); + _stack.push_back ( "Backtrace only supported under FreeBSD, Linux and OSX." ); # endif #endif } diff --git a/hurricane/src/isobar/PyHurricane.cpp b/hurricane/src/isobar/PyHurricane.cpp index 6d6eb074..aa799fb3 100644 --- a/hurricane/src/isobar/PyHurricane.cpp +++ b/hurricane/src/isobar/PyHurricane.cpp @@ -95,6 +95,7 @@ #include "hurricane/isobar/PyOccurrenceCollection.h" #include "hurricane/isobar/PyTechnology.h" #include "hurricane/NetExternalComponents.h" +#include namespace Isobar { diff --git a/hurricane/src/viewer/CellViewer.cpp b/hurricane/src/viewer/CellViewer.cpp index 831529af..3e63d3fd 100644 --- a/hurricane/src/viewer/CellViewer.cpp +++ b/hurricane/src/viewer/CellViewer.cpp @@ -41,7 +41,7 @@ #include "hurricane/viewer/MousePositionWidget.h" #include "hurricane/viewer/ControllerWidget.h" #include "hurricane/viewer/ScriptWidget.h" -#include "hurricane/viewer/StratusWidget.h" +//#include "hurricane/viewer/StratusWidget.h" #include "hurricane/viewer/GotoWidget.h" #include "hurricane/viewer/SelectCommand.h" @@ -212,17 +212,17 @@ namespace Hurricane { _controllerAction->setIcon ( QIcon(":/images/swiss-knife.png") ); _controllerAction->setShortcut ( QKeySequence(tr("CTRL+I")) ); - _scriptAction = new QAction ( tr("Script"), this ); + _scriptAction = new QAction ( tr("Python Script"), this ); _scriptAction->setObjectName ( "viewer.menuBar.tools.script" ); - _scriptAction->setStatusTip ( tr("Run Python Script") ); + _scriptAction->setStatusTip ( tr("Run Python Script. Must provide a ScripMain(cell) function") ); _scriptAction->setIcon ( QIcon(":/images/python-logo-v3.png") ); - _scriptAction->setShortcut ( QKeySequence(tr("SHIFT+P,SHIFT+P")) ); + _scriptAction->setShortcut ( QKeySequence(tr("SHIFT+P,SHIFT+S")) ); - _stratusAction = new QAction ( tr("Stratus"), this ); - _stratusAction->setObjectName ( "viewer.menuBar.tools.stratusScript" ); - _stratusAction->setStatusTip ( tr("Run Stratus Script") ); - _stratusAction->setIcon ( QIcon(":/images/stratus-cloud.png") ); - _stratusAction->setShortcut ( QKeySequence(tr("SHIFT+P,SHIFT+S")) ); + //_stratusAction = new QAction ( tr("Stratus"), this ); + //_stratusAction->setObjectName ( "viewer.menuBar.tools.stratusScript" ); + //_stratusAction->setStatusTip ( tr("Run Stratus Script") ); + //_stratusAction->setIcon ( QIcon(":/images/stratus-cloud.png") ); + //_stratusAction->setShortcut ( QKeySequence(tr("SHIFT+P,SHIFT+S")) ); } @@ -266,7 +266,7 @@ namespace Hurricane { _toolsMenu->setObjectName ( "viewer.menuBar.tools" ); _toolsMenu->addAction ( _controllerAction ); _toolsMenu->addAction ( _scriptAction ); - _toolsMenu->addAction ( _stratusAction ); + //_toolsMenu->addAction ( _stratusAction ); } @@ -325,7 +325,7 @@ namespace Hurricane { connect ( _clearRulersAction , SIGNAL(triggered()) , _cellWidget, SLOT(clearRulers()) ); connect ( _controllerAction , SIGNAL(triggered()) , _controller, SLOT(toggleShow()) ); connect ( _scriptAction , SIGNAL(triggered()) , this , SLOT(runScript()) ); - connect ( _stratusAction , SIGNAL(triggered()) , this , SLOT(runStratusScript()) ); + //connect ( _stratusAction , SIGNAL(triggered()) , this , SLOT(runStratusScript()) ); connect ( _gotoAction , SIGNAL(triggered()) , this , SLOT(doGoto()) ); connect ( _cellWidget , SIGNAL(dbuModeChanged(unsigned int,DbU::UnitPower)) @@ -594,8 +594,8 @@ namespace Hurricane { { ScriptWidget::runScript ( this, getCell() ); } - void CellViewer::runStratusScript () - { StratusWidget::runScript ( this ); } +//void CellViewer::runStratusScript () +//{ StratusWidget::runScript ( this ); } string CellViewer::_getString () const diff --git a/hurricane/src/viewer/CellWidget.cpp b/hurricane/src/viewer/CellWidget.cpp index 3fff7e1e..af5b2610 100644 --- a/hurricane/src/viewer/CellWidget.cpp +++ b/hurricane/src/viewer/CellWidget.cpp @@ -1974,7 +1974,7 @@ namespace Hurricane { { Point center = _visibleArea.getCenter(); - cerr << "center: " << center << " + scale:" << scale << endl; + //cerr << "center: " << center << " + scale:" << scale << endl; return Box ( (DbU::Unit)( center.getX() - width () / (scale*2) ) , (DbU::Unit)( center.getY() - height() / (scale*2) ) diff --git a/hurricane/src/viewer/PyCellViewer.cpp b/hurricane/src/viewer/PyCellViewer.cpp index a69555bf..475fc198 100644 --- a/hurricane/src/viewer/PyCellViewer.cpp +++ b/hurricane/src/viewer/PyCellViewer.cpp @@ -153,6 +153,19 @@ extern "C" { } + static PyObject* PyCellViewer_refresh ( PyCellViewer* self ) + { + trace << "PyCellViewer_refresh()" << endl; + + HTRY + METHOD_HEAD("CellViewer.refresh()") + cw->getCellWidget()->refresh(); + HCATCH + + Py_RETURN_NONE; + } + + // --------------------------------------------------------------- // PyCellViewer Attribute Method table. @@ -168,6 +181,8 @@ extern "C" { , { "setLayerVisible" , (PyCFunction)PyCellViewer_setLayerVisible , METH_VARARGS , "Sets the visibility state of the layer ." } , { "fit" , (PyCFunction)PyCellViewer_fit , METH_NOARGS + , "Triggers a full redraw of the visible area." } + , { "refresh" , (PyCFunction)PyCellViewer_refresh , METH_NOARGS , "Fit the contents to the viewer's visible area." } , { "destroy" , (PyCFunction)PyCellViewer_destroy , METH_NOARGS , "Destroy the associated hurricane object. The python object remains." } diff --git a/hurricane/src/viewer/ScriptWidget.cpp b/hurricane/src/viewer/ScriptWidget.cpp index 52e9544a..d5758e87 100644 --- a/hurricane/src/viewer/ScriptWidget.cpp +++ b/hurricane/src/viewer/ScriptWidget.cpp @@ -131,7 +131,7 @@ namespace Hurricane { dbo_ptr script = Isobar::Script::create(userScript.leaf()); script->setEditor ( qobject_cast(parent) ); - bool returnCode = script->runFunction ( "__hurricane_main__", cell ); + bool returnCode = script->runFunction ( "ScriptMain", cell ); Isobar::Script::removePath ( userDirectory.string() ); diff --git a/hurricane/src/viewer/SelectCommand.cpp b/hurricane/src/viewer/SelectCommand.cpp index 3e4179f1..424d562e 100644 --- a/hurricane/src/viewer/SelectCommand.cpp +++ b/hurricane/src/viewer/SelectCommand.cpp @@ -227,6 +227,7 @@ namespace Hurricane { { if ( event->key() == Qt::Key_N ) { event->accept(); + cerr << "_selectMode:" << _selectMode << endl; _selectMode = (++_selectMode) % 3; } } diff --git a/hurricane/src/viewer/hurricane/viewer/CellViewer.h b/hurricane/src/viewer/hurricane/viewer/CellViewer.h index f32a8684..86a5e3d5 100644 --- a/hurricane/src/viewer/hurricane/viewer/CellViewer.h +++ b/hurricane/src/viewer/hurricane/viewer/CellViewer.h @@ -91,7 +91,7 @@ namespace Hurricane { void raiseToolInterrupt (); void clearToolInterrupt (); void runScript (); - void runStratusScript (); + //void runStratusScript (); signals: void showSelectionToggled ( bool ); void stateChanged ( shared_ptr& ); diff --git a/hurricane/tests/CMakeLists.txt b/hurricane/tests/CMakeLists.txt index a134e623..a850617c 100644 --- a/hurricane/tests/CMakeLists.txt +++ b/hurricane/tests/CMakeLists.txt @@ -1,4 +1,4 @@ include_directories ( ${HURRICANE_SOURCE_DIR}/src/hurricane ) add_executable ( htest HTest.cpp ) - target_link_libraries ( htest hurricane ${Boost_LIBRARIES} ) + target_link_libraries ( htest hurricane ${Boost_LIBRARIES} ${LIBEXECINFO_LIBRARIES} )