This commit is contained in:
Lorenz Hüdepohl
2017-01-01 17:39:55 +01:00
4 changed files with 17 additions and 11 deletions

View File

@@ -492,8 +492,13 @@ void InputField::setMinimum(double m)
void InputField::setUnitText(const QString& str)
{
Base::Quantity quant = Base::Quantity::parse(str);
setUnit(quant.getUnit());
try {
Base::Quantity quant = Base::Quantity::parse(str);
setUnit(quant.getUnit());
}
catch (...) {
// ignore exceptions
}
}
QString InputField::getUnitText(void)

View File

@@ -108,7 +108,7 @@ PyTypeObject** SbkPySide2_QtWidgetsTypes=NULL;
using namespace Gui;
#if defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE)
#if defined (HAVE_SHIBOKEN)
namespace Shiboken {
template<> struct Converter<Base::Quantity>
{
@@ -150,13 +150,9 @@ PythonToCppFunc toCppPointerCheckFuncQuantity(PyObject* obj)
void registerTypes()
{
#if defined (HAVE_SHIBOKEN2)
//FIXME: This crashes with Shiboken2
#else
SbkConverter* convert = Shiboken::Conversions::createConverter(&Base::QuantityPy::Type, toPythonFuncQuantity);
Shiboken::Conversions::setPythonToCppPointerFunctions(convert, toCppPointerConvFuncQuantity, toCppPointerCheckFuncQuantity);
Shiboken::Conversions::registerConverterName(convert, "Base::Quantity");
#endif
}
#endif

View File

@@ -210,8 +210,10 @@ void DraftDxfRead::AddObject(Part::TopoShape *shape)
vec.push_back(shape);
layers[LayerName()] = vec;
if (!optionGroupLayers) {
Part::Feature *pcFeature = (Part::Feature *)document->addObject("Part::Feature", "Shape");
pcFeature->Shape.setValue(*shape);
if(LayerName().substr(0, 6) != "BLOCKS") {
Part::Feature *pcFeature = (Part::Feature *)document->addObject("Part::Feature", "Shape");
pcFeature->Shape.setValue(shape->getShape());
}
}
}

View File

@@ -40,7 +40,7 @@ Arguments for linuxcnc:
--line-numbers,--no-line-numbers ... prefix with line numbers (--no-lin-numbers)
--show-editor, --no-show-editor ... pop up editor before writing output(--show-editor)
'''
import FreeCAD
import datetime
from PathScripts import PostUtils
@@ -50,7 +50,10 @@ now = datetime.datetime.now()
OUTPUT_COMMENTS = True
OUTPUT_HEADER = True
OUTPUT_LINE_NUMBERS = False
SHOW_EDITOR = True
if FreeCAD.GuiUp:
SHOW_EDITOR = True
else:
SHOW_EDITOR = False
MODAL = False # if true commands are suppressed if the same as previous line.
COMMAND_SPACE = " "
LINENR = 100 # line number starting value