myActions[SelectAllId]->setEnabled( !myEditor->document()->isEmpty() );
}
+/*!
+ \brief Start python trace logging
+ \param fileName the path to the log file
+*/
+void PyConsole_Console::startLog( const QString& fileName )
+{
+ myEditor->startLog( fileName );
+}
+
+/*!
+ \brief Stop python trace logging
+*/
+void PyConsole_Console::stopLog()
+{
+ myEditor->stopLog();
+}
+
/**
* Similar to constructor of the base class but using enhanced objects.
* TODO: this should really be done in a factory to avoid code duplication.
void setMenuActions( const int );
int menuActions() const;
+ void startLog( const QString& );
+ void stopLog();
+
protected:
void createActions();
void updateActions();
}
}
/*!
- \brief "Save log" operation.
+ \brief "Start log" operation.
*/
void PyConsole_Editor::startLog()
{
aFilters, tr( "TOT_SAVE_PYLOG" ),
false, true );
if ( !fileName.isEmpty() ) {
- QFile file( fileName );
- if ( file.open( QFile::WriteOnly ) ) {
- file.close();
- myLogFile = fileName;
+ if ( startLog( fileName ) ) {
break;
}
else {
}
}
+/*!
+ \brief Start python trace logging
+ \param fileName the path to the log file
+ \sa stopLog()
+ */
+bool PyConsole_Editor::startLog( const QString& fileName )
+{
+ bool ok = false;
+ if ( !fileName.isEmpty() ) {
+ QFile file( fileName );
+ if ( file.open( QFile::WriteOnly ) ) {
+ file.close();
+ myLogFile = fileName;
+ ok = true;
+ }
+ }
+ return ok;
+}
/*!
\brief "Stop log" operation.
void handleReturn();
void onPyInterpChanged( PyConsole_Interp* );
void dump();
+ bool startLog( const QString& );
void startLog();
void stopLog();
void putLog( const QString& );
${PROJECT_SOURCE_DIR}/src/ObjBrowser
${PROJECT_SOURCE_DIR}/src/Plot2d
${PROJECT_SOURCE_DIR}/src/PyInterp
+ ${PROJECT_SOURCE_DIR}/src/PyConsole
${PROJECT_SOURCE_DIR}/src/Qtx
${PROJECT_SOURCE_DIR}/src/SALOME_PYQT/SALOME_PYQT_GUILight
${PROJECT_SOURCE_DIR}/src/STD
#include "SUIT_ResourceMgr.h"
#include "SUIT_Session.h"
#include "SUIT_Tools.h"
+#include "PyConsole_Console.h"
#include <QAction>
#include <QApplication>
{
return ProcessEvent( new TGetObjectPositionEvent(theEntry) );
}
+
+void SalomePyQt::startPyLog(const QString& theFileName)
+{
+ class TEvent: public SALOME_Event
+ {
+ QString myFileName;
+ public:
+ TEvent( const QString& theFileName ):
+ myFileName( theFileName ) {}
+ virtual void Execute()
+ {
+ if ( getApplication() ) {
+ PyConsole_Console* pyConsole = getApplication()->pythonConsole( false );
+ if ( pyConsole ) pyConsole->startLog( myFileName );
+ }
+ }
+ };
+ ProcessVoidEvent( new TEvent( theFileName ) );
+}
+
+void SalomePyQt::stopPyLog()
+{
+ class TEvent: public SALOME_Event
+ {
+ public:
+ TEvent() {}
+ virtual void Execute()
+ {
+ if ( getApplication() ) {
+ PyConsole_Console* pyConsole = getApplication()->pythonConsole( false );
+ if ( pyConsole ) pyConsole->stopLog();
+ }
+ }
+ };
+ ProcessVoidEvent( new TEvent() );
+}
static QString getSetting ( const QString& );
static void removeChild( const QString& = QString() );
+
+ static void startPyLog(const QString&);
+ static void stopPyLog();
};
#endif // SALOME_PYQT_H
static QList<double> getPlot2dFitRangeByCurves(const int) /ReleaseGIL/ ;
static QList<double> getPlot2dFitRangeCurrent(const int) /ReleaseGIL/ ;
static void setPlot2dFitRange(const int, const double XMin, const double XMax, const double YMin, const double YMax ) /ReleaseGIL/ ;
+
+ static void startPyLog(const QString&) /ReleaseGIL/ ;
+ static void stopPyLog() /ReleaseGIL/ ;
};