Skip to content

Commit

Permalink
Remove Poco logging from UserSubWindow. This is now all controlled
Browse files Browse the repository at this point in the history
using the MessageDisplay & loggers. Refs #6202
  • Loading branch information
martyngigg committed Apr 15, 2013
1 parent 39dafe5 commit d4238ab
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 69 deletions.
10 changes: 0 additions & 10 deletions Code/Mantid/MantidQt/API/inc/MantidQtAPI/UserSubWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
#include <QLabel>
#include <set>

#include <Poco/Message.h>

//----------------------------------
// Qt Forward declarations
//----------------------------------
Expand Down Expand Up @@ -104,19 +102,13 @@ class EXPORT_OPT_MANTIDQT_API UserSubWindow : public QWidget
/// Has the Python initialization function been run
bool isPyInitialized() const;

/// A boost 'slot' for the Mantid signal channel connection
void mantidLogReceiver(const Poco::Message & msg);

signals:
/// Emitted to start a (generally small) script running
void runAsPythonScript(const QString& code, bool);

/// Change the plot style/color
void setAsPlotType(const QStringList & plotDetails);

///Mantid log message recieved
void logMessageReceived(const QString & msg);

///Connects MantidPlot up with the muon analysis custom interface and in turn the fitPropertyBrowser. (Emitted when a new graph is created).
void fittingRequested(MantidQt::MantidWidgets::FitPropertyBrowser*, const QString&);

Expand Down Expand Up @@ -155,8 +147,6 @@ class EXPORT_OPT_MANTIDQT_API UserSubWindow : public QWidget

/// Set the interface name
void setInterfaceName(const QString & iface_name);
/// Connect this object to Mantid's signal channel
bool connectToMantidSignal();
/// Has this already been initialized
bool m_bIsInitialized;
/// Has the python initialization been run
Expand Down
59 changes: 0 additions & 59 deletions Code/Mantid/MantidQt/API/src/UserSubWindow.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
//----------------------------------
// Includes
//----------------------------------
// Disable Qt lowercase keywords as this includes a boost signal header
#define QT_NO_KEYWORDS
#include "MantidKernel/SignalChannel.h"
#undef QT_NO_KEYWORDS
#include "MantidQtAPI/UserSubWindow.h"
#include "MantidQtAPI/AlgorithmInputHistory.h"
#include "MantidQtAPI/FileDialogHandler.h"
Expand All @@ -16,12 +12,6 @@
#include <QTemporaryFile>
#include <QTextStream>

// Boost
#include <boost/bind.hpp>

//Poco
#include <Poco/LoggingRegistry.h>

#include <iostream>

using namespace MantidQt::API;
Expand All @@ -43,19 +33,6 @@ UserSubWindow::UserSubWindow(QWidget* parent) :
*/
UserSubWindow::~UserSubWindow()
{
// disconnect from the mantid's logger. otherwise we have a crash
try
{
Poco::SignalChannel *pChannel =
dynamic_cast<Poco::SignalChannel*>(Poco::LoggingRegistry::defaultRegistry().channelForName("signalChannel"));
if( pChannel )
{
pChannel->sig().disconnect(boost::bind(&UserSubWindow::mantidLogReceiver, this, _1));
}
}
catch(...)
{
}
}

/**
Expand All @@ -74,9 +51,6 @@ void UserSubWindow::initializeLayout()
//Set the icon
setWindowIcon(QIcon(":/MantidPlot_Icon_32offset.png"));

// Make the logging connection
connectToMantidSignal();

m_bIsInitialized = true;
}

Expand All @@ -98,16 +72,6 @@ bool UserSubWindow::isPyInitialized() const
return m_isPyInitialized;
}

/**
* A boost 'slot' for the Mantid signal channel connection. This relays the message to
* a Qt signal
* @param msg :: The Poco message parameter
*/
void UserSubWindow::mantidLogReceiver(const Poco::Message & msg)
{
emit logMessageReceived(QString::fromStdString(msg.getText()));
}

/**
* Initialize local Python environment. This is called once when the interface is created and
* is meant to be used to run one off code, i.e. importing modules.
Expand Down Expand Up @@ -250,26 +214,3 @@ void UserSubWindow::setInterfaceName(const QString & iface_name)
{
m_ifacename = iface_name;
}

/**
* Connect to Mantid's signal channel so that we can receive log messages
*/
bool UserSubWindow::connectToMantidSignal()
{
try
{
Poco::SignalChannel *pChannel =
dynamic_cast<Poco::SignalChannel*>(Poco::LoggingRegistry::defaultRegistry().channelForName("signalChannel"));
if( !pChannel )
{
return false;
}
pChannel->sig().connect(boost::bind(&UserSubWindow::mantidLogReceiver, this, _1));
}
catch(...)
{
return false;
}
return true;
}

0 comments on commit d4238ab

Please sign in to comment.