Use Qt4.2 openUrl to show manual
authorDiane Trout <diane@caltech.edu>
Fri, 27 Oct 2006 20:40:20 +0000 (20:40 +0000)
committerDiane Trout <diane@caltech.edu>
Fri, 27 Oct 2006 20:40:20 +0000 (20:40 +0000)
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.

CMakeLists.txt
qui/MussaWindow.cpp
qui/mussagl.cpp

index 755d6d86d4c8678f40edbf5e7fa99ed37e20aaaf..6a3125991b83a5a4656c436ce6e17baff5922c02 100644 (file)
@@ -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)
 
index 162598487cd68778d9a57a0fa5d9e8efb26f26a8..58fea508458d23fe3fdc975c42de47bff58ce8de 100644 (file)
@@ -1,4 +1,3 @@
-#include "py/python.hpp"
 #include "qui/MussaWindow.hpp"
 #include "mussa_exceptions.hpp"
 #include "version.hpp"
@@ -7,6 +6,7 @@
 #include <QApplication>
 #include <QAssistantClient>
 #include <QCloseEvent>
+#include <QDesktopServices>
 #include <QDir>
 #include <QFileDialog>
 #include <QHBoxLayout>
@@ -17,6 +17,7 @@
 #include <QStatusBar>
 #include <QString>
 #include <QStringList>
+#include <QUrl>
 #include <QWhatsThis>
 
 #include <memory>
@@ -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"),
index 2e758a55bd01021c1dc2925905cdcf2ec7afa3d2..04418d2a655a5f3e0d41cfcbae394825b5ad9e0b 100644 (file)
@@ -1,7 +1,10 @@
 #include <boost/filesystem/operations.hpp>
 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");