*.pro.user
moc_*.*
*.qm
-*.ts
#Resources
resources
!src/*/resources
#include <GeomValidators_FeatureKind.h>
#include <GeomValidators_ShapeType.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
//=================================================================================================
bool BuildPlugin_ValidatorBaseForBuild::isValid(const AttributePtr& theAttribute,
{
// Get base objects list.
if(theAttribute->attributeType() != ModelAPI_AttributeSelectionList::typeId()) {
- Events_Error::send("Error: BuildPlugin_ValidatorBaseForBuild does not support attribute type \""
- + theAttribute->attributeType() + "\"\n Only \"" + ModelAPI_AttributeSelectionList::typeId()
- + "\" supported.");
+ std::string aMsg = "Error: BuildPlugin_ValidatorBaseForBuild does not support attribute type '%1'\nOnly '%2' is supported.";
+ Events_InfoMessage("BuildPlugin_Validators", aMsg).
+ arg(theAttribute->attributeType()).arg(ModelAPI_AttributeSelectionList::typeId()).send();
return false;
}
AttributeSelectionListPtr aSelectionList =
{
// Get attribute.
if(theArguments.size() != 1) {
- Events_Error::send("Error: BuildPlugin_ValidatorBaseForWire should be used only with "
- "1 parameter (ID of base objects list).");
+ std::string aMsg = "Error: BuildPlugin_ValidatorBaseForWire should be used only with 1 parameter (ID of base objects list).";
+ Events_InfoMessage("BuildPlugin_Validators", aMsg).send();
return false;
}
AttributeSelectionListPtr aSelectionList = theFeature->selectionList(theArguments.front());
{
// Get attribute.
if(theArguments.size() != 1) {
- Events_Error::send("Error: BuildPlugin_ValidatorBaseForFace should be used only with "
- "1 parameter (ID of base objects list).");
+ std::string aMsg = "Error: BuildPlugin_ValidatorBaseForFace should be used only with "
+ "1 parameter (ID of base objects list).";
+ Events_InfoMessage("BuildPlugin_Validators", aMsg).send();
return false;
}
AttributeSelectionListPtr aSelectionList = theFeature->selectionList(theArguments.front());
std::string& theError) const
{
if(theArguments.size() != 1) {
- Events_Error::send("Error: BuildPlugin_ValidatorSubShapesSelection should be used only with "
- "1 parameter(Sketch feature id).");
+ std::string aMsg = "Error: BuildPlugin_ValidatorSubShapesSelection should be used only with "
+ "1 parameter(Sketch feature id).";
+ Events_InfoMessage("BuildPlugin_Validators", aMsg).send();
return false;
}
// Get base objects list.
if(theAttribute->attributeType() != ModelAPI_AttributeSelectionList::typeId()) {
- Events_Error::send("Error: BuildPlugin_ValidatorSubShapesSelection does not support attribute type \""
- + theAttribute->attributeType() + "\"\n Only \"" + ModelAPI_AttributeSelectionList::typeId()
- + "\" supported.");
+ std::string aMsg = "Error: BuildPlugin_ValidatorSubShapesSelection does not support attribute type \""
+ "%1\"\n Only \"%2\" supported.";
+ Events_InfoMessage("BuildPlugin_Validators", aMsg).
+ arg(theAttribute->attributeType()).arg(ModelAPI_AttributeSelectionList::typeId()).send();
return false;
}
AttributeSelectionListPtr aSelectionList =
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_ResultConstruction.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <GeomAPI_PlanarEdges.h>
#include <GeomAPI_ShapeExplorer.h>
if(theActionId == "add_contour") {
return addContour();
} else {
- Events_Error::send("Error: Feature \"" + getKind() + "\" does not support action \"" + theActionId + "\".");
+ std::string aMsg = "Error: Feature \"%1\" does not support action \"%2\".";
+ Events_InfoMessage("BuildPlugin_Wire", aMsg).arg(getKind()).arg(theActionId).send();
}
return false;
// Get base objects list.
AttributeSelectionListPtr aSelectionList = selectionList(BASE_OBJECTS_ID());
if(aSelectionList->size() == 0) {
- Events_Error::send("Error: Empty selection list.");
+ Events_InfoMessage("BuildPlugin_Wire", "Error: Empty selection list.").send();
return false;
}
}
if(!isAnyContourAdded) {
- Events_Error::send("Error: Contours already closed or no contours found for selected edges.");
+ Events_InfoMessage("BuildPlugin_Wire",
+ "Error: Contours already closed or no contours found for selected edges.").send();
return false;
}
Config_SelectionFilterMessage.h
Config_ValidatorReader.h
Config_DataModelReader.h
+ Config_Translator.h
)
SET(PROJECT_SOURCES
Config_SelectionFilterMessage.cpp
Config_ValidatorReader.cpp
Config_DataModelReader.cpp
+ Config_Translator.cpp
)
SET(XML_RESOURCES
std::string getProperty(xmlNodePtr theNode, const char* thePropName)\r
{\r
std::string result = "";\r
- char* aPropChars = (char*) xmlGetProp(theNode, BAD_CAST thePropName);\r
+ xmlChar* aPropChars = xmlGetProp(theNode, BAD_CAST thePropName);\r
if (!aPropChars || aPropChars[0] == 0)\r
return result;\r
- result = std::string(aPropChars);\r
+ result = std::string((char*)aPropChars);\r
+ xmlFree(aPropChars);\r
\r
std::string::iterator new_end = std::unique(result.begin(), result.end(), BothAreSpaces);\r
result.erase(new_end, result.end()); \r
return result;\r
}\r
\r
+std::string getContent(xmlNodePtr theNode)\r
+{\r
+ std::string result = "";\r
+ xmlChar* aContent = xmlNodeGetContent(theNode);\r
+ if (!aContent || aContent[0] == 0)\r
+ return result;\r
+ result = std::string((char*)aContent);\r
+ xmlFree(aContent);\r
+ return result;\r
+}\r
+\r
std::string getNormalizedProperty(xmlNodePtr theNode, const char* thePropName)\r
{\r
return normalize(getProperty(theNode, thePropName));\r
*/
CONFIG_EXPORT std::string getProperty(xmlNodePtr theNode, const char* thePropName);
+/*!
+ * Returns content of the node as std::string if it is exists.
+ */
+CONFIG_EXPORT std::string getContent(xmlNodePtr theNode);
+
/*!
* Returns normalized (lower case) named property for a given node as std::string.
*/
#include <Config_Keywords.h>
#include "Config_Common.h"
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
Config_DataModelReader::Config_DataModelReader()
std::string aName = getProperty(theNode, FOLDER_NAME);
std::string aGroupType = getProperty(theNode, GROUP_TYPE);
if (aName.empty() || aGroupType.empty())
- Events_Error::send("Reading dataModel.xml: wrong folder definition");
+ Events_InfoMessage("Config_DataModelReader", "Reading dataModel.xml: wrong folder definition.").send();
std::string aIcon = getProperty(theNode, NODE_ICON);
std::string aEmpty = getProperty(theNode, SHOW_EMPTY);
#include <Config_Common.h>
#include <Config_ModuleReader.h>
#include <Config_FeatureReader.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
const std::string& thePluginConfig)
{
if (myFeaturesInFiles.count(theFeatureName)) {
- std::string anErrorMsg = "Can not register feature '" + theFeatureName + "' in plugin '"
- + thePluginConfig + "'. There is a feature with the same ID.";
- Events_Error::send(anErrorMsg);
+ std::string anErrorMsg = "Can not register feature '%1' in plugin '%2'."
+ " There is a feature with the same ID.";
+ Events_InfoMessage("Config_ModuleReader", anErrorMsg).arg(theFeatureName).arg(thePluginConfig).send();
return;
}
Py_XDECREF(pvalue);
Py_XDECREF(ptraceback);
}
- Events_Error::send(anErrorMsg);
+ Events_InfoMessage("Config_ModuleReader", anErrorMsg).send();
}
/* release python thread */
anErrorMsg += ": " + std::string(dlerror());
#endif
std::cerr << anErrorMsg << std::endl;
- Events_Error::send(anErrorMsg);
+ Events_InfoMessage("Config_ModuleReader", anErrorMsg).send();
}
}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: Config_Translator.cpp
+// Created: 31 May 2016
+// Author: Vitaly SMETANNIKOV
+
+#include "Config_Translator.h"
+#include "Config_XMLReader.h"
+#include "Config_Common.h"
+
+#include <fstream>
+#include <ostream>
+
+class Config_TSReader : public Config_XMLReader
+{
+public:
+ Config_TSReader(const std::string& theTSFile) : Config_XMLReader(theTSFile) {}
+
+ const Config_Translator::Translator& translator() const { return myTranslator; }
+ const Config_Translator::Dictionary& codecs() const { return myCodecs; }
+
+protected:
+ /// Overloaded method. Defines how to process each node
+ virtual void processNode(xmlNodePtr theNode);
+private:
+ Config_Translator::Translator myTranslator;
+ Config_Translator::Dictionary myCodecs;
+};
+
+void Config_TSReader::processNode(xmlNodePtr theNode)
+{
+ static std::string aName;
+ static std::string aSource;
+ std::string aTranslat;
+
+ if (isNode(theNode, "context", NULL)) {
+ aName = "";
+ } else if (isNode(theNode, "name", NULL)) {
+ aName = getContent(theNode);
+ myCodecs[aName] = encoding();
+ } else if (isNode(theNode, "message", NULL)) {
+ aSource = "";
+ } else if (isNode(theNode, "source", NULL)) {
+ aSource = getContent(theNode);
+ } else if (isNode(theNode, "translation", NULL)) {
+ aTranslat = getContent(theNode);
+ if ((aName.size() > 0) && (aSource.size() > 0))
+ myTranslator[aName][aSource] = aTranslat;
+ }
+}
+
+//******************************************************************************
+//******************************************************************************
+//******************************************************************************
+Config_Translator::Translator Config_Translator::myTranslator;
+Config_Translator::Dictionary Config_Translator::myCodecs;
+
+#ifdef _DEBUG
+#ifdef MISSED_TRANSLATION
+Config_Translator::Translator Config_Translator::myMissed;
+#endif
+#endif
+
+bool Config_Translator::load(const std::string& theFileName)
+{
+ Config_TSReader aReader(theFileName);
+ aReader.readAll();
+
+ const Translator& aTranslator = aReader.translator();
+ Translator::const_iterator aIt;
+ std::string aContext;
+ Dictionary aDictionary;
+ for (aIt = aTranslator.cbegin(); aIt != aTranslator.cend(); aIt++) {
+ aContext = (*aIt).first;
+ aDictionary = (*aIt).second;
+ if (myTranslator.count(aContext) == 0) {
+ myTranslator[aContext] = aDictionary;
+ } else {
+ Dictionary::const_iterator aDictIt;
+ for (aDictIt = aDictionary.cbegin(); aDictIt != aDictionary.cend(); aDictIt++) {
+ myTranslator[aContext][(*aDictIt).first] = (*aDictIt).second;
+ }
+ }
+ }
+
+ const Dictionary aCodecs = aReader.codecs();
+ Dictionary::const_iterator aDictIt;
+ for (aDictIt = aCodecs.cbegin(); aDictIt != aCodecs.cend(); aDictIt++) {
+ myCodecs[aDictIt->first] = aDictIt->second;
+ }
+ return true;
+}
+
+std::string Config_Translator::translate(std::shared_ptr<Events_InfoMessage> theInfo)
+{
+ std::string aContext = theInfo->context();
+ std::string aMessage = theInfo->message();
+ std::list<std::string> aParameters = theInfo->parameters();
+ return translate(aContext, aMessage, aParameters);
+}
+
+
+std::string insertParameters(const std::string& theString, const std::list<std::string>& theParams)
+{
+ std::string aResult = theString;
+ std::list<std::string>::const_iterator aIt;
+ int i;
+ char aBuf[20];
+ std::string aParam;
+ for (i=1, aIt = theParams.cbegin(); aIt != theParams.cend(); aIt++, i++) {
+ aParam = (*aIt);
+ sprintf_s(aBuf, "%d", i);
+ std::string aCode = std::string("%") + std::string(aBuf);
+ size_t aPos = aResult.find(aCode);
+ if (aPos != std::string::npos) {
+ std::string aFirst = aResult.substr(0, aPos);
+ std::string aLast = aResult.substr(aPos + aCode.length(), std::string::npos);
+ aResult = aFirst + aParam + aLast;
+ }
+ }
+ return aResult;
+}
+
+std::string Config_Translator::translate(const std::string& theContext,
+ const std::string& theMessage,
+ const std::list<std::string>& theParams)
+{
+ if (myTranslator.count(theContext) > 0) {
+ if (myTranslator[theContext].count(theMessage) > 0) {
+ std::string aTranslation = myTranslator[theContext][theMessage];
+ if (theParams.size() > 0) {
+ aTranslation = insertParameters(aTranslation, theParams);
+ }
+ return aTranslation;
+ }
+ }
+ std::string aMsg = theMessage;
+ if (theParams.size() > 0) {
+ aMsg = insertParameters(aMsg, theParams);
+ }
+#ifdef _DEBUG
+#ifdef MISSED_TRANSLATION
+ myMissed[theContext][theMessage] = "";
+#endif
+#endif
+ return aMsg;
+}
+
+
+std::string Config_Translator::codec(const std::string& theContext)
+{
+ return (myCodecs.count(theContext) > 0)? myCodecs[theContext] : "UTF-8";
+}
+
+
+#ifdef _DEBUG
+#ifdef MISSED_TRANSLATION
+void Config_Translator::saveMissedTranslations()
+{
+ if (myMissed.size() == 0)
+ return;
+
+ char* aPath = getenv("ROOT_DIR");
+#ifdef WIN32
+ std::string aFile = aPath + std::string("\\MissedTranslation.ts");
+#else
+ std::string aFile = aPath + std::string("/MissedTranslation.ts");
+#endif
+ std::ofstream oFStream;
+
+ // Delete old file
+ int aa = remove(aFile.c_str());
+
+ oFStream.open(aFile, std::ofstream::out | std::ofstream::app);
+ if (oFStream.is_open()) {
+ Translator::const_iterator aContIt;
+ Dictionary::const_iterator aDictIt;
+ std::string aContext;
+ std::string aSrc;
+ Dictionary aDict;
+
+ oFStream << "<TS version=\"2.0\">" << std::endl;
+ for(aContIt = myMissed.cbegin(); aContIt != myMissed.cend(); aContIt++) {
+ oFStream << "<context>" << std::endl;
+
+ aContext = aContIt->first;
+ oFStream << " <name>" << aContext << "</name>" << std::endl;
+
+ aDict = aContIt->second;
+ for(aDictIt = aDict.cbegin(); aDictIt != aDict.cend(); aDictIt++) {
+ oFStream << " <message>" << std::endl;
+ aSrc = aDictIt->first;
+
+ oFStream << " <source>" << aSrc << "</source>" << std::endl;
+ oFStream << " <translation>" << "</translation>" << std::endl;
+
+ oFStream << " </message>" << std::endl;
+ }
+ oFStream << "</context>" << std::endl;
+ }
+
+ oFStream << "</TS>" << std::endl;
+ oFStream.close();
+ }
+}
+#endif
+#endif
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: Config_Translator.h
+// Created: 31 May 2016
+// Author: Vitaly SMETANNIKOV
+
+#ifndef Config_Translator_H
+#define Config_Translator_H
+
+#include "Config_def.h"
+#include <Events_InfoMessage.h>
+
+#include <string>
+#include <map>
+
+//#define MISSED_TRANSLATION
+
+/**
+ * \class Config_Translator
+ * \ingroup Config
+ * \brief Class for messages translation on different languages. It can load TS
+ * files wich contain translation string and provides translations of messages from source code
+ */
+class Config_Translator
+{
+public:
+ /// A data type of dictionary <KeyString, ResultString>
+ typedef std::map<std::string, std::string> Dictionary;
+
+ /// A data type of Translator with structure <Context, Dictionary>
+ typedef std::map<std::string, Dictionary> Translator;
+
+ /**
+ * Load translations from TS file
+ * \param theFileName a TS file name with full path
+ */
+ static CONFIG_EXPORT bool load(const std::string& theFileName);
+
+ /**
+ * Returns translation from the given info message.
+ * If transdlation is not exists then it returns a string
+ * from the info data without translation
+ * \param theInfo an info message
+ */
+ static CONFIG_EXPORT std::string translate(std::shared_ptr<Events_InfoMessage> theInfo);
+
+ /**
+ * Returns translation from the given data.
+ * If transdlation is not exists then it returns a string
+ * from the info data without translation
+ * \param theContext context of the message (Feature Id)
+ * \param theMessage a message which dave to be translated
+ * \param theParams a list of parameters (can be empty)
+ */
+ static CONFIG_EXPORT std::string translate(const std::string& theContext,
+ const std::string& theMessage,
+ const std::list<std::string>& theParams = std::list<std::string>());
+
+
+ /**
+ * Returns codec for the context
+ * \param theContext the context
+ */
+ static CONFIG_EXPORT std::string codec(const std::string& theContext);
+
+#ifdef _DEBUG
+#ifdef MISSED_TRANSLATION
+ static CONFIG_EXPORT void saveMissedTranslations();
+#endif
+#endif
+
+
+private:
+ /// A map of translations
+ static Translator myTranslator;
+
+ /// aMap of codecs for contexts
+ static Dictionary myCodecs;
+
+#ifdef _DEBUG
+#ifdef MISSED_TRANSLATION
+ static Translator myMissed;
+#endif
+#endif
+};
+
+#endif
\ No newline at end of file
#include <Config_PropManager.h>
#include <Events_Loop.h>
-#include <Events_Error.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <Config_PropManager.h>
#include <Events_Loop.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
myDocumentPath = prefix + FSEP + theXmlFileName;
std::ifstream aTestFile(myDocumentPath);
- if (!aTestFile) Events_Error::send("Unable to open " + myDocumentPath);
+ if (!aTestFile)
+ Events_InfoMessage("Config_XMLReader", "Unable to open %1").arg(myDocumentPath).send();
aTestFile.close();
}
}
return result;
}
+
+const char* Config_XMLReader::encoding() const
+{
+ return (const char*) myXmlDoc->encoding;
+}
\ No newline at end of file
*/
CONFIG_EXPORT xmlNodePtr findRoot();
+ CONFIG_EXPORT const char* encoding() const;
+
protected:
/*!
* \brief Allows to customize reader's behavior for a node. Virtual.
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)]
Events_MessageGroup.h
Events_Listener.h
Events_Loop.h
- Events_Error.h
Events_LongOp.h
+ Events_InfoMessage.h
)
SET(PROJECT_SOURCES
Events_MessageGroup.cpp
Events_Listener.cpp
Events_Loop.cpp
- Events_Error.cpp
Events_LongOp.cpp
)
%module EventsAPI
%{
#include "Events.h"
- #include "Events_Error.h"
+ #include "Events_InfoMessage.h"
#include "Events_Message.h"
%}
// all supported interfaces
%include "Events_Message.h"
-%include "Events_Error.h"
+%include "Events_InfoMessage.h"
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-/*
- * Events_Error.cpp
- *
- * Created on: Apr 28, 2014
- * Author: sbh
- */
-
-#include <Events_Error.h>
-#include <Events_Loop.h>
-
-#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<Events_Message> aNewOne =
- std::shared_ptr<Events_Message>(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
-}
+++ /dev/null
-// 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 <Events.h>
-#include <Events_Message.h>
-
-#include <string>
-
-/**\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_ */
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: Events_InfoMessage.hxx
+// Created: 31 May 2016
+// Author: Vitaly SMETANNIKOV
+
+#ifndef Events_InfoMessage_H_
+#define Events_InfoMessage_H_
+
+#include <Events.h>
+#include <Events_Message.h>
+#include <Events_Loop.h>
+
+/**\class Events_InfoMessage
+ * \ingroup EventsLoop
+ * \brief An event message for sending a string message which has to be translated.
+ */
+class Events_InfoMessage: public Events_Message
+{
+public:
+
+ /// Constructor
+ /// \param theSender a pointer on sender object
+ Events_InfoMessage(const void* theSender = 0):Events_Message(Events_Loop::eventByName("InfoMessage"), theSender) {}
+
+ /// Constructor
+ /// \param theSender a pointer on sender object
+ Events_InfoMessage(const std::string& theContext,
+ const std::string& theMsg, const void* theSender = 0):
+ Events_Message(Events_Loop::eventByName("InfoMessage"), theSender),
+ myContext(theContext), myMessage(theMsg) {}
+
+ /// default destructor
+ virtual ~Events_InfoMessage() {}
+
+ /// Identifier of this event (one for all errors)
+ static Events_ID errorID() { return Events_Loop::loop()->eventByName("InfoMessage"); }
+
+ /// Set a context string
+ /// \param theContext a context string
+ void setContext(const std::string& theContext) { myContext = theContext; }
+
+
+ /// Returns context string
+ std::string context() const { return myContext; }
+
+ /// Set message string for translation
+ /// \param theMsg the string of message
+ void setMessage(const std::string& theMsg) { myMessage = theMsg; }
+
+ /// Returns message
+ std::string message() const { return myMessage; }
+
+ /// Add parameter for message string of string type
+ /// \param theParam the parameter
+ void addParameter(const std::string& theParam)
+ {
+ myParameters.push_back(theParam);
+ }
+
+ /// Add parameter for message string of double type
+ /// \param theParam the parameter
+ void addParameter(double theParam)
+ {
+ char aBuf[50];
+ int n = sprintf_s(aBuf, "%g", theParam);
+ std::string aStr(aBuf);
+ myParameters.push_back(aStr);
+ }
+
+ /// Add parameter for message string of integer type
+ /// \param theParam the parameter
+ void addParameter(int theParam)
+ {
+ char aBuf[50];
+ int n = sprintf_s(aBuf, "%d", theParam);
+ std::string aStr(aBuf);
+ myParameters.push_back(aStr);
+ }
+
+ /// Returns list of parameters
+ std::list<std::string> parameters() const { return myParameters; }
+
+ /// Add parameter for message string of string type
+ /// \param theParam the parameter
+ Events_InfoMessage& arg(const std::string& theParam) { addParameter(theParam); return *this; }
+
+ /// Add parameter for message string of integer type
+ /// \param theParam the parameter
+ Events_InfoMessage& arg(int theParam) { addParameter(theParam); return *this; }
+
+ /// Add parameter for message string of double type
+ /// \param theParam the parameter
+ Events_InfoMessage& arg(double theParam) { addParameter(theParam); return *this; }
+
+ void send() {
+ std::shared_ptr<Events_Message> aMsg(new Events_InfoMessage(*this));
+ Events_Loop::loop()->send(aMsg);
+ }
+
+private:
+
+ /// Context of the messgae
+ std::string myContext;
+
+ /// String of the message
+ std::string myMessage;
+
+ /// Parameters of the message
+ std::list<std::string> myParameters;
+};
+
+#endif
\ No newline at end of file
#include <ModelAPI_ResultCompSolid.h>
#include <ModelAPI_ResultConstruction.h>
-#include <Events_Error.h>
-
#include <GeomValidators_BodyShapes.h>
#include <GeomValidators_FeatureKind.h>
#include <GeomValidators_ShapeType.h>
#include <GeomAbs_SurfaceType.hxx>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <QString>
#include <QMap>
if (MyFaceTypes.find(aType) != MyFaceTypes.end())
return MyFaceTypes[aType];
- Events_Error::send("Face type defined in XML is not implemented!");
+ Events_InfoMessage("GeomValidators_Face", "Face type defined in XML is not implemented!").send();
return GeomAbs_Plane;
}
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_AttributeReference.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <string>
#include <map>
if (MyShapeTypes.find(aType) != MyShapeTypes.end())
return MyShapeTypes[aType];
- Events_Error::send("Shape type defined in XML is not implemented!");
+ Events_InfoMessage("Shape type defined in XML is not implemented!").send();
return AnyShape;
}
#include <ModelAPI_Result.h>
#include <Events_Message.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <memory>
Events_Loop::loop()->send(aMsg);
} else if (theMessage.get()) {
- Events_Error::send(
- std::string("InitializationPlugin_Plugin::processEvent: unhandled message caught: ")
- + theMessage->eventID().eventText());
+ Events_InfoMessage("InitializationPlugin_Plugin",
+ "InitializationPlugin_Plugin::processEvent: unhandled message caught: %1")
+ .arg(theMessage->eventID().eventText()).send();
}
}
#include <ModelAPI_Tools.h>
#include <GeomAPI_Shape.h>
#include <GeomAPI_PlanarEdges.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <TNaming_Selector.hxx>
#include <TNaming_NamedShape.hxx>
if (aResult) {
aContext = aResult->shape()->impl<TopoDS_Shape>();
} else {
- Events_Error::send("A result with shape is expected");
+ Events_InfoMessage("Model_AttributeSelection", "A result with shape is expected").send();
return;
}
}
#include <GeomData_Point2D.h>
#include <GeomData_Dir.h>
#include <Events_Loop.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <TDataStd_Name.hxx>
#include <TDataStd_AsciiString.hxx>
anAttr->setObject(myObject);
anAttr->setID(theID);
} else {
- Events_Error::send("Can not create unknown type of attribute " + theAttrType);
+ Events_InfoMessage("Model_Data", "Can not create unknown type of attribute %1").arg(theAttrType).send();
}
return aResult;
}
{
execState(ModelAPI_StateExecFailed);
if (theSend) {
- Events_Error::send(theError);
+ Events_InfoMessage("Model_Data", theError).send();
}
TDataStd_AsciiString::Set(myLab, theError.c_str());
}
#include <ModelAPI_ResultBody.h>
#include <Events_Loop.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <TDataStd_Integer.hxx>
#include <TDataStd_Comment.hxx>
aStatus = anApp->Open(aPath, aLoaded);
} catch (Standard_Failure) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- Events_Error::send(
- std::string("Exception in opening of document: ") + aFail->GetMessageString());
+ Events_InfoMessage("Model_Document",
+ "Exception in opening of document: %1").arg(aFail->GetMessageString()).send();
return false;
}
bool isError = aStatus != PCDM_RS_OK;
if (isError) {
switch (aStatus) {
case PCDM_RS_UnknownDocument:
- Events_Error::send(std::string("Can not open document"));
+ Events_InfoMessage("Model_Document", "Can not open document").send();
break;
case PCDM_RS_AlreadyRetrieved:
- Events_Error::send(std::string("Can not open document: already opened"));
+ Events_InfoMessage("Model_Document", "Can not open document: already opened").send();
break;
case PCDM_RS_AlreadyRetrievedAndModified:
- Events_Error::send(
- std::string("Can not open document: already opened and modified"));
+ Events_InfoMessage("Model_Document",
+ "Can not open document: already opened and modified").send();
break;
case PCDM_RS_NoDriver:
- Events_Error::send(std::string("Can not open document: driver library is not found"));
+ Events_InfoMessage("Model_Document", "Can not open document: driver library is not found").send();
break;
case PCDM_RS_UnknownFileDriver:
- Events_Error::send(std::string("Can not open document: unknown driver for opening"));
+ Events_InfoMessage("Model_Document", "Can not open document: unknown driver for opening").send();
break;
case PCDM_RS_OpenError:
- Events_Error::send(std::string("Can not open document: file open error"));
+ Events_InfoMessage("Model_Document", "Can not open document: file open error").send();
break;
case PCDM_RS_NoVersion:
- Events_Error::send(std::string("Can not open document: invalid version"));
+ Events_InfoMessage("Model_Document", "Can not open document: invalid version").send();
break;
case PCDM_RS_NoModel:
- Events_Error::send(std::string("Can not open document: no data model"));
+ Events_InfoMessage("Model_Document", "Can not open document: no data model").send();
break;
case PCDM_RS_NoDocument:
- Events_Error::send(std::string("Can not open document: no document inside"));
+ Events_InfoMessage("Model_Document", "Can not open document: no document inside").send();
break;
case PCDM_RS_FormatFailure:
- Events_Error::send(std::string("Can not open document: format failure"));
+ Events_InfoMessage("Model_Document", "Can not open document: format failure").send();
break;
case PCDM_RS_TypeNotFoundInSchema:
- Events_Error::send(std::string("Can not open document: invalid object"));
+ Events_InfoMessage("Model_Document", "Can not open document: invalid object").send();
break;
case PCDM_RS_UnrecognizedFileFormat:
- Events_Error::send(std::string("Can not open document: unrecognized file format"));
+ Events_InfoMessage("Model_Document", "Can not open document: unrecognized file format").send();
break;
case PCDM_RS_MakeFailure:
- Events_Error::send(std::string("Can not open document: make failure"));
+ Events_InfoMessage("Model_Document", "Can not open document: make failure").send();
break;
case PCDM_RS_PermissionDenied:
- Events_Error::send(std::string("Can not open document: permission denied"));
+ Events_InfoMessage("Model_Document", "Can not open document: permission denied").send();
break;
case PCDM_RS_DriverFailure:
- Events_Error::send(std::string("Can not open document: driver failure"));
+ Events_InfoMessage("Model_Document", "Can not open document: driver failure").send();
break;
default:
- Events_Error::send(std::string("Can not open document: unknown error"));
+ Events_InfoMessage("Model_Document", "Can not open document: unknown error").send();
break;
}
}
aStatus = anApp->SaveAs(myDoc, aPath);
} catch (Standard_Failure) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- Events_Error::send(
- std::string("Exception in saving of document: ") + aFail->GetMessageString());
+ Events_InfoMessage("Model_Document",
+ "Exception in saving of document: %1").arg(aFail->GetMessageString()).send();
return false;
}
bool isDone = aStatus == PCDM_SS_OK || aStatus == PCDM_SS_No_Obj;
if (!isDone) {
switch (aStatus) {
case PCDM_SS_DriverFailure:
- Events_Error::send(std::string("Can not save document: save driver-library failure"));
+ Events_InfoMessage("Model_Document", "Can not save document: save driver-library failure").send();
break;
case PCDM_SS_WriteFailure:
- Events_Error::send(std::string("Can not save document: file writing failure"));
+ Events_InfoMessage("Model_Document", "Can not save document: file writing failure").send();
break;
case PCDM_SS_Failure:
default:
- Events_Error::send(std::string("Can not save document"));
+ Events_InfoMessage("Model_Document", "Can not save document").send();
break;
}
}
aFile.Copy(aDestination);
theResults.push_back(aDestinationDir.ToCString());
} else {
- Events_Error::send(
- std::string("Can not open file ") + aSubPath.ToCString() + " for saving");
+ Events_InfoMessage("Model_Document",
+ "Can not open file %1 for saving").arg(aSubPath.ToCString()).send();
}
}
} else { // simply save opened document
#include <ModelAPI_Tools.h>
#include <Events_Loop.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <TDataStd_Integer.hxx>
#include <TDataStd_Comment.hxx>
}
if (!theRefs.empty() && isSendError) {
- Events_Error::send(
- "Feature '" + theFeature->data()->name() + "' is used and can not be deleted");
+ Events_InfoMessage("Model_Objects",
+ "Feature '%1' is used and can not be deleted").arg(theFeature->data()->name()).send();
}
}
if (!aPassedMovedFrom || !aPassedMovedTo) {// not found: unknown situation
if (!aPassedMovedFrom) {
static std::string aMovedFromError("The moved feature is not found");
- Events_Error::send(aMovedFromError);
+ Events_InfoMessage("Model_Objects", aMovedFromError).send();
} else {
static std::string aMovedToError("The 'after' feature for movement is not found");
- Events_Error::send(aMovedToError);
+ Events_InfoMessage("Model_Objects", aMovedToError).send();
}
return;
}
TCollection_AsciiString(Handle(TDataStd_Comment)::DownCast(aLabIter.Value())->Get())
.ToCString(), anOwner);
if (!aFeature.get()) { // somethig is wrong, most probably, the opened document has invalid structure
- Events_Error::send("Invalid type of object in the document");
+ Events_InfoMessage("Model_Objects", "Invalid type of object in the document").send();
aLabIter.Value()->Label().ForgetAllAttributes();
continue;
}
theFeature->attributeChanged("expression"); // just produce a value
break;
} else {
- Events_Error::send(std::string("Unknown type of result is found in the document:") +
- TCollection_AsciiString(aGroup->Get()).ToCString());
+ Events_InfoMessage("Model_Objects", "Unknown type of result is found in the document:")
+ .arg(TCollection_AsciiString(aGroup->Get()).ToCString()).send();
}
}
if (aNewBody && !aNewBody->data()->isDeleted()) {
#include "Model_SelectionNaming.h"
#include "Model_Document.h"
#include <ModelAPI_Feature.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <TopoDS_Iterator.hxx>
#include <TopoDS.hxx>
}
if (aShapeTypes.find(theType) != aShapeTypes.end())
return aShapeTypes[theType];
- Events_Error::send("Shape type defined in XML is not implemented!");
+ Events_InfoMessage("Model_SelectionNaming", "Shape type defined in XML is not implemented!").send();
return TopAbs_SHAPE;
}
#include <Model_Validator.h>
#include <ModelAPI_Events.h>
#include <Events_Loop.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <Config_FeatureMessage.h>
#include <Config_AttributeMessage.h>
#include <Config_ValidatorMessage.h>
if (myPlugins.find(theFeatureID) != myPlugins.end()) {
std::pair<std::string, std::string>& aPlugin = myPlugins[theFeatureID]; // plugin and doc kind
if (!aPlugin.second.empty() && aPlugin.second != theDocOwner->kind()) {
- Events_Error::send(
- string("Feature '") + theFeatureID + "' can be created only in document '"
- + aPlugin.second + "' by the XML definition");
+ Events_InfoMessage("Model_Session",
+ "Feature '%1' can be created only in document '%2' by the XML definition")
+ .arg(theFeatureID).arg(aPlugin.second).send();
return FeaturePtr();
}
myCurrentPluginName = aPlugin.first;
if (myPluginObjs.find(myCurrentPluginName) != myPluginObjs.end()) {
FeaturePtr aCreated = myPluginObjs[myCurrentPluginName]->createFeature(theFeatureID);
if (!aCreated) {
- Events_Error::send(
- string("Can not initialize feature '") + theFeatureID + "' in plugin '"
- + myCurrentPluginName + "'");
+ Events_InfoMessage("Model_Session",
+ "Can not initialize feature '%1' in plugin '%2'")
+ .arg(theFeatureID).arg(myCurrentPluginName).send();
}
return aCreated;
} else {
- Events_Error::send(string("Can not load plugin '") + myCurrentPluginName + "'");
+ Events_InfoMessage("Model_Session","Can not load plugin '%1'").arg(myCurrentPluginName).send();
}
} else {
- Events_Error::send(string("Feature '") + theFeatureID + "' not found in any plugin");
+ Events_InfoMessage("Model_Session","Feature '%1' not found in any plugin").arg(theFeatureID).send();
}
return FeaturePtr(); // return nothing
}
} else { // create/update/delete
if (myCheckTransactions && !isOperation())
- Events_Error::send("Modification of data structure outside of the transaction");
+ Events_InfoMessage("Model_Session", "Modification of data structure outside of the transaction").send();
// if part is deleted, make the root as the current document (on undo of Parts creations)
static const Events_ID kDeletedEvent = Events_Loop::eventByName(EVENT_OBJECT_DELETED);
if (theMessage->eventID() == kDeletedEvent) {
#include <GeomDataAPI_Point2D.h>
#include <Events_Loop.h>
#include <Events_LongOp.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <Config_PropManager.h>
using namespace std;
} else {
int aCount = myProcessed[theFeature];
if (aCount > 100) { // too many repetition of processing (in VS it may crash on 330 with stack overflow)
- Events_Error::send(
- "Feature '" + theFeature->data()->name() + "' is updated in infinitive loop");
+ Events_InfoMessage("Model_Update",
+ "Feature '%1' is updated in infinitive loop").arg(theFeature->data()->name()).send();
return false;
}
myProcessed[theFeature] = aCount + 1;
}
} catch(...) {
aState = ModelAPI_StateExecFailed;
- Events_Error::send(
- "Feature " + theFeature->getKind() + " has failed during the execution");
+ Events_InfoMessage("Model_Update",
+ "Feature %1 has failed during the execution").arg(theFeature->getKind()).send();
}
// The macro feature has to be deleted in any case even its execution is failed
myWaitForFinish.insert(theFeature);
#include <ModelAPI_Feature.h>
#include <Model_Data.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
void Model_ValidatorsFactory::registerValidator(const std::string& theID,
ModelAPI_Validator* theValidator)
{
if (myIDs.find(theID) != myIDs.end()) {
- Events_Error::send(std::string("Validator ") + theID + " is already registered");
+ Events_InfoMessage("Model_Validator", "Validator %1 is already registered").arg(theID).send();
} else {
myIDs[theID] = theValidator;
}
AttrValidators::const_iterator aValidatorsIt = aFeatureIt->second.cbegin();
for (; aValidatorsIt != aFeatureIt->second.cend(); aValidatorsIt++) {
if (!validator(aValidatorsIt->first)) {
- Events_Error::send(std::string("Validator ") + aValidatorsIt->first + " was not registered");
+ Events_InfoMessage("Model_Validator", "Validator %1 was not registered")
+ .arg(aValidatorsIt->first).send();
} else {
theValidators.push_back(std::make_pair(aValidatorsIt->first, aValidatorsIt->second));
}
AttrValidators::const_iterator aValidatorsIt = anAttrIt->second.cbegin();
for (; aValidatorsIt != anAttrIt->second.cend(); aValidatorsIt++) {
if (!validator(aValidatorsIt->first)) {
- Events_Error::send(std::string("Validator ") + aValidatorsIt->first + " was not registered");
+ Events_InfoMessage("Model_Validator", "Validator %1 was not registered")
+ .arg(aValidatorsIt->first).send();
} else {
theValidators.push_back(std::make_pair(aValidatorsIt->first, aValidatorsIt->second));
}
/// Event ID that visualization must be redisplayed (comes with ModelAPI_ObjectUpdatedMessage)
static const char * EVENT_OPERATION_LAUNCHED = "OperationLaunched";
/// Event ID that plugin is loaded (comes with ModelAPI_ObjectUpdatedMessage)
-static const char * EVENT_PLUGIN_LOADED = "PliginLoaded";
+static const char * EVENT_PLUGIN_LOADED = "PluginLoaded";
//
static const char * EVENT_DOCUMENT_CHANGED = "CurrentDocumentChanged";
#include <ModelAPI_Attribute.h>
#include <ModelAPI_Data.h>
//#include <ModelAPI_AttributeValidator.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
void ModuleBase_FilterFactory::registerFilter(const std::string& theID,
ModuleBase_Filter* theFilter)
{
if (myIDs.find(theID) != myIDs.end()) {
- Events_Error::send(std::string("Filter ") + theID + " is already registered");
+ Events_InfoMessage("ModuleBase_FilterFactory", "Filter %1 is already registered").arg(theID).send();
} else {
myIDs[theID] = theFilter;
}
std::map<std::string, ModuleBase_Filter*>::const_iterator aFound = myIDs.find(
aValIter->first);
if (aFound == myIDs.end()) {
- Events_Error::send(std::string("Filter ") + aValIter->first + " was not registered");
+ Events_InfoMessage("ModuleBase_FilterFactory", "Filter %1 was not registered")
+ .arg(aValIter->first).send();
} else {
ModuleBase_Filter* aFilter = aFound->second;
aFilter->setArguments(aValIter->second);
#include <Config_PointerMessage.h>
#include <Config_WidgetReader.h>
#include <Config_ModuleReader.h>
+#include <Config_Translator.h>
#include <QAction>
#include <QMainWindow>
#include <QLayout>
#include <QDialogButtonBox>
#include <QPushButton>
+#include <QTextCodec>
ModuleBase_IModule::ModuleBase_IModule(ModuleBase_IWorkshop* theParent)
: QObject(theParent), myWorkshop(theParent)
QString ModuleBase_IModule::getFeatureError(const FeaturePtr& theFeature)
{
- return ModelAPI_Tools::getFeatureError(theFeature).c_str();
+ QString aMsg = ModelAPI_Tools::getFeatureError(theFeature).c_str();
+ if (!aMsg.isEmpty()) {
+ std::string aStr = Config_Translator::translate(theFeature->getKind(), aMsg.toStdString()).c_str();
+ std::string aCodec = Config_Translator::codec(theFeature->getKind());
+ aMsg = QTextCodec::codecForName(aCodec.c_str())->toUnicode(aStr.c_str());
+ }
+ return aMsg;
}
void ModuleBase_IModule::grantedOperationIds(ModuleBase_Operation* theOperation,
#include <ModelAPI_ResultConstruction.h>
#include <GeomAPI_PlanarEdges.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <Events_Loop.h>
#include <BRep_Builder.hxx>
AIS_Shape::Compute(thePresentationManager, thePresentation, theMode);
if (!aReadyToDisplay) {
- Events_Error::throwException("An empty AIS presentation: ModuleBase_ResultPrs");
+ Events_InfoMessage("ModuleBase_ResultPrs", "An empty AIS presentation: ModuleBase_ResultPrs").send();
static const Events_ID anEvent = Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION);
ModelAPI_EventCreator::get()->sendUpdated(myResult, anEvent);
}
#include <TopoDS_Iterator.hxx>
#include <GeomDataAPI_Point2D.h>
+#include <Events_InfoMessage.h>
#include <GeomAPI_ShapeExplorer.h>
-#include <Events_Error.h>
#include <Config_PropManager.h>
QString aType = theType.toLower();
if(myShapeTypes.contains(aType))
return myShapeTypes[aType];
- Events_Error::send("Shape type defined in XML is not implemented!");
+ Events_InfoMessage("ModuleBase_Tools", "Shape type defined in XML is not implemented!").send();
return TopAbs_SHAPE;
}
#include <Config_WidgetAPI.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <QStringList>
if (!myPanelToCreator.contains(aKey))
myPanelToCreator[aKey] = theCreator;
else {
- Events_Error::send("The" + aKey + " panel XML definition has been already \
-used by another widget creator");
+ Events_InfoMessage("ModuleBase_WidgetCreatorFactory",
+ "The %1 panel XML definition has been already used by another widget creator").arg(aKey).send();
}
}
if (!myCreators.contains(aKey))
myCreators[aKey] = theCreator;
else {
- Events_Error::send("The" + aKey + " widget XML definition has been already \
-used by another widget creator");
+ Events_InfoMessage("ModuleBase_WidgetCreatorFactory",
+ "The %1 widget XML definition has been already used by another widget creator").arg(aKey).send();
}
}
if (!myPageToCreator.contains(aKey))
myPageToCreator[aKey] = theCreator;
else {
- Events_Error::send("The" + aKey + " page XML definition has been already \
-used by another widget creator");
+ Events_InfoMessage("ModuleBase_WidgetCreatorFactory",
+ "The %1 page XML definition has been already used by another widget creator").arg(aKey).send();
}
}
}
#include <ModelAPI_AttributeValidator.h>
#include <Config_WidgetAPI.h>
-#include <Events_Error.h>
#include <GeomAPI_Shape.h>
)
ADD_DEFINITIONS(-DPARAMETERSPLUGIN_EXPORTS -DHAVE_DEBUG_PYTHON ${CAS_DEFINITIONS})
-ADD_LIBRARY(ParametersPlugin MODULE ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${XML_RESOURCES})
+
+SET(TEXT_RESOURCES
+ ParametersPlugin_msg_ru.ts
+)
+
+QT4_CREATE_TRANSLATION(QM_RESOURCES
+ ${PROJECT_SOURCES}
+ ${TEXT_RESOURCES}
+ OPTIONS -extensions cpp -no-recursive
+ )
+
+SET(PROJECT_AUTOMOC
+ ${CMAKE_CURRENT_BINARY_DIR}/ParametersPlugin_automoc.cpp
+)
+
+
+SOURCE_GROUP ("Generated Files" FILES ${PROJECT_AUTOMOC} ${QM_RESOURCES})
+SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES})
+
+ADD_LIBRARY(ParametersPlugin MODULE ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${XML_RESOURCES} ${QM_RESOURCES})
+
TARGET_LINK_LIBRARIES(ParametersPlugin ${PROJECT_LIBRARIES})
INSTALL(TARGETS ParametersPlugin DESTINATION ${SHAPER_INSTALL_PLUGIN_FILES})
INSTALL(FILES ${XML_RESOURCES} DESTINATION ${SHAPER_INSTALL_XML_RESOURCES})
+INSTALL(FILES ${QM_RESOURCES} DESTINATION ${SHAPER_INSTALL_QM_RESOURCES})
ADD_UNIT_TESTS(TestParameterCreation.py
TestParameterRename.py
#include <ParametersPlugin_Parameter.h>
#include <ParametersPlugin_PyInterp.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_AttributeInteger.h>
} else if (theMessage->eventID() == kReplaceParameterEvent) {
processReplaceParameterEvent(theMessage);
} else {
- Events_Error::send(std::string("ParametersPlugin python interpreter, unhandled message caught: ")
- + theMessage->eventID().eventText());
+ Events_InfoMessage("ParametersPlugin_EvalListener",
+ "ParametersPlugin python interpreter, unhandled message caught: ")
+ .arg(theMessage->eventID().eventText()).send();
}
}
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="ru_RU">
+<context>
+ <name>ParametersPlugin_WidgetParamsMgr</name>
+ <message>
+ <location filename="ParametersPlugin_WidgetParamsMgr.cpp" line="165"/>
+ <source>Name</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="ParametersPlugin_WidgetParamsMgr.cpp" line="165"/>
+ <source>Equation</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="ParametersPlugin_WidgetParamsMgr.cpp" line="165"/>
+ <source>Result</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="ParametersPlugin_WidgetParamsMgr.cpp" line="165"/>
+ <source>Comment</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="ParametersPlugin_WidgetParamsMgr.cpp" line="188"/>
+ <source>Parameters</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="ParametersPlugin_WidgetParamsMgr.cpp" line="194"/>
+ <source>Features</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="ParametersPlugin_WidgetParamsMgr.cpp" line="213"/>
+ <source>Add</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="ParametersPlugin_WidgetParamsMgr.cpp" line="217"/>
+ <source>Insert</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="ParametersPlugin_WidgetParamsMgr.cpp" line="221"/>
+ <source>Remove</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="ParametersPlugin_WidgetParamsMgr.cpp" line="258"/>
+ <location filename="ParametersPlugin_WidgetParamsMgr.cpp" line="698"/>
+ <source>Warning</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="ParametersPlugin_WidgetParamsMgr.cpp" line="420"/>
+ <source>Name %1 already exists.</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
#include <ModelAPI_Session.h>
#include <ModelAPI_ResultCompSolid.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <Events_Loop.h>
#include <GeomAPI_IPresentable.h>
}
Set(aComp);
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<Events_Message> aMsg = std::shared_ptr<Events_Message>(
new Events_Message(Events_Loop::eventByName(EVENT_EMPTY_OPERATION_PRESENTATION)));
Events_Loop::loop()->send(aMsg);
#include <ModelAPI_ResultConstruction.h>
#include <GeomAPI_PlanarEdges.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <Events_Loop.h>
#include <SketchPlugin_SketchEntity.h>
}
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);
}
plugin-Sketch.xml
)
+SET(TEXT_RESOURCES
+ SketchPlugin_msg_en.ts
+)
+
+SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES})
+
ADD_DEFINITIONS(-DSKETCHPLUGIN_EXPORTS)
-ADD_LIBRARY(SketchPlugin MODULE ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${XML_RESOURCES})
+ADD_LIBRARY(SketchPlugin MODULE ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${XML_RESOURCES} ${TEXT_RESOURCES})
TARGET_LINK_LIBRARIES(SketchPlugin ${PROJECT_LIBRARIES})
INCLUDE_DIRECTORIES(
INSTALL(TARGETS SketchPlugin DESTINATION ${SHAPER_INSTALL_PLUGIN_FILES})
INSTALL(FILES ${XML_RESOURCES} DESTINATION ${SHAPER_INSTALL_XML_RESOURCES})
INSTALL(DIRECTORY icons/ DESTINATION ${SHAPER_INSTALL_XML_RESOURCES}/icons/Sketch)
+INSTALL(FILES ${TEXT_RESOURCES} DESTINATION ${SHAPER_INSTALL_PLUGIN_FILES})
ADD_UNIT_TESTS(TestSketchPointLine.py
TestSketchArcCircle.py
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="en_US">
+ <context>
+ <name>Sketch</name>
+ <message>
+ <source>Model_FeatureValidator: Attribute "DirX" is not initialized.</source>
+ <translation>Select a plane for the sketch</translation>
+ </message>
+ <message>
+ <source>Model_FeatureValidator: Attribute "Features" is not initialized.</source>
+ <translation>Sketch objects are not defined</translation>
+ </message>
+ </context>
+
+ <context>
+ <name>SketchCircle</name>
+ <message>
+ <source>CircleRadius - GeomValidators_Positive: Double is not positive.</source>
+ <translation>Set a positive number for the radius value</translation>
+ </message>
+ <message>
+ <source>Model_FeatureValidator: Attribute "CircleCenter" is not initialized.</source>
+ <translation>Select a center point</translation>
+ </message>
+ </context>
+
+ <context>
+ <name>SketchConstraintHorizontal</name>
+ <message>
+ <source>Model_FeatureValidator: Attribute "ConstraintEntityA" is not initialized.</source>
+ <translation>Select a line for the constraint</translation>
+ </message>
+ <message>
+ <source>ModelAPI_StateInvalidArgument</source>
+ <translation>Wrong object is selected</translation>
+ </message>
+ </context>
+
+ <context>
+ <name>SketchConstraintPerpendicular</name>
+ <message>
+ <source>Model_FeatureValidator: Attribute "ConstraintEntityA" is not initialized.</source>
+ <translation>Select first line for the perpendicular constraint</translation>
+ </message>
+ <message>
+ <source>Model_FeatureValidator: Attribute "ConstraintEntityB" is not initialized.</source>
+ <translation>Select second line for the perpendicular constraint</translation>
+ </message>
+ </context>
+
+ <context>
+ <name>SketchConstraintRadius</name>
+ <message>
+ <source>Model_FeatureValidator: Attribute "ConstraintEntityA" is not initialized.</source>
+ <translation>Select a circle for the radius definition</translation>
+ </message>
+ </context>
+
+ <context>
+ <name>SketchConstraintVertical</name>
+ <message>
+ <source>ModelAPI_StateInvalidArgument</source>
+ <translation>Wrong object is selected</translation>
+ </message>
+ <message>
+ <source>Model_FeatureValidator: Attribute "ConstraintEntityA" is not initialized.</source>
+ <translation>Select a line for the constraint</translation>
+ </message>
+ </context>
+
+ <context>
+ <name>SketchLine</name>
+ <message>
+ <source>GeomValidators_Different: Attributes StartPoint and EndPoint are equal.</source>
+ <translation>Drag mouse pointer to select an end point</translation>
+ </message>
+ <message>
+ <source>Model_FeatureValidator: Attribute "EndPoint" is not initialized.</source>
+ <translation>Click to select an end point for the line</translation>
+ </message>
+ </context>
+</TS>
#include <SketchSolver_ConstraintMovement.h>
#ifdef _DEBUG
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <ModelAPI_AttributeRefList.h>
#include <ModelAPI_ResultConstruction.h>
#include <SketchSolver_Error.h>
ResultConstructionPtr aRC =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aRefAttr->object());
if (!aRC)
- Events_Error::send(SketchSolver_Error::NEED_OBJECT_NOT_FEATURE(), this);
+ Events_InfoMessage("SketchSolver_Builder", SketchSolver_Error::NEED_OBJECT_NOT_FEATURE(), this).send();
}
continue;
}
ResultConstructionPtr aRC =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aListIter);
if (*aListIter && !aRC)
- Events_Error::send(SketchSolver_Error::NEED_OBJECT_NOT_FEATURE(), this);
+ Events_InfoMessage("SketchSolver_Builder", SketchSolver_Error::NEED_OBJECT_NOT_FEATURE(), this).send();
}
}
}
#include <SketchSolver_Error.h>
#include <SketchSolver_Manager.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <Events_Loop.h>
#include <ModelAPI_AttributeString.h>
#include <ModelAPI_Events.h>
if (!aConstraint->error().empty()) {
if (aConstraint->error() == SketchSolver_Error::NOT_INITIALIZED())
return false; // some attribute are not initialized yet, don't show message
- Events_Error::send(aConstraint->error(), this);
+ Events_InfoMessage("SketchSolver_Group", aConstraint->error(), this).send();
}
myConstraints[theConstraint] = aConstraint;
#include <TopExp.hxx>
#include <BRep_Tool.hxx>
-#include <Events_Error.h>
-
#define PI 3.1415926535897932
IMPLEMENT_STANDARD_HANDLE(SketcherPrs_Angle, AIS_AngleDimension_);
#include <GeomAPI_Dir.h>
#include <GeomAPI_Pnt2d.h>
-#include <Events_Error.h>
-
#include <SketchPlugin_Constraint.h>
#include <Graphic3d_AspectMarker3d.hxx>
#include <SketchPlugin_Constraint.h>
-#include "Events_Error.h"
-
#include <Graphic3d_AspectLine3d.hxx>
#include <Prs3d_Root.hxx>
#include "SketcherPrs_DimensionStyleListener.h"
#include "SketcherPrs_Tools.h"
-#include <Events_Error.h>
#include <Events_Loop.h>
SketcherPrs_DimensionStyleListener::SketcherPrs_DimensionStyleListener()
#include <SketchPlugin_Constraint.h>
-#include "Events_Error.h"
-
#include <Graphic3d_AspectLine3d.hxx>
#include <Prs3d_Root.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Prs3d_Root.hxx>
-#include <Events_Error.h>
-
IMPLEMENT_STANDARD_HANDLE(SketcherPrs_HVDirection, SketcherPrs_SymbolPrs);
IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_HVDirection, SketcherPrs_SymbolPrs);
#include <SketchPlugin_Point.h>
#include <SketchPlugin_Circle.h>
-#include <Events_Error.h>
-
#include <GeomDataAPI_Point2D.h>
#include <GeomAPI_Pnt.h>
#include <GeomAPI_XYZ.h>
#include <SketchPlugin_Constraint.h>
-#include "Events_Error.h"
-
#include <Graphic3d_AspectLine3d.hxx>
#include <Prs3d_Root.hxx>
#include <SketchPlugin_Circle.h>
#include <SketchPlugin_Arc.h>
-#include <Events_Error.h>
-
#include <GeomDataAPI_Point2D.h>
#include <GeomAPI_Pnt2d.h>
#include <GeomAPI_Circ.h>
#include <GeomAPI_Vertex.h>
#include <GeomAPI_Curve.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_BndBox4f.hxx>
// The icon for constraint is not found
static const char aMsg[] = "Error! constraint images are not found";
cout<<aMsg<<endl;
- Events_Error::send(aMsg);
+ Events_InfoMessage("SketcherPrs_SymbolPrs", aMsg).send();
myIconsMap[iconName()] = Handle(Image_AlienPixMap)();
return Handle(Image_AlienPixMap)();
}
#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_Events.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <GeomDataAPI_Point2D.h>
#include <GeomAPI_Lin2d.h>
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<ModelAPI_Object> aConstraintPtr(theFeature);
ModelAPI_EventCreator::get()->sendUpdated(aConstraintPtr, anEvent);
#include <XGUI_SelectionMgr.h>
#include <Events_Loop.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <ModelAPI_Session.h>
#include <ModelAPI_Events.h>
if (myShortcuts.contains(theKeySequence)) {
QString aMessage = tr("Shortcut %1 is already defined. Ignore.");
aMessage = aMessage.arg(theKeySequence.toString());
- Events_Error::send(aMessage.toStdString());
+ Events_InfoMessage("XGUI_ActionsMgr", aMessage.toStdString()).send();
return QKeySequence();
}
myShortcuts.append(theKeySequence);
#include <ModelAPI_Session.h>
#include <Config_PropManager.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <vector>
#include <QColor>
// all AIS objects, where the color is not set, are in black.
// The color should be defined in XML or set in the attribute
theColor = Config_PropManager::color("Visualization", "object_default_color", "#000000");
- Events_Error::send("A default color is not defined in the preferences for this kind of result");
+ Events_InfoMessage("XGUI_CustomPrs",
+ "A default color is not defined in the preferences for this kind of result").send();
}
}
#include <Config_DataModelReader.h>
#include <Events_Loop.h>
-#include <Events_Error.h>
#include <QIcon>
#include <QBrush>
#include <XGUI_ErrorDialog.h>
#include <ModuleBase_Tools.h>
+#include <Config_Translator.h>
#include <QDialogButtonBox>
#include <QHBoxLayout>
#include <QLabel>
#include <QVBoxLayout>
#include <QTextEdit>
+#include <QTextCodec>
XGUI_ErrorDialog::XGUI_ErrorDialog(QWidget* parent)
: QDialog(parent)
QDialog::reject();
}
-void XGUI_ErrorDialog::addError(const QString& theError)
+void XGUI_ErrorDialog::addError(std::shared_ptr<Events_InfoMessage> theMsg)
{
- myErrors.append(theError);
+ std::string aError = Config_Translator::translate(theMsg);
+ std::string aCodec = Config_Translator::codec(theMsg->context());
+ QString aMsg = QTextCodec::codecForName(aCodec.c_str())->toUnicode(aError.c_str());
+ myErrors.append(aMsg);
refresh();
if (!isVisible()) {
show();
#include <QDialog>
class QTextEdit;
+class Events_InfoMessage;
/**
* \ingroup GUI
XGUI_EXPORT void clear();
/// Add error message
- XGUI_EXPORT void addError(const QString&);
+ XGUI_EXPORT void addError(std::shared_ptr<Events_InfoMessage> theMsg);
/// Remove error message
XGUI_EXPORT void removeError(const QString&);
{
XGUI_SelectionMgr* aSelector = myWorkshop->selector();
connect(aSelector, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
-
- XGUI_OperationMgr* anOperationMgr = myWorkshop->operationMgr();
}
XGUI_ModuleConnector::~XGUI_ModuleConnector()
#include <ModelAPI_Session.h>
#include <ModelAPI_Document.h>
#include <ModelAPI_Tools.h>
-#include <Events_Error.h>
#include <ModuleBase_Tools.h>
#include <ModelAPI_ResultPart.h>
#include <ModelAPI_CompositeFeature.h>
#include <ModelAPI_Tools.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <GeomAPI_Shape.h>
QString aErrMsg(QObject::tr("Selected parameter can not be renamed to: %1. \
There is a parameter with the same name. Its value is: %2.").arg(qPrintable(theName)).arg(aValue));
// We can not use here a dialog box for message - it will crash editing process in ObjectBrowser
- Events_Error::send(aErrMsg.toStdString());
+ Events_InfoMessage("XGUI_Tools", aErrMsg.toStdString()).send();
return false;
}
}
//#include <PartSetPlugin_Part.h>
#include <Events_Loop.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <Events_LongOp.h>
#include <ModuleBase_FilterFactory.h>
#include <Config_PropManager.h>
#include <Config_SelectionFilterMessage.h>
#include <Config_DataModelReader.h>
+#include <Config_Translator.h>
#include <SUIT_ResourceMgr.h>
myDisplayer(0)
//myViewerSelMode(TopAbs_FACE)
{
+ mySelector = new XGUI_SelectionMgr(this);
+ myModuleConnector = new XGUI_ModuleConnector(this);
+ myOperationMgr = new XGUI_OperationMgr(this, 0);
+ ModuleBase_IWorkshop* aWorkshop = moduleConnector();
+ // Has to be defined first in order to get errors and messages from other components
+ myEventsListener = new XGUI_WorkshopListener(aWorkshop);
+
#ifndef HAVE_SALOME
myMainWindow = new AppElements_MainWindow();
else
QLocale::setDefault( QLocale::system() );
#endif
+ QString aPath = Config_XMLReader::pluginConfigFile().c_str();
+ QDir aDir(aPath);
+
+ // Load translations
+ QStringList aFilters;
+ aFilters << "*_en.ts";
+ QStringList aTsFiles = aDir.entryList(aFilters, QDir::Files);
+ foreach(QString aFileName, aTsFiles) {
+ Config_Translator::load(aFileName.toStdString());
+ }
myDataModelXMLReader = new Config_DataModelReader();
- myDataModelXMLReader->readAll();
+ //myDataModelXMLReader->readAll();
myDisplayer = new XGUI_Displayer(this);
- mySelector = new XGUI_SelectionMgr(this);
connect(mySelector, SIGNAL(selectionChanged()), this, SLOT(updateCommandStatus()));
- myOperationMgr = new XGUI_OperationMgr(this, 0);
myActionsMgr = new XGUI_ActionsMgr(this);
myMenuMgr = new XGUI_MenuMgr(this);
myErrorDlg = new XGUI_ErrorDialog(QApplication::desktop());
//connect(myViewerProxy, SIGNAL(selectionChanged()),
// myActionsMgr, SLOT(updateOnViewSelection()));
- myModuleConnector = new XGUI_ModuleConnector(this);
-
- ModuleBase_IWorkshop* aWorkshop = moduleConnector();
myOperationMgr->setWorkshop(aWorkshop);
myErrorMgr = new XGUI_ErrorMgr(this, aWorkshop);
- myEventsListener = new XGUI_WorkshopListener(aWorkshop);
connect(myOperationMgr, SIGNAL(operationStarted(ModuleBase_Operation*)),
SLOT(onOperationStarted(ModuleBase_Operation*)));
onTrihedronVisibilityChanged(true);
#endif
- connect(this, SIGNAL(errorOccurred(const QString&)), myErrorDlg, SLOT(addError(const QString&)));
- connect(myEventsListener, SIGNAL(errorOccurred(const QString&)),
- myErrorDlg, SLOT(addError(const QString&)));
+ connect(myEventsListener, SIGNAL(errorOccurred(std::shared_ptr<Events_InfoMessage>)),
+ myErrorDlg, SLOT(addError(std::shared_ptr<Events_InfoMessage>)));
//Config_PropManager::registerProp("Visualization", "object_default_color", "Object color",
// Config_Prop::Color, "225,225,225");
//******************************************************
XGUI_Workshop::~XGUI_Workshop(void)
{
+#ifdef _DEBUG
+#ifdef MISSED_TRANSLATION
+ // Save Missed translations
+ Config_Translator::saveMissedTranslations();
+#endif
+#endif
+
delete myDisplayer;
delete myDataModelXMLReader;
}
//******************************************************
void XGUI_Workshop::startApplication()
{
+ //Initialize event listening
+ myEventsListener->initializeEventListening();
+
+ myDataModelXMLReader->readAll();
initMenu();
Config_PropManager::registerProp("Plugins", "default_path", "Default Path",
Config_Prop::Directory, "");
- //Initialize event listening
- myEventsListener->initializeEventListening();
registerValidators();
std::string aFeatureKind = aFeature->getKind();
foreach (ModuleBase_ModelWidget* aWidget, aWidgets) {
if (!aWidget->attributeID().empty() && !aFeature->attribute(aWidget->attributeID()).get()) {
- std::string anErrorMsg = "The feature '" + aFeatureKind + "' has no attribute '"
- + aWidget->attributeID() + "' used by widget '"
- + aWidget->metaObject()->className() + "'.";
- Events_Error::send(anErrorMsg);
+ std::string anErrorMsg = "The feature '%1' has no attribute '%2' used by widget '%3'.";
+ Events_InfoMessage("XGUI_Workshop", anErrorMsg)
+ .arg(aFeatureKind).arg(aWidget->attributeID()).arg(aWidget->metaObject()->className()).send();
myPropertyPanel->cleanContent();
return;
}
if (!err.isEmpty()) {
if (desktop()) {
- Events_Error::send(err.toStdString());
+ Events_InfoMessage("XGUI_Workshop", err.toStdString()).send();
} else {
qWarning(qPrintable(err));
}
/// Emitted when selection happens in Salome viewer
void salomeViewerSelection();
- /// Emitted when error in application happens
- void errorOccurred(const QString&);
-
//! the signal about the workshop actions states are updated.
void commandStatusUpdated();
#include <ModelAPI_Tools.h>
#include <Events_Loop.h>
-#include <Events_Error.h>
#include <Events_LongOp.h>
#include <ModuleBase_IWorkshop.h>
#include <Config_PointerMessage.h>
#include <Config_SelectionFilterMessage.h>
#include <Config_Keywords.h>
+#include <Events_InfoMessage.h>
#include <QApplication>
#include <QMainWindow>
{
//Initialize event listening
Events_Loop* aLoop = Events_Loop::loop();
- aLoop->registerListener(this, Events_Error::errorID()); //!< Listening application errors.
+ aLoop->registerListener(this, Events_InfoMessage::errorID()); //!< Listening application errors.
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OPERATION_LAUNCHED));
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED));
aDisplayer->enableUpdateViewer(true);
} else {
//Show error dialog if error message received.
- std::shared_ptr<Events_Error> anAppError = std::dynamic_pointer_cast<Events_Error>(theMessage);
- if (anAppError) {
- emit errorOccurred(QString::fromLatin1(anAppError->description()));
+ std::shared_ptr<Events_InfoMessage> anIngfoMsg = std::dynamic_pointer_cast<Events_InfoMessage>(theMessage);
+ if (anIngfoMsg) {
+ emit errorOccurred(anIngfoMsg);
}
return;
}
#include <Events_Message.h>
#include <ModelAPI_Feature.h>
+#include <Events_InfoMessage.h>
#include <QObject>
class ModuleBase_IWorkshop;
class QString;
+class Events_InfoMessage;
/**\class XGUI_WorkshopListener
* \ingroup GUI
signals:
/// Emitted when error in applivation happens
- void errorOccurred(const QString&);
+ void errorOccurred(std::shared_ptr<Events_InfoMessage> theMsg);
protected:
/// Procedure to process postponed events
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>QObject</name>
+ <message>
+ <location filename="XGUI_Tools.cpp" line="119"/>
+ <source>Warning</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Tools.cpp" line="120"/>
+ <source>Selected objects can be used in Part documents which are not loaded: %1. Whould you like to continue?</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Tools.cpp" line="137"/>
+ <source>Selected parameter can not be renamed to: %1. There is a parameter with the same name. Its value is: %2.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="113"/>
+ <source>Move to the end</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>XGUI_ActionsMgr</name>
+ <message>
+ <location filename="XGUI_ActionsMgr.cpp" line="176"/>
+ <source>Shortcut %1 is already defined. Ignore.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_ActionsMgr.cpp" line="254"/>
+ <source>See preview</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>XGUI_ContextMenuMgr</name>
+ <message>
+ <location filename="XGUI_ContextMenuMgr.cpp" line="67"/>
+ <source>Delete</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_ContextMenuMgr.cpp" line="74"/>
+ <source>Rename</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_ContextMenuMgr.cpp" line="83"/>
+ <source>Clean history</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_ContextMenuMgr.cpp" line="86"/>
+ <source>Color...</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_ContextMenuMgr.cpp" line="89"/>
+ <source>Show</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_ContextMenuMgr.cpp" line="92"/>
+ <source>Show only</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_ContextMenuMgr.cpp" line="96"/>
+ <source>Hide</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_ContextMenuMgr.cpp" line="100"/>
+ <source>Hide all</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_ContextMenuMgr.cpp" line="104"/>
+ <source>Shading</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_ContextMenuMgr.cpp" line="107"/>
+ <source>Wireframe</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_ContextMenuMgr.cpp" line="117"/>
+ <source>Vertices</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_ContextMenuMgr.cpp" line="123"/>
+ <source>Edges</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_ContextMenuMgr.cpp" line="129"/>
+ <source>Faces</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_ContextMenuMgr.cpp" line="135"/>
+ <source>Result</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_ContextMenuMgr.cpp" line="144"/>
+ <source>Select results</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_ContextMenuMgr.cpp" line="148"/>
+ <source>Select parent feature</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_ContextMenuMgr.cpp" line="561"/>
+ <source>Selection mode</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_ContextMenuMgr.cpp" line="610"/>
+ <source>Windows</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>XGUI_DataTree</name>
+ <message>
+ <location filename="XGUI_ObjectsBrowser.cpp" line="160"/>
+ <source>History change</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>XGUI_ErrorDialog</name>
+ <message>
+ <location filename="XGUI_ErrorDialog.cpp" line="25"/>
+ <source>Application errors</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>XGUI_ObjectsBrowser</name>
+ <message>
+ <location filename="XGUI_ObjectsBrowser.cpp" line="342"/>
+ <source>Part set</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>XGUI_OperationMgr</name>
+ <message>
+ <location filename="XGUI_OperationMgr.cpp" line="221"/>
+ <location filename="XGUI_OperationMgr.cpp" line="299"/>
+ <source>Abort operation</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_OperationMgr.cpp" line="222"/>
+ <source>All active operations will be aborted.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_OperationMgr.cpp" line="297"/>
+ <source>%1 operation will be aborted.</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>XGUI_PropertyPanel</name>
+ <message>
+ <location filename="XGUI_PropertyPanel.cpp" line="49"/>
+ <location filename="XGUI_PropertyPanel.cpp" line="130"/>
+ <source>Property Panel</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>XGUI_Workshop</name>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="310"/>
+ <location filename="XGUI_Workshop.cpp" line="364"/>
+ <source>Undo</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="311"/>
+ <location filename="XGUI_Workshop.cpp" line="364"/>
+ <source>Undo last command</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="314"/>
+ <source>INF_DESK_TOOLBAR_STANDARD</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="320"/>
+ <location filename="XGUI_Workshop.cpp" line="373"/>
+ <source>Redo</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="320"/>
+ <location filename="XGUI_Workshop.cpp" line="373"/>
+ <source>Redo last command</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="337"/>
+ <source>Export native...</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="337"/>
+ <source>Export the current document into a native file</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="342"/>
+ <source>Import native...</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="342"/>
+ <source>Import native file</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="354"/>
+ <location filename="XGUI_Workshop.cpp" line="842"/>
+ <source>Save</source>
+ <extracomment>Title of the dialog which asks user if he wants to save study in existing non-empty folder</extracomment>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="354"/>
+ <source>Save the document</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="359"/>
+ <source>Save as...</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="359"/>
+ <source>Save the document into a file</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="387"/>
+ <source>Open...</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="387"/>
+ <source>Open a new document</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="391"/>
+ <source>Preferences</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="391"/>
+ <source>Edit preferences</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="395"/>
+ <source>Exit</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="395"/>
+ <source>Exit application</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="704"/>
+ <location filename="XGUI_Workshop.cpp" line="760"/>
+ <source>Save current file</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="705"/>
+ <source>The document is modified, save before opening another?</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="716"/>
+ <source>Select directory</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="721"/>
+ <source>Warning</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="721"/>
+ <source>Unable to open the file.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="760"/>
+ <source>The document is modified, save before exit?</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="826"/>
+ <source>Select directory to save files...</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="828"/>
+ <source>Directories (*)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="843"/>
+ <source>The directory already contains some files, save anyway?</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="976"/>
+ <source>Information about module "%1" doesn't exist.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="1107"/>
+ <source>Object browser</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="1439"/>
+ <source>Unused features are the following: %1.
+These features will be deleted.
+Would you like to continue?</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="1477"/>
+ <source>All features are relevant, there is nothing to be deleted</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="1977"/>
+ <source>Find results</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="XGUI_Workshop.cpp" line="1978"/>
+ <source>Results not found</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>