Compare commits
24 Commits
fixSignCommand
...
0.18.2
| Author | SHA1 | Date | |
|---|---|---|---|
| dbb4cc6415 | |||
| e25cd6c71b | |||
| 1fb7ed43cf | |||
| ebca0c9836 | |||
| 476b4d5f97 | |||
| 3450cf9860 | |||
| 0dc75267fe | |||
| f7dccfaa90 | |||
| 76542ae729 | |||
| 55698377f9 | |||
| f21cbce8cd | |||
| 9152703516 | |||
| c264c76d8f | |||
| d8f5560cac | |||
| 442e411cf0 | |||
| 55080952a8 | |||
| f185504b4e | |||
| 2bc3daedcc | |||
| 2cef63f8a3 | |||
| 81a7d937bd | |||
| 64f3424cab | |||
| 64cb745ddc | |||
| 228876f8f2 | |||
| 8ece48c70b |
@@ -3031,7 +3031,13 @@ void Document::breakDependency(DocumentObject* pcObject, bool clear)
|
||||
std::vector<App::ObjectIdentifier> paths;
|
||||
pcObject->ExpressionEngine.getPathsToDocumentObject(it->second, paths);
|
||||
for (std::vector<App::ObjectIdentifier>::iterator jt = paths.begin(); jt != paths.end(); ++jt) {
|
||||
pcObject->ExpressionEngine.setValue(*jt, nullptr);
|
||||
// When nullifying the expression handle case where an identifier lacks of the property
|
||||
try {
|
||||
pcObject->ExpressionEngine.setValue(*jt, nullptr);
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
e.ReportException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -496,10 +496,27 @@ void DocumentObject::setDocument(App::Document* doc)
|
||||
onSettingDocument();
|
||||
}
|
||||
|
||||
void DocumentObject::onAboutToRemoveProperty(const char* prop)
|
||||
void DocumentObject::onAboutToRemoveProperty(const char* name)
|
||||
{
|
||||
if (_pDoc)
|
||||
_pDoc->removePropertyOfObject(this, prop);
|
||||
if (_pDoc) {
|
||||
_pDoc->removePropertyOfObject(this, name);
|
||||
|
||||
Property* prop = getDynamicPropertyByName(name);
|
||||
if (prop) {
|
||||
auto expressions = ExpressionEngine.getExpressions();
|
||||
std::vector<App::ObjectIdentifier> removeExpr;
|
||||
|
||||
for (auto it : expressions) {
|
||||
if (it.first.getProperty() == prop) {
|
||||
removeExpr.push_back(it.first);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto it : removeExpr) {
|
||||
ExpressionEngine.setValue(it, boost::shared_ptr<Expression>());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DocumentObject::onBeforeChange(const Property* prop)
|
||||
|
||||
@@ -1062,6 +1062,7 @@ boost::any ObjectIdentifier::getValue() const
|
||||
|
||||
destructor d1(pyvalue);
|
||||
|
||||
Base::PyGILStateLocker locker;
|
||||
if (!pyvalue)
|
||||
throw Base::RuntimeError("Failed to get property value.");
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
@@ -1078,12 +1079,12 @@ boost::any ObjectIdentifier::getValue() const
|
||||
return boost::any(PyString_AsString(pyvalue));
|
||||
#endif
|
||||
else if (PyUnicode_Check(pyvalue)) {
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
return boost::any(PyUnicode_AsUTF8(pyvalue));
|
||||
#else
|
||||
PyObject * s = PyUnicode_AsUTF8String(pyvalue);
|
||||
destructor d2(s);
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
return boost::any(PyUnicode_AsUTF8(s));
|
||||
#else
|
||||
return boost::any(PyString_AsString(s));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -354,13 +354,15 @@ void InterpreterSingleton::runInteractiveString(const char *sCmd)
|
||||
PyErr_Fetch(&errobj, &errdata, &errtraceback);
|
||||
|
||||
RuntimeError exc(""); // do not use PyException since this clears the error indicator
|
||||
if (errdata) {
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
if (PyUnicode_Check(errdata))
|
||||
exc.setMessage(PyUnicode_AsUTF8(errdata));
|
||||
if (PyUnicode_Check(errdata))
|
||||
exc.setMessage(PyUnicode_AsUTF8(errdata));
|
||||
#else
|
||||
if (PyString_Check(errdata))
|
||||
exc.setMessage(PyString_AsString(errdata));
|
||||
if (PyString_Check(errdata))
|
||||
exc.setMessage(PyString_AsString(errdata));
|
||||
#endif
|
||||
}
|
||||
PyErr_Restore(errobj, errdata, errtraceback);
|
||||
if (PyErr_Occurred())
|
||||
PyErr_Print();
|
||||
|
||||
@@ -571,20 +571,27 @@ QPixmap BitmapFactoryInst::merge(const QPixmap& p1, const QPixmap& p2, Position
|
||||
{
|
||||
// does the similar as the method above except that this method does not resize the resulting pixmap
|
||||
int x = 0, y = 0;
|
||||
#if QT_VERSION >= 0x050000
|
||||
qreal dpr1 = p1.devicePixelRatio();
|
||||
qreal dpr2 = p2.devicePixelRatio();
|
||||
#else
|
||||
qreal dpr1 = 1;
|
||||
qreal dpr2 = 1;
|
||||
#endif
|
||||
|
||||
switch (pos)
|
||||
{
|
||||
case TopLeft:
|
||||
break;
|
||||
case TopRight:
|
||||
x = p1.width () - p2.width ();
|
||||
x = p1.width ()/dpr1 - p2.width ()/dpr2;
|
||||
break;
|
||||
case BottomLeft:
|
||||
y = p1.height() - p2.height();
|
||||
y = p1.height()/dpr1 - p2.height()/dpr2;
|
||||
break;
|
||||
case BottomRight:
|
||||
x = p1.width () - p2.width ();
|
||||
y = p1.height() - p2.height();
|
||||
x = p1.width ()/dpr1 - p2.width ()/dpr2;
|
||||
y = p1.height()/dpr1 - p2.height()/dpr2;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+24
-12
@@ -1092,9 +1092,15 @@ void StdCmdDelete::activated(int iMsg)
|
||||
// handle the view provider
|
||||
Gui::getMainWindow()->setUpdatesEnabled(false);
|
||||
|
||||
(*it)->openTransaction("Delete");
|
||||
vpedit->onDelete(ft->getSubNames());
|
||||
(*it)->commitTransaction();
|
||||
try {
|
||||
(*it)->openTransaction("Delete");
|
||||
vpedit->onDelete(ft->getSubNames());
|
||||
(*it)->commitTransaction();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
(*it)->abortTransaction();
|
||||
e.ReportException();
|
||||
}
|
||||
|
||||
Gui::getMainWindow()->setUpdatesEnabled(true);
|
||||
Gui::getMainWindow()->update();
|
||||
@@ -1171,18 +1177,24 @@ void StdCmdDelete::activated(int iMsg)
|
||||
|
||||
if (autoDeletion) {
|
||||
Gui::getMainWindow()->setUpdatesEnabled(false);
|
||||
(*it)->openTransaction("Delete");
|
||||
for (std::vector<Gui::SelectionObject>::iterator ft = sel.begin(); ft != sel.end(); ++ft) {
|
||||
Gui::ViewProvider* vp = pGuiDoc->getViewProvider(ft->getObject());
|
||||
if (vp) {
|
||||
// ask the ViewProvider if it wants to do some clean up
|
||||
if (vp->onDelete(ft->getSubNames())) {
|
||||
doCommand(Doc,"App.getDocument(\"%s\").removeObject(\"%s\")"
|
||||
,(*it)->getName(), ft->getFeatName());
|
||||
try {
|
||||
(*it)->openTransaction("Delete");
|
||||
for (std::vector<Gui::SelectionObject>::iterator ft = sel.begin(); ft != sel.end(); ++ft) {
|
||||
Gui::ViewProvider* vp = pGuiDoc->getViewProvider(ft->getObject());
|
||||
if (vp) {
|
||||
// ask the ViewProvider if it wants to do some clean up
|
||||
if (vp->onDelete(ft->getSubNames())) {
|
||||
doCommand(Doc,"App.getDocument(\"%s\").removeObject(\"%s\")"
|
||||
,(*it)->getName(), ft->getFeatName());
|
||||
}
|
||||
}
|
||||
}
|
||||
(*it)->commitTransaction();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
(*it)->abortTransaction();
|
||||
e.ReportException();
|
||||
}
|
||||
(*it)->commitTransaction();
|
||||
|
||||
Gui::getMainWindow()->setUpdatesEnabled(true);
|
||||
Gui::getMainWindow()->update();
|
||||
|
||||
@@ -98,6 +98,12 @@ void Gui::GUIApplicationNativeEventAware::initSpaceball(QMainWindow *window)
|
||||
mainWindow = window;
|
||||
|
||||
#if defined(Q_OS_LINUX) && defined(SPNAV_FOUND)
|
||||
#if QT_VERSION >= 0x050200
|
||||
if (!QX11Info::isPlatformX11()) {
|
||||
Base::Console().Log("Application is not running on X11\n");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (spnav_x11_open(QX11Info::display(), window->winId()) == -1) {
|
||||
Base::Console().Log("Couldn't connect to spacenav daemon\n");
|
||||
} else {
|
||||
|
||||
@@ -390,7 +390,16 @@ int PolyPickerSelection::locationEvent(const SoLocation2Event* const, const QPoi
|
||||
|
||||
if (polyline.isWorking()) {
|
||||
// check the position
|
||||
#if QT_VERSION >= 0x050600
|
||||
qreal dpr = _pcView3D->getGLWidget()->devicePixelRatioF();
|
||||
#else
|
||||
qreal dpr = 1.0;
|
||||
#endif
|
||||
QRect r = _pcView3D->getGLWidget()->rect();
|
||||
if (dpr != 1.0) {
|
||||
r.setHeight(r.height()*dpr);
|
||||
r.setWidth(r.width()*dpr);
|
||||
}
|
||||
|
||||
if (!r.contains(clPoint)) {
|
||||
if (clPoint.x() < r.left())
|
||||
@@ -599,7 +608,16 @@ int FreehandSelection::locationEvent(const SoLocation2Event* const e, const QPoi
|
||||
|
||||
if (polyline.isWorking()) {
|
||||
// check the position
|
||||
#if QT_VERSION >= 0x050600
|
||||
qreal dpr = _pcView3D->getGLWidget()->devicePixelRatioF();
|
||||
#else
|
||||
qreal dpr = 1.0;
|
||||
#endif
|
||||
QRect r = _pcView3D->getGLWidget()->rect();
|
||||
if (dpr != 1.0) {
|
||||
r.setHeight(r.height()*dpr);
|
||||
r.setWidth(r.width()*dpr);
|
||||
}
|
||||
|
||||
if (!r.contains(clPoint)) {
|
||||
if (clPoint.x() < r.left())
|
||||
|
||||
@@ -116,7 +116,7 @@ QByteArray PythonOnlineHelp::loadResource(const QString& filename) const
|
||||
dict = PyDict_Copy(dict);
|
||||
|
||||
QByteArray cmd =
|
||||
"import string, os, sys, pydoc, pkgutil\n"
|
||||
"import os, sys, pydoc, pkgutil\n"
|
||||
"\n"
|
||||
"class FreeCADDoc(pydoc.HTMLDoc):\n"
|
||||
" def index(self, dir, shadowed=None):\n"
|
||||
@@ -160,7 +160,7 @@ QByteArray PythonOnlineHelp::loadResource(const QString& filename) const
|
||||
" ret = pydoc.html.index(dir, seen)\n"
|
||||
" if ret != None:\n"
|
||||
" indices.append(ret)\n"
|
||||
"contents = heading + string.join(indices) + '''<p align=right>\n"
|
||||
"contents = heading + ' '.join(indices) + '''<p align=right>\n"
|
||||
"<font color=\"#909090\" face=\"helvetica, arial\"><strong>\n"
|
||||
"pydoc</strong> by Ka-Ping Yee <ping@lfw.org></font>'''\n"
|
||||
"htmldocument=pydoc.html.page(title,contents)\n";
|
||||
|
||||
@@ -323,7 +323,8 @@ void InteractiveInterpreter::runCode(PyCodeObject* code) const
|
||||
if (PyErr_Occurred()) { /* get latest python exception information */
|
||||
PyObject *errobj, *errdata, *errtraceback;
|
||||
PyErr_Fetch(&errobj, &errdata, &errtraceback);
|
||||
if (PyDict_Check(errdata)) {
|
||||
// the error message can be empty so errdata will be null
|
||||
if (errdata && PyDict_Check(errdata)) {
|
||||
PyObject* value = PyDict_GetItemString(errdata, "swhat");
|
||||
if (value) {
|
||||
Base::RuntimeError e;
|
||||
|
||||
@@ -680,7 +680,10 @@ Py::Object PySideUicModule::loadUiType(const Py::Tuple& args)
|
||||
str << "import pyside2uic\n"
|
||||
<< "from PySide2 import QtCore, QtGui, QtWidgets\n"
|
||||
<< "import xml.etree.ElementTree as xml\n"
|
||||
<< "from cStringIO import StringIO\n"
|
||||
<< "try:\n"
|
||||
<< " from cStringIO import StringIO\n"
|
||||
<< "except:\n"
|
||||
<< " from io import StringIO\n"
|
||||
<< "\n"
|
||||
<< "uiFile = \"" << file.c_str() << "\"\n"
|
||||
<< "parsed = xml.parse(uiFile)\n"
|
||||
@@ -691,7 +694,7 @@ Py::Object PySideUicModule::loadUiType(const Py::Tuple& args)
|
||||
<< " frame = {}\n"
|
||||
<< " pyside2uic.compileUi(f, o, indent=0)\n"
|
||||
<< " pyc = compile(o.getvalue(), '<string>', 'exec')\n"
|
||||
<< " exec pyc in frame\n"
|
||||
<< " exec(pyc, frame)\n"
|
||||
<< " #Fetch the base_class and form class based on their type in the xml from designer\n"
|
||||
<< " form_class = frame['Ui_%s'%form_class]\n"
|
||||
<< " base_class = eval('QtWidgets.%s'%widget_class)\n";
|
||||
@@ -699,7 +702,10 @@ Py::Object PySideUicModule::loadUiType(const Py::Tuple& args)
|
||||
str << "import pysideuic\n"
|
||||
<< "from PySide import QtCore, QtGui\n"
|
||||
<< "import xml.etree.ElementTree as xml\n"
|
||||
<< "from cStringIO import StringIO\n"
|
||||
<< "try:\n"
|
||||
<< " from cStringIO import StringIO\n"
|
||||
<< "except:\n"
|
||||
<< " from io import StringIO\n"
|
||||
<< "\n"
|
||||
<< "uiFile = \"" << file.c_str() << "\"\n"
|
||||
<< "parsed = xml.parse(uiFile)\n"
|
||||
@@ -710,7 +716,7 @@ Py::Object PySideUicModule::loadUiType(const Py::Tuple& args)
|
||||
<< " frame = {}\n"
|
||||
<< " pysideuic.compileUi(f, o, indent=0)\n"
|
||||
<< " pyc = compile(o.getvalue(), '<string>', 'exec')\n"
|
||||
<< " exec pyc in frame\n"
|
||||
<< " exec(pyc, frame)\n"
|
||||
<< " #Fetch the base_class and form class based on their type in the xml from designer\n"
|
||||
<< " form_class = frame['Ui_%s'%form_class]\n"
|
||||
<< " base_class = eval('QtGui.%s'%widget_class)\n";
|
||||
|
||||
@@ -250,6 +250,7 @@ class _ArchMaterial:
|
||||
"The Material object"
|
||||
|
||||
def __init__(self,obj):
|
||||
|
||||
self.Type = "Material"
|
||||
obj.Proxy = self
|
||||
obj.addProperty("App::PropertyString","Description","Arch",QT_TRANSLATE_NOOP("App::Property","A description for this material"))
|
||||
@@ -259,7 +260,8 @@ class _ArchMaterial:
|
||||
obj.addProperty("App::PropertyColor","Color","Arch",QT_TRANSLATE_NOOP("App::Property","The color of this material"))
|
||||
|
||||
def onChanged(self,obj,prop):
|
||||
d = None
|
||||
|
||||
d = obj.Material
|
||||
if prop == "Material":
|
||||
if "DiffuseColor" in obj.Material:
|
||||
c = tuple([float(f) for f in obj.Material['DiffuseColor'].strip("()").split(",")])
|
||||
@@ -283,52 +285,51 @@ class _ArchMaterial:
|
||||
if hasattr(obj,"Description"):
|
||||
if obj.Description != obj.Material["Description"]:
|
||||
obj.Description = obj.Material["Description"]
|
||||
if "Name" in obj.Material:
|
||||
if hasattr(obj,"Label"):
|
||||
if obj.Label != obj.Material["Name"]:
|
||||
obj.Label = obj.Material["Name"]
|
||||
elif prop == "Label":
|
||||
if "Name" in d:
|
||||
if d["Name"] == obj.Label:
|
||||
return
|
||||
d["Name"] = obj.Label
|
||||
elif prop == "Color":
|
||||
if hasattr(obj,"Color"):
|
||||
if obj.Material:
|
||||
d = obj.Material
|
||||
val = str(obj.Color[:3])
|
||||
if "DiffuseColor" in d:
|
||||
if d["DiffuseColor"] == val:
|
||||
return
|
||||
d["DiffuseColor"] = val
|
||||
val = str(obj.Color[:3])
|
||||
if "DiffuseColor" in d:
|
||||
if d["DiffuseColor"] == val:
|
||||
return
|
||||
d["DiffuseColor"] = val
|
||||
elif prop == "Transparency":
|
||||
if hasattr(obj,"Transparency"):
|
||||
if obj.Material:
|
||||
d = obj.Material
|
||||
val = str(obj.Transparency)
|
||||
if "Transparency" in d:
|
||||
if d["Transparency"] == val:
|
||||
return
|
||||
d["Transparency"] = val
|
||||
val = str(obj.Transparency)
|
||||
if "Transparency" in d:
|
||||
if d["Transparency"] == val:
|
||||
return
|
||||
d["Transparency"] = val
|
||||
elif prop == "ProductURL":
|
||||
if hasattr(obj,"ProductURL"):
|
||||
if obj.Material:
|
||||
d = obj.Material
|
||||
val = obj.ProductURL
|
||||
if "ProductURL" in d:
|
||||
if d["ProductURL"] == val:
|
||||
return
|
||||
obj.Material["ProductURL"] = val
|
||||
val = obj.ProductURL
|
||||
if "ProductURL" in d:
|
||||
if d["ProductURL"] == val:
|
||||
return
|
||||
obj.Material["ProductURL"] = val
|
||||
elif prop == "StandardCode":
|
||||
if hasattr(obj,"StandardCode"):
|
||||
if obj.Material:
|
||||
d = obj.Material
|
||||
val = obj.StandardCode
|
||||
if "StandardCode" in d:
|
||||
if d["StandardCode"] == val:
|
||||
return
|
||||
d["StandardCode"] = val
|
||||
val = obj.StandardCode
|
||||
if "StandardCode" in d:
|
||||
if d["StandardCode"] == val:
|
||||
return
|
||||
d["StandardCode"] = val
|
||||
elif prop == "Description":
|
||||
if hasattr(obj,"Description"):
|
||||
if obj.Material:
|
||||
d = obj.Material
|
||||
val = obj.Description
|
||||
if "Description" in d:
|
||||
if d["Description"] == val:
|
||||
return
|
||||
d["Description"] = val
|
||||
if d:
|
||||
val = obj.Description
|
||||
if "Description" in d:
|
||||
if d["Description"] == val:
|
||||
return
|
||||
d["Description"] = val
|
||||
if d and (d != obj.Material):
|
||||
obj.Material = d
|
||||
if FreeCAD.GuiUp:
|
||||
import FreeCADGui
|
||||
|
||||
@@ -674,8 +674,12 @@ class _Roof(ArchComponent.Component):
|
||||
if obj.Base.Shape.Solids:
|
||||
return obj.Shape
|
||||
else :
|
||||
if self.sub:
|
||||
return self.sub
|
||||
if hasattr(self,"sub"):
|
||||
if self.sub:
|
||||
return self.sub
|
||||
else :
|
||||
self.execute(obj)
|
||||
return self.sub
|
||||
else :
|
||||
self.execute(obj)
|
||||
return self.sub
|
||||
|
||||
+17
-17
@@ -195,7 +195,7 @@ def export(exportList,filename):
|
||||
outfile.close()
|
||||
FreeCAD.Console.PrintMessage(translate("Arch","Successfully written") + " " + decode(filename) + "\n")
|
||||
if materials:
|
||||
outfile = pythonopen(filenamemtl,"wb")
|
||||
outfile = pythonopen(filenamemtl,"w")
|
||||
outfile.write("# FreeCAD v" + ver[0] + "." + ver[1] + " build" + ver[2] + " Arch module\n")
|
||||
outfile.write("# http://www.freecadweb.org\n")
|
||||
kinds = {"AmbientColor":"Ka ","DiffuseColor":"Kd ","SpecularColor":"Ks ","EmissiveColor":"Ke ","Transparency":"d "}
|
||||
@@ -219,23 +219,23 @@ def export(exportList,filename):
|
||||
FreeCAD.Console.PrintMessage(translate("Arch","Successfully written") + ' ' + decode(filenamemtl) + "\n")
|
||||
|
||||
|
||||
def decode(name):
|
||||
"decodes encoded strings"
|
||||
try:
|
||||
decodedName = (name.decode("utf8"))
|
||||
except UnicodeDecodeError:
|
||||
try:
|
||||
decodedName = (name.decode("latin1"))
|
||||
except UnicodeDecodeError:
|
||||
FreeCAD.Console.PrintError(translate("Arch","Error: Couldn't determine character encoding"))
|
||||
decodedName = name
|
||||
return decodedName
|
||||
#def decode(name):
|
||||
# "decodes encoded strings"
|
||||
# try:
|
||||
# decodedName = (name.decode("utf8"))
|
||||
# except UnicodeDecodeError:
|
||||
# try:
|
||||
# decodedName = (name.decode("latin1"))
|
||||
# except UnicodeDecodeError:
|
||||
# FreeCAD.Console.PrintError(translate("Arch","Error: Couldn't determine character encoding"))
|
||||
# decodedName = name
|
||||
# return decodedName
|
||||
|
||||
def open(filename):
|
||||
"called when freecad wants to open a file"
|
||||
docname = (os.path.splitext(os.path.basename(filename))[0]).encode("utf8")
|
||||
doc = FreeCAD.newDocument(docname)
|
||||
doc.Label = decode(docname)
|
||||
docname = (os.path.splitext(os.path.basename(filename))[0])
|
||||
doc = FreeCAD.newDocument(docname.encode("utf8"))
|
||||
doc.Label = docname
|
||||
return insert(filename,doc.Name)
|
||||
|
||||
def insert(filename,docname):
|
||||
@@ -246,7 +246,7 @@ def insert(filename,docname):
|
||||
doc = FreeCAD.newDocument(docname)
|
||||
FreeCAD.ActiveDocument = doc
|
||||
|
||||
with pythonopen(filename,"rb") as infile:
|
||||
with pythonopen(filename,"r") as infile:
|
||||
verts = []
|
||||
facets = []
|
||||
activeobject = None
|
||||
@@ -257,7 +257,7 @@ def insert(filename,docname):
|
||||
if line[:7] == "mtllib ":
|
||||
matlib = os.path.join(os.path.dirname(filename),line[7:])
|
||||
if os.path.exists(matlib):
|
||||
with pythonopen(matlib,"rb") as matfile:
|
||||
with pythonopen(matlib,"r") as matfile:
|
||||
mname = None
|
||||
color = None
|
||||
trans = None
|
||||
|
||||
@@ -87,22 +87,13 @@ def errorDXFLib(gui):
|
||||
if gui:
|
||||
from PySide import QtGui, QtCore
|
||||
from DraftTools import translate
|
||||
if float(FreeCAD.Version()[0]+"."+FreeCAD.Version()[1]) >= 0.17:
|
||||
message = translate("Draft","""Download of dxf libraries failed.
|
||||
message = translate("Draft","""Download of dxf libraries failed.
|
||||
Please install the dxf Library addon manually
|
||||
from menu Tools -> Addon Manager""")
|
||||
else:
|
||||
message = translate("Draft","""Download of dxf libraries failed.
|
||||
Please download and install them manually.
|
||||
See complete instructions at
|
||||
http://www.freecadweb.org/wiki/Dxf_Importer_Install""")
|
||||
QtGui.QMessageBox.information(None,"",message)
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning("The DXF import/export libraries needed by FreeCAD to handle the DXF format are not installed.\n")
|
||||
if float(FreeCAD.Version()[0]+"."+FreeCAD.Version()[1]) >= 0.17:
|
||||
FreeCAD.Console.PrintWarning("Please install the dxf Library addon from Tools -> Addons Manager\n")
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning("Please check https://github.com/yorikvanhavre/Draft-dxf-importer\n")
|
||||
FreeCAD.Console.PrintWarning("Please install the dxf Library addon from Tools -> Addons Manager\n")
|
||||
break
|
||||
progressbar.stop()
|
||||
sys.path.append(FreeCAD.ConfigGet("UserAppData"))
|
||||
@@ -110,17 +101,7 @@ http://www.freecadweb.org/wiki/Dxf_Importer_Install""")
|
||||
if gui:
|
||||
from PySide import QtGui, QtCore
|
||||
from DraftTools import translate
|
||||
if float(FreeCAD.Version()[0]+"."+FreeCAD.Version()[1]) >= 0.17:
|
||||
message = translate('draft',"""The DXF import/export libraries needed by FreeCAD to handle
|
||||
the DXF format were not found on this system.
|
||||
Please either enable FreeCAD to download these libraries:
|
||||
1 - Load Draft workbench
|
||||
2 - Menu Edit > Preferences > Import-Export > DXF > Enable downloads
|
||||
Or install the libraries manually by installing the dxf-Library addon
|
||||
from menu Tools -> Addon Manager.
|
||||
To enabled FreeCAD to download these libraries, answer Yes.""")
|
||||
else:
|
||||
message = translate('draft',"""The DXF import/export libraries needed by FreeCAD to handle
|
||||
message = translate('draft',"""The DXF import/export libraries needed by FreeCAD to handle
|
||||
the DXF format were not found on this system.
|
||||
Please either enable FreeCAD to download these libraries:
|
||||
1 - Load Draft workbench
|
||||
|
||||
@@ -295,14 +295,14 @@ def fill_femresult_mechanical(res_obj, result_set):
|
||||
if len(Peeq) > 0:
|
||||
if len(Peeq.values()) != len(disp.values()):
|
||||
Pe = []
|
||||
Pe_extra_nodes = Peeq.values()
|
||||
Pe_extra_nodes = list(Peeq.values())
|
||||
nodes = len(disp.values())
|
||||
for i in range(nodes):
|
||||
Pe_value = Pe_extra_nodes[i]
|
||||
Pe.append(Pe_value)
|
||||
res_obj.Peeq = Pe
|
||||
else:
|
||||
res_obj.Peeq = Peeq.values()
|
||||
res_obj.Peeq = list(Peeq.values())
|
||||
|
||||
# fill res_obj.Temperature if they exist
|
||||
# TODO, check if it is possible to have Temperature without disp, we would need to set NodeNumbers than
|
||||
@@ -311,7 +311,7 @@ def fill_femresult_mechanical(res_obj, result_set):
|
||||
if len(Temperature) > 0:
|
||||
if len(Temperature.values()) != len(disp.values()):
|
||||
Temp = []
|
||||
Temp_extra_nodes = Temperature.values()
|
||||
Temp_extra_nodes = list(Temperature.values())
|
||||
nodes = len(disp.values())
|
||||
for i in range(nodes):
|
||||
Temp_value = Temp_extra_nodes[i]
|
||||
|
||||
@@ -536,11 +536,11 @@ class FemToolsCcx(QtCore.QRunnable, QtCore.QObject):
|
||||
ccx_path = FreeCAD.getHomePath() + "bin/ccx.exe"
|
||||
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/Ccx").SetString("ccxBinaryPath", ccx_path)
|
||||
self.ccx_binary = ccx_path
|
||||
elif system() == "Linux":
|
||||
elif system() in ("Linux", "Darwin"):
|
||||
p1 = subprocess.Popen(['which', 'ccx'], stdout=subprocess.PIPE)
|
||||
if p1.wait() == 0:
|
||||
if sys.version_info.major >= 3:
|
||||
ccx_path = str(p1.stdout.read()).split('\n')[0]
|
||||
ccx_path = p1.stdout.read().decode("utf8").split('\n')[0]
|
||||
else:
|
||||
ccx_path = p1.stdout.read().split('\n')[0]
|
||||
elif p1.wait() == 1:
|
||||
|
||||
@@ -138,8 +138,15 @@ def cmdCreateImageScaling(name):
|
||||
def accept(self):
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
try:
|
||||
locale=QtCore.QLocale.system()
|
||||
d, ok = locale.toFloat(str(eval(self.lineEdit.text())))
|
||||
try:
|
||||
q = FreeCAD.Units.parseQuantity(self.lineEdit.text())
|
||||
d = q.Value
|
||||
if q.Unit == FreeCAD.Units.Unit(): # plain number
|
||||
ok = True
|
||||
elif q.Unit == FreeCAD.Units.Length:
|
||||
ok = True
|
||||
except:
|
||||
ok = False
|
||||
if not ok:
|
||||
raise ValueError
|
||||
s=d/self.distance
|
||||
|
||||
@@ -383,8 +383,8 @@ void PartGui::DimensionLinear::setupDimension()
|
||||
|
||||
//dimension arrows
|
||||
float dimLength = (point2.getValue()-point1.getValue()).length();
|
||||
float coneHeight = dimLength * .05;
|
||||
float coneRadius = coneHeight / 2;
|
||||
float coneHeight = dimLength * 0.05;
|
||||
float coneRadius = coneHeight * 0.5;
|
||||
|
||||
SoCone *cone = new SoCone();
|
||||
cone->bottomRadius.setValue(coneRadius);
|
||||
@@ -392,8 +392,8 @@ void PartGui::DimensionLinear::setupDimension()
|
||||
|
||||
char lStr[100];
|
||||
char rStr[100];
|
||||
snprintf(lStr, sizeof(lStr), "translation %.2f 0.0 0.0", coneHeight*0.5);
|
||||
snprintf(rStr, sizeof(rStr), "translation 0.0 -%.2f 0.0", coneHeight*0.5);
|
||||
snprintf(lStr, sizeof(lStr), "translation %.6f 0.0 0.0", coneHeight * 0.5);
|
||||
snprintf(rStr, sizeof(rStr), "translation 0.0 -%.6f 0.0", coneHeight * 0.5);
|
||||
|
||||
setPart("leftArrow.shape", cone);
|
||||
set("leftArrow.transform", "rotation 0.0 0.0 1.0 1.5707963");
|
||||
@@ -1072,7 +1072,7 @@ void PartGui::DimensionAngular::setupDimension()
|
||||
|
||||
//dimension arrows
|
||||
float coneHeight = radius.getValue() * 0.1;
|
||||
float coneRadius = coneHeight / 2;
|
||||
float coneRadius = coneHeight * 0.5;
|
||||
|
||||
SoCone *cone = new SoCone();
|
||||
cone->bottomRadius.setValue(coneRadius);
|
||||
@@ -1080,8 +1080,8 @@ void PartGui::DimensionAngular::setupDimension()
|
||||
|
||||
char str1[100];
|
||||
char str2[100];
|
||||
snprintf(str1, sizeof(str1), "translation 0.0 %.2f 0.0", coneHeight*0.5);
|
||||
snprintf(str2, sizeof(str2), "translation 0.0 -%.2f 0.0", coneHeight*0.5);
|
||||
snprintf(str1, sizeof(str1), "translation 0.0 %.6f 0.0", coneHeight * 0.5);
|
||||
snprintf(str2, sizeof(str2), "translation 0.0 -%.6f 0.0", coneHeight * 0.5);
|
||||
|
||||
setPart("arrow1.shape", cone);
|
||||
set("arrow1.localTransform", "rotation 0.0 0.0 1.0 3.1415927");
|
||||
|
||||
@@ -89,7 +89,7 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
Obviously this is as fragile as can be, but currently the best we can do while the panel sheets
|
||||
hide the actual features from Path and they can't be referenced directly.
|
||||
'''
|
||||
ids = string.split(sub, '.')
|
||||
ids = sub.split(".")
|
||||
holeId = int(ids[0])
|
||||
wireId = int(ids[1])
|
||||
edgeId = int(ids[2])
|
||||
|
||||
@@ -1195,11 +1195,17 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor
|
||||
return true;
|
||||
}
|
||||
case STATUS_SKETCH_UseRubberBand: {
|
||||
// Here we must use the device-pixel-ratio to compute the correct y coordinate (#0003130)
|
||||
#if QT_VERSION >= 0x050600
|
||||
qreal dpr = viewer->getGLWidget()->devicePixelRatioF();
|
||||
#else
|
||||
qreal dpr = 1;
|
||||
#endif
|
||||
newCursorPos = cursorPos;
|
||||
rubberband->setCoords(prvCursorPos.getValue()[0],
|
||||
viewer->getGLWidget()->height() - prvCursorPos.getValue()[1],
|
||||
viewer->getGLWidget()->height()*dpr - prvCursorPos.getValue()[1],
|
||||
newCursorPos.getValue()[0],
|
||||
viewer->getGLWidget()->height() - newCursorPos.getValue()[1]);
|
||||
viewer->getGLWidget()->height()*dpr - newCursorPos.getValue()[1]);
|
||||
viewer->redraw();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,36 @@
|
||||
install(FILES org.freecadweb.FreeCAD.appdata.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/metainfo)
|
||||
install(FILES org.freecadweb.FreeCAD.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
|
||||
install(FILES org.freecadweb.FreeCAD.svg DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps)
|
||||
install(FILES org.freecadweb.FreeCAD.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/mime/packages)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
if(NOT DEFINED APPDATA_RELEASE_DATE)
|
||||
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||
execute_process(COMMAND git log -1 --pretty=%cd --date=short
|
||||
OUTPUT_VARIABLE APPDATA_RELEASE_DATE
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
else()
|
||||
file(TIMESTAMP "${CMAKE_SOURCE_DIR}/CMakeLists.txt" APPDATA_RELEASE_DATE "%Y-%m-%d")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
configure_file(
|
||||
org.freecadweb.FreeCAD.appdata.xml.in
|
||||
${CMAKE_BINARY_DIR}/org.freecadweb.FreeCAD.appdata.xml
|
||||
)
|
||||
install(
|
||||
FILES ${CMAKE_BINARY_DIR}/org.freecadweb.FreeCAD.appdata.xml
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo
|
||||
)
|
||||
|
||||
install(
|
||||
FILES org.freecadweb.FreeCAD.desktop
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications
|
||||
)
|
||||
|
||||
install(
|
||||
FILES org.freecadweb.FreeCAD.svg
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps
|
||||
)
|
||||
|
||||
install(
|
||||
FILES org.freecadweb.FreeCAD.xml
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/mime/packages
|
||||
)
|
||||
|
||||
+2
-2
@@ -29,8 +29,8 @@
|
||||
<url type="help">https://forum.freecadweb.org</url>
|
||||
<url type="donation">https://www.freecadweb.org/wiki/Donate</url>
|
||||
<update_contact>yorik_AT_uncreated.net</update_contact>
|
||||
<content_rating type="oars-1.1" />
|
||||
<content_rating type="oars-1.1"/>
|
||||
<releases>
|
||||
<release version="0.17" date="2018-04-06"></release>
|
||||
<release version="@PACKAGE_VERSION@" date="@APPDATA_RELEASE_DATE@"/>
|
||||
</releases>
|
||||
</component>
|
||||
Reference in New Issue
Block a user