Better error messages for bad selections

This commit is contained in:
wandererfan
2018-09-23 15:47:38 -04:00
committed by wmayer
parent f9b9de42dd
commit df0eb076a6
3 changed files with 11 additions and 11 deletions

View File

@@ -272,7 +272,7 @@ void CmdTechDrawNewView::activated(int iMsg)
if ((shapes.empty()) &&
(groups.empty())) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
QObject::tr("Can not make a View from this selection"));
QObject::tr("No Shapes or Groups in this selection"));
return;
}
if (!groups.empty()) {
@@ -506,7 +506,7 @@ void CmdTechDrawProjGroup::activated(int iMsg)
if ((shapes.empty()) &&
(groups.empty())) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
QObject::tr("Can not make a ProjectionGroup from this selection"));
QObject::tr("No Shapes or Groups in this selection"));
return;
}
if (!groups.empty()) {
@@ -612,7 +612,7 @@ bool CmdTechDrawProjGroup::isActive(void)
// std::vector<App::DocumentObject*> shapes = getSelection().getObjectsOfType(App::DocumentObject::getClassTypeId());
// if (shapes.empty()) {
// QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
// QObject::tr("Can not make a MultiView from this selection."));
// QObject::tr("Can not MultiView from this selection."));
// return;
// }

View File

@@ -296,7 +296,7 @@ void CmdTechDrawNewRadiusDimension::activated(int iMsg)
}
} else {
std::stringstream edgeMsg;
edgeMsg << "Can't make a radius Dimension from this selection (edge type: " << _edgeTypeToText(edgeType) << ")";
edgeMsg << "Selection for Radius does not contain a circular edge (edge type: " << _edgeTypeToText(edgeType) << ")";
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Incorrect Selection"),
QObject::tr(edgeMsg.str().c_str()));
return;
@@ -396,7 +396,7 @@ void CmdTechDrawNewDiameterDimension::activated(int iMsg)
}
} else {
std::stringstream edgeMsg;
edgeMsg << "Can't make a diameter Dimension from this selection (edge type: " << _edgeTypeToText(edgeType) << ")";
edgeMsg << "Selection for Diameter does not contain a circular edge (edge type: " << _edgeTypeToText(edgeType) << ")";
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Incorrect Selection"),
QObject::tr(edgeMsg.str().c_str()));
return;
@@ -506,7 +506,7 @@ void CmdTechDrawNewLengthDimension::activated(int iMsg)
subs.push_back(SubNames[1]);
} else {
std::stringstream edgeMsg;
edgeMsg << "Can't make a length Dimension from this selection (edge type: " << _edgeTypeToText(edgeType) << ")";
edgeMsg << "Need 2 Vetexes, 1 straight Edge, 1 Vertex/1 straight edge or 2 straight Edges for length Dimension (edge type: " << _edgeTypeToText(edgeType) << ")";
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Incorrect Selection"),
QObject::tr(edgeMsg.str().c_str()));
return;
@@ -618,7 +618,7 @@ void CmdTechDrawNewDistanceXDimension::activated(int iMsg)
subs.push_back(SubNames[1]);
} else {
std::stringstream edgeMsg;
edgeMsg << "Can't make a horizontal Dimension from this selection (edge type: " << _edgeTypeToText(edgeType) << ")";
edgeMsg << "Need 2 Vetexes, 1 straight Edge, 1 Vertex/1 straight edge or 2 straight Edges for Horizontal Dimension (edge type: " << _edgeTypeToText(edgeType) << ")";
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Incorrect Selection"),
QObject::tr(edgeMsg.str().c_str()));
return;
@@ -731,7 +731,7 @@ void CmdTechDrawNewDistanceYDimension::activated(int iMsg)
subs.push_back(SubNames[1]);
} else {
std::stringstream edgeMsg;
edgeMsg << "Can't make a vertical Dimension from this selection (edge type: " << _edgeTypeToText(edgeType) << ")";
edgeMsg << "Need 2 Vetexes, 1 straight Edge, 1 Vertex/1 straight edge or 2 straight Edges for Horizontal Dimension (edge type: " << _edgeTypeToText(edgeType) << ")";
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Incorrect Selection"),
QObject::tr(edgeMsg.str().c_str()));
return;
@@ -824,7 +824,7 @@ void CmdTechDrawNewAngleDimension::activated(int iMsg)
subs.push_back(SubNames[1]);
} else {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Incorrect Selection"),
QObject::tr("Can't make an angle Dimension from this selection"));
QObject::tr("Need two straight edges to make an Angle Dimension"));
return;
}

View File

@@ -379,13 +379,13 @@ bool _checkSelectionHatch(Gui::Command* cmd) {
const std::vector<std::string> &SubNames = selection[0].getSubNames();
if (SubNames.empty()) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Incorrect Selection"),
QObject::tr("Can't make a Hatched area from this selection"));
QObject::tr("No Faces to hatch in this selection"));
return false;
}
std::string gType = TechDraw::DrawUtil::getGeomTypeFromName(SubNames.at(0));
if (!(gType == "Face")) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Incorrect Selection"),
QObject::tr("No Face in this selection"));
QObject::tr("No Faces to hatch in this selection"));
return false;
}