From 3579f30efb51c87649a92cda00eaafe4e699c506 Mon Sep 17 00:00:00 2001 From: vsv Date: Mon, 6 Jun 2016 18:00:40 +0300 Subject: [PATCH] Exclude Events_Error class from the project --- src/Config/Config_Translator.h | 2 +- .../ConnectorPlugin_ExportFeature.py | 2 +- src/Events/CMakeLists.txt | 2 - src/Events/Events.i | 4 +- src/Events/Events_Error.cpp | 49 ------------ src/Events/Events_Error.h | 49 ------------ .../ParametersPlugin_msg_ru.ts | 29 +++---- src/PartSet/PartSet_OperationPrs.cpp | 5 +- src/PartSet/PartSet_ResultSketchPrs.cpp | 4 +- src/SketchPlugin/SketchPlugin_msg_en.ts | 80 +++++++++++++++++-- src/SketcherPrs/SketcherPrs_Tools.cpp | 4 +- 11 files changed, 96 insertions(+), 134 deletions(-) delete mode 100644 src/Events/Events_Error.cpp delete mode 100644 src/Events/Events_Error.h diff --git a/src/Config/Config_Translator.h b/src/Config/Config_Translator.h index 706883ffb..9f989f9d0 100644 --- a/src/Config/Config_Translator.h +++ b/src/Config/Config_Translator.h @@ -13,7 +13,7 @@ #include #include -#define MISSED_TRANSLATION +//#define MISSED_TRANSLATION /** * \class Config_Translator diff --git a/src/ConnectorPlugin/ConnectorPlugin_ExportFeature.py b/src/ConnectorPlugin/ConnectorPlugin_ExportFeature.py index e9cb9804f..1e8f81488 100644 --- a/src/ConnectorPlugin/ConnectorPlugin_ExportFeature.py +++ b/src/ConnectorPlugin/ConnectorPlugin_ExportFeature.py @@ -55,7 +55,7 @@ class ExportFeature(ModelAPI.ModelAPI_Feature): kResultBodyType = "Bodies" aPartSize = self.Part.size(kResultBodyType) if aPartSize == 0: - EventsAPI.Events_Error_send("No results in the active document") + EventsAPI.Events_InfoMessage("ExportFeature","No results in the active document").send() return anObjList = [self.Part.object(kResultBodyType, idx) for idx in xrange(aPartSize)] diff --git a/src/Events/CMakeLists.txt b/src/Events/CMakeLists.txt index a747fd872..9b3f7773f 100644 --- a/src/Events/CMakeLists.txt +++ b/src/Events/CMakeLists.txt @@ -11,7 +11,6 @@ SET(PROJECT_HEADERS Events_MessageGroup.h Events_Listener.h Events_Loop.h - Events_Error.h Events_LongOp.h Events_InfoMessage.h ) @@ -21,7 +20,6 @@ SET(PROJECT_SOURCES Events_MessageGroup.cpp Events_Listener.cpp Events_Loop.cpp - Events_Error.cpp Events_LongOp.cpp ) diff --git a/src/Events/Events.i b/src/Events/Events.i index 005c05758..733170ffc 100644 --- a/src/Events/Events.i +++ b/src/Events/Events.i @@ -2,7 +2,7 @@ %module EventsAPI %{ #include "Events.h" - #include "Events_Error.h" + #include "Events_InfoMessage.h" #include "Events_Message.h" %} @@ -16,4 +16,4 @@ // all supported interfaces %include "Events_Message.h" -%include "Events_Error.h" +%include "Events_InfoMessage.h" diff --git a/src/Events/Events_Error.cpp b/src/Events/Events_Error.cpp deleted file mode 100644 index 1dc1012f2..000000000 --- a/src/Events/Events_Error.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -/* - * Events_Error.cpp - * - * Created on: Apr 28, 2014 - * Author: sbh - */ - -#include -#include - -#define THROW_EMPTY_AIS_EXCEPTION - -Events_Error::Events_Error(const std::string& theDescription, const void* theSender) - : Events_Message(Events_Error::errorID(), theSender) -{ - myDescription = theDescription; -} - -Events_Error::~Events_Error() -{ -} - -Events_ID Events_Error::errorID() -{ - Events_Loop* aLoop = Events_Loop::loop(); - return aLoop->eventByName("ApplicationError"); -} - -const char* Events_Error::description() const -{ - return myDescription.c_str(); -} - -void Events_Error::send(const std::string& theDescription, const void* theSender) -{ - std::shared_ptr aNewOne = - std::shared_ptr(new Events_Error(theDescription, theSender)); - Events_Loop::loop()->send(aNewOne); -} - -void Events_Error::throwException(const std::string& theDescription) -{ -#ifdef THROW_EMPTY_AIS_EXCEPTION - Events_Error::send( - std::string("An exception: ") + theDescription); -#endif -} diff --git a/src/Events/Events_Error.h b/src/Events/Events_Error.h deleted file mode 100644 index aefa5dd73..000000000 --- a/src/Events/Events_Error.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -/* - * Events_Error.h - * - * Created on: Apr 28, 2014 - * Author: sbh - */ - -#ifndef EVENTS_ERROR_H_ -#define EVENTS_ERROR_H_ - -#include -#include - -#include - -/**\class Events_Error - * \ingroup EventsLoop - * \brief An error message event. - * - * Is generated by any algorithm or GUI of the application to inform the user about - * the problem. In GUI mode all such errors are collected in the message log window. - */ -class Events_Error : public Events_Message -{ - std::string myDescription; ///< the description of the error - -public: - /// default destructor - EVENTS_EXPORT virtual ~Events_Error(); - - /// Identifier of this event (one for all errors) - EVENTS_EXPORT static Events_ID errorID(); - /// Specific error string - EVENTS_EXPORT const char* description() const; - /// Allows to send an error quickly: it creates and sends the error object automatically - EVENTS_EXPORT static void send(const std::string& theDescription, const void* theSender = 0); - - /// Throws a C++ exception about using an empty AIS object - /// \param theDescription an exception information - EVENTS_EXPORT static void throwException(const std::string& theDescription); - -protected: - /// Default constructor. Use "send" message for generation an error. - EVENTS_EXPORT Events_Error(const std::string& theDescription, const void* theSender = 0); -}; - -#endif /* EVENTS_ERROR_H_ */ diff --git a/src/ParametersPlugin/ParametersPlugin_msg_ru.ts b/src/ParametersPlugin/ParametersPlugin_msg_ru.ts index c1e212c69..d65572fb4 100644 --- a/src/ParametersPlugin/ParametersPlugin_msg_ru.ts +++ b/src/ParametersPlugin/ParametersPlugin_msg_ru.ts @@ -6,65 +6,58 @@ Name - Имя + Equation - Выражение + Result - Результат + Comment - Коментарий + Parameters - Параметры + Features - Объекты + Add - Добавить + Insert - Вставить + Remove - Удалить + Warning - Предупреждение + Name %1 already exists. - Имя %1 уже существует. - - - - QObject - - Parameters - Параметры + diff --git a/src/PartSet/PartSet_OperationPrs.cpp b/src/PartSet/PartSet_OperationPrs.cpp index 7102e16c0..10d475066 100755 --- a/src/PartSet/PartSet_OperationPrs.cpp +++ b/src/PartSet/PartSet_OperationPrs.cpp @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include @@ -115,7 +115,8 @@ void PartSet_OperationPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t } if (!aReadyToDisplay) { - Events_Error::throwException("An empty AIS presentation: PartSet_OperationPrs"); + Events_InfoMessage("PartSet_OperationPrs", + "An empty AIS presentation: PartSet_OperationPrs").send(); std::shared_ptr aMsg = std::shared_ptr( new Events_Message(Events_Loop::eventByName(EVENT_EMPTY_OPERATION_PRESENTATION))); Events_Loop::loop()->send(aMsg); diff --git a/src/PartSet/PartSet_ResultSketchPrs.cpp b/src/PartSet/PartSet_ResultSketchPrs.cpp index 384741ced..154ca8d41 100755 --- a/src/PartSet/PartSet_ResultSketchPrs.cpp +++ b/src/PartSet/PartSet_ResultSketchPrs.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include @@ -97,7 +97,7 @@ void PartSet_ResultSketchPrs::Compute(const Handle(PrsMgr_PresentationManager3d) } if (!aReadyToDisplay) { - Events_Error::throwException("An empty AIS presentation: PartSet_ResultSketchPrs"); + Events_InfoMessage("PartSet_ResultSketchPrs", "An empty AIS presentation: PartSet_ResultSketchPrs").send(); static const Events_ID anEvent = Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION); ModelAPI_EventCreator::get()->sendUpdated(myResult, anEvent); } diff --git a/src/SketchPlugin/SketchPlugin_msg_en.ts b/src/SketchPlugin/SketchPlugin_msg_en.ts index 8703b5879..e2281644f 100644 --- a/src/SketchPlugin/SketchPlugin_msg_en.ts +++ b/src/SketchPlugin/SketchPlugin_msg_en.ts @@ -1,15 +1,83 @@ - + + Sketch + + Model_FeatureValidator: Attribute "DirX" is not initialized. + Select a plane for the sketch + + + Model_FeatureValidator: Attribute "Features" is not initialized. + Sketch objects are not defined + + + + + SketchCircle + + CircleRadius - GeomValidators_Positive: Double is not positive. + Set a positive number for the radius value + + + Model_FeatureValidator: Attribute "CircleCenter" is not initialized. + Select a center point + + + + + SketchConstraintHorizontal + + Model_FeatureValidator: Attribute "ConstraintEntityA" is not initialized. + Select a line for the constraint + + + ModelAPI_StateInvalidArgument + Wrong object is selected + + + + + SketchConstraintPerpendicular + + Model_FeatureValidator: Attribute "ConstraintEntityA" is not initialized. + Select first line for the perpendicular constraint + + + Model_FeatureValidator: Attribute "ConstraintEntityB" is not initialized. + Select second line for the perpendicular constraint + + + + + SketchConstraintRadius + + Model_FeatureValidator: Attribute "ConstraintEntityA" is not initialized. + Select a circle for the radius definition + + + + SketchConstraintVertical - Model_FeatureValidator: Attribute "ConstraintEntityA" is not initialized. - Select a line for the constraint definition. + ModelAPI_StateInvalidArgument + Wrong object is selected + + + Model_FeatureValidator: Attribute "ConstraintEntityA" is not initialized. + Select a line for the constraint + + + + + SketchLine + + GeomValidators_Different: Attributes StartPoint and EndPoint are equal. + Drag mouse pointer to select an end point - ModelAPI_StateInvalidArgument - Wrong argument for the constraint + Model_FeatureValidator: Attribute "EndPoint" is not initialized. + Click to select an end point for the line - + diff --git a/src/SketcherPrs/SketcherPrs_Tools.cpp b/src/SketcherPrs/SketcherPrs_Tools.cpp index 91a8d3df8..7947c38a2 100644 --- a/src/SketcherPrs/SketcherPrs_Tools.cpp +++ b/src/SketcherPrs/SketcherPrs_Tools.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include @@ -376,7 +376,7 @@ void updateArrows(Handle(Prs3d_DimensionAspect) theDimAspect, double theDimValue void sendEmptyPresentationError(ModelAPI_Feature* theFeature, const std::string theError) { - Events_Error::throwException("An empty AIS presentation: SketcherPrs_LengthDimension"); + Events_InfoMessage("SketcherPrs_Tools", "An empty AIS presentation: SketcherPrs_LengthDimension").send(); static const Events_ID anEvent = Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION); std::shared_ptr aConstraintPtr(theFeature); ModelAPI_EventCreator::get()->sendUpdated(aConstraintPtr, anEvent); -- 2.39.2