From: Diane Trout Date: Thu, 12 Oct 2006 00:14:00 +0000 (+0000) Subject: Make help a bit more reliable X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=mussa.git;a=commitdiff_plain;h=252b5bb872affde37dc5f101adaa1644479b8fdf Make help a bit more reliable ticket:120 ticket:49 ticket:98 Brandon figured out how to install QtAssistant on windows I haven't worked it out for OS X or linux yet (as its noticeably harder). I'd switched to using pythons webbrowser.open to go to our documentation pages, except that only works if the python standard library is installed. However windows lacks such a thing, and so the webbrowser.open code wouldn't work. This patch enables the QtAssistant for windows, and uses webbrowser.open on OS X and Linux. Also it'll actually open a warning messagebox if something goes wrong trying to open the help, and display a not very useful error message. --- diff --git a/qui/CMakeLists.txt b/qui/CMakeLists.txt index c32176a..b6c8730 100644 --- a/qui/CMakeLists.txt +++ b/qui/CMakeLists.txt @@ -83,6 +83,11 @@ ADD_LIBRARY(mussa_qui STATIC ${SOURCES}) TARGET_LINK_LIBRARIES(mussa_qui mussa_core) +# currently QTASSISTANT is only properly installed under windows +IF(QT_QTASSISTANT_FOUND AND WIN32) + SET(QUI_CFLAGS "${QUI_CFLAGS} -DQT_QTASSISTANT_FOUND") +ENDIF(QT_QTASSISTANT_FOUND AND WIN32) + SET_SOURCE_FILES_PROPERTIES( ${SOURCES} PROPERTIES diff --git a/qui/MussaWindow.cpp b/qui/MussaWindow.cpp index 09cdef5..10dded3 100644 --- a/qui/MussaWindow.cpp +++ b/qui/MussaWindow.cpp @@ -576,16 +576,25 @@ void MussaWindow::toggleMotifs() void MussaWindow::showManual() { -#if QT_QTASSISTANT_FOUND - manualAssistant->openAssistant(); +#if defined(QT_QTASSISTANT_FOUND) + if (manualAssistant) { + manualAssistant->openAssistant(); + } #else try { boost::python::object webopen = get_py()["webbrowser.open"]; webopen("http://woldlab.caltech.edu/~king/mussagl_manual/"); + return; } catch( boost::python::error_already_set ) { PyErr_Print(); } #endif //QT_QTASSISTANT_FOUND + QMessageBox::warning(this, + tr("Unhelpful Help"), + tr("Error loading help"), + QMessageBox::Ok, + QMessageBox::NoButton, + QMessageBox::NoButton); } void MussaWindow::assistantError(QString message)