From: Diane Trout Date: Fri, 27 Oct 2006 20:40:20 +0000 (+0000) Subject: Use Qt4.2 openUrl to show manual X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=mussa.git;a=commitdiff_plain;h=76e750f199ff1427f59d0bbd758911f3ba02fff7 Use Qt4.2 openUrl to show manual ticket:217 This function means I can link to a website without using python. So this patch disables building the python interpreter into mussa. I'll make it optional when I actually make some progress in interacting with mussa via python. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 755d6d8..6a31259 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,13 +41,10 @@ SET(MAIN_SOURCES ADD_EXECUTABLE(mussagl WIN32 MACOSX_BUNDLE ${MAIN_SOURCES} ) -SET(PYTHON_CFLAGS "-DUSE_PYTHON") - # For windows you need to go from library with the most dependencies # to the library with the least dependencies -diane TARGET_LINK_LIBRARIES(mussagl mussa_qui - mussa_py mussa_core ${QT_LIBRARIES} # Including QT_LIBS twice is for dealing with linking dependancies @@ -56,12 +53,19 @@ TARGET_LINK_LIBRARIES(mussagl ${BOOST_FILESYSTEM_LIBRARY} ${BOOST_SERIALIZATION_LIBRARY} ${BOOST_PROGRAM_OPTIONS_LIBRARY} - ${BOOST_PYTHON_LIBRARY} - ${PYTHON_LIBRARIES} - ${PYTHON_LINK_LIBRARIES} ${OPENGL_gl_LIBRARY} ) +IF(USE_PYTHON) + SET(PYTHON_CFLAGS "-DUSE_PYTHON") + TARGET_LINK_LIBRARIES(mussagl + mussa_py + ${BOOST_PYTHON_LIBRARY} + ${PYTHON_LIBRARIES} + ${PYTHON_LINK_LIBRARIES}) +ENDIF(USE_PYTHON) + + GET_MUSSA_COMPILE_FLAGS(MAIN_CFLAGS) GET_MUSSA_LINK_FLAGS(MAIN_LDFLAGS) diff --git a/qui/MussaWindow.cpp b/qui/MussaWindow.cpp index 1625984..58fea50 100644 --- a/qui/MussaWindow.cpp +++ b/qui/MussaWindow.cpp @@ -1,4 +1,3 @@ -#include "py/python.hpp" #include "qui/MussaWindow.hpp" #include "mussa_exceptions.hpp" #include "version.hpp" @@ -7,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -649,11 +650,8 @@ void MussaWindow::showManual() QMessageBox::NoButton); } #else - try { - boost::python::object webopen = get_py()["webbrowser.open"]; - webopen("http://woldlab.caltech.edu/~king/mussagl_manual/"); - } catch( boost::python::error_already_set ) { - PyErr_Print(); + QUrl manual_url("http://woldlab.caltech.edu/~king/mussagl_manual/"); + if (not QDesktopServices::openUrl(manual_url)) { QMessageBox::warning(this, tr("Mussa Help Error"), tr("Unable to launch webbrowser"), diff --git a/qui/mussagl.cpp b/qui/mussagl.cpp index 2e758a5..04418d2 100644 --- a/qui/mussagl.cpp +++ b/qui/mussagl.cpp @@ -1,7 +1,10 @@ #include using namespace boost::filesystem; +#ifdef USE_PYTHON #include "py/python.hpp" +#endif + #include "qui/MussaWindow.hpp" #include "alg/parse_options.hpp" #include "mussa_exceptions.hpp" @@ -69,9 +72,13 @@ int main(int argc, char **argv) qFatal(e.what()); } catch (boost::filesystem::filesystem_error e) { qFatal(e.what()); - } catch( boost::python::error_already_set ) { + } +#ifdef USE_PYTHON + catch( boost::python::error_already_set ) { PyErr_Print(); - } catch (std::runtime_error e) { + } +#endif + catch (std::runtime_error e) { qFatal(e.what()); } catch (...) { qFatal("unrecognized exception");