Merge branch 'master' into master

This commit is contained in:
younghang
2022-05-17 09:03:56 +08:00
committed by GitHub
13 changed files with 126 additions and 90 deletions

View File

@@ -96,7 +96,11 @@ def makeWindow(baseobj=None,width=None,height=None,parts=None,name=None):
else:
if baseobj:
if baseobj.getLinkedObject().isDerivedFrom("Part::Part2DObject"):
# create default component
if baseobj.Shape.Wires:
tp = "Frame"
if len(baseobj.Shape.Wires) == 1:
tp = "Solid panel"
i = 0
ws = ''
for w in baseobj.Shape.Wires:
@@ -104,7 +108,7 @@ def makeWindow(baseobj=None,width=None,height=None,parts=None,name=None):
if ws: ws += ","
ws += "Wire" + str(i)
i += 1
obj.WindowParts = ["Default","Frame",ws,"1","0"]
obj.WindowParts = ["Default",tp,ws,"1","0"]
else:
# bind properties from base obj if existing
for prop in ["Height","Width","Subvolume","Tag","Description","Material"]:

View File

@@ -1591,14 +1591,15 @@ class svgHandler(xml.sax.ContentHandler):
cy = 0
angle = argsplit[0]
if len(argsplit) >= 3:
# Rotate around a non-origin centerpoint (note: SVG y axis is opposite FreeCAD y axis)
cx = argsplit[1]
cy = argsplit[2]
m.move(Vector(cx, -cy, 0))
m.move(Vector(-cx, cy, 0)) # Reposition for rotation
# Mirroring one axis is equal to changing the direction
# of rotation
m.rotateZ(math.radians(-angle))
if len(argsplit) >= 3:
m.move(Vector(-cx, cy, 0))
m.move(Vector(cx, -cy, 0)) # Reverse repositioning
elif transformation == 'skewX':
_m = FreeCAD.Matrix(1,
-math.tan(math.radians(argsplit[0])))

View File

@@ -31,6 +31,14 @@ $CMLSTYLE
2
STANDARD
9
$LUNITS
70
2
9
$INSUNITS
70
4
9
$PEXTMAX
10
50

View File

@@ -134,7 +134,7 @@ void ViewProviderSketch::ParameterObserver::updateGridSize(const std::string & s
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher/General");
Client.GridSize.setValue(Base::Quantity::parse(QString::fromLatin1(hGrp->GetGroup("GridSize")->GetASCII("Hist0", "10.0").c_str())).getValue());
Client.GridSize.setValue(Base::Quantity::parse(QString::fromLatin1(hGrp->GetGroup("GridSize")->GetASCII("GridSize", "10.0").c_str())).getValue());
}
void ViewProviderSketch::ParameterObserver::updateEscapeKeyBehaviour(const std::string & string, App::Property * property)

View File

@@ -306,6 +306,17 @@ class DocumentBasicCases(unittest.TestCase):
self.assertEqual(obj.getSubObject(("XY_Plane", "YZ_Plane"), retType=4)[0], obj.getSubObject("XY_Plane", retType=4))
self.assertEqual(obj.getSubObject(("XY_Plane", "YZ_Plane"), retType=4)[1], obj.getSubObject("YZ_Plane", retType=4))
# Create a second origin object
obj2 = self.Doc.addObject("App::Origin", "Origin2")
self.Doc.recompute()
# Use the names of the origin's out-list
for i in obj2.OutList:
self.assertEqual(obj2.getSubObject(i.Name, retType=1).Name, i.Name)
# Add a '.' to the names
for i in obj2.OutList:
self.assertEqual(obj2.getSubObject(i.Name + '.', retType=1).Name, i.Name)
def testExtensions(self):
#we try to create a normal python object and add an extension to it
obj = self.Doc.addObject("App::DocumentObject", "Extension_1")

View File

@@ -306,7 +306,7 @@ void UnitTestDialog::setProgressFraction(float fraction, const QString& color)
}
/**
* Emtpies the error listview.
* Empties the error listview.
*/
void UnitTestDialog::clearErrorList()
{

View File

@@ -24,6 +24,7 @@
# Workbench test module
import FreeCAD, FreeCADGui, os, unittest
import tempfile
from PySide2 import QtWidgets, QtCore
from PySide2.QtWidgets import QApplication
@@ -79,3 +80,16 @@ class WorkbenchTestCase(unittest.TestCase):
def tearDown(self):
FreeCADGui.activateWorkbench(self.Active.name())
FreeCAD.Console.PrintLog(self.Active.name())
class CommandTestCase(unittest.TestCase):
def testPR6889(self):
# Fixes a crash
TempPath = tempfile.gettempdir()
macroName = TempPath + os.sep + "testmacro.py"
macroFile = open(macroName, "w")
macroFile.write("print ('Hello, World!')")
macroFile.close()
name = FreeCADGui.Command.createCustomCommand(macroName)
cmd = FreeCADGui.Command.get(name)
cmd.run()