Merge branch 'master' into master
This commit is contained in:
@@ -456,7 +456,7 @@ QString UnitsSchemaMKS::schemaTranslate(const Quantity &quant, double &factor, Q
|
||||
factor = 0.001;
|
||||
}
|
||||
else if (unit == Unit::KinematicViscosity) {
|
||||
unitString = QString::fromLatin1("m^2/s)");
|
||||
unitString = QString::fromLatin1("m^2/s");
|
||||
factor = 1e6;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -15,213 +15,224 @@
|
||||
</Documentation>
|
||||
<Methode Name="addProperty">
|
||||
<Documentation>
|
||||
<UserDocu>Add a generic property.
|
||||
addProperty(string, string)
|
||||
--
|
||||
The first argument specifies the type, the second the name of the property.
|
||||
</UserDocu>
|
||||
<UserDocu>addProperty(type, name, group, doc, attr=0, ro=False, hd=False) -> ViewProvider\n
|
||||
Add a generic property.\n
|
||||
type : str\n Property type.
|
||||
name : str\n Property name. Optional.
|
||||
group : str\n Property group. Optional.
|
||||
attr : int\n Property attributes.
|
||||
ro : bool\n Read only property.
|
||||
hd : bool\n Hidden property.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="removeProperty">
|
||||
<Documentation>
|
||||
<UserDocu>Remove a generic property.
|
||||
removeProperty(string)
|
||||
--
|
||||
Note, you can only remove user-defined properties, not built-in ones.
|
||||
</UserDocu>
|
||||
<UserDocu>removeProperty(name) -> bool\n
|
||||
Remove a generic property.
|
||||
Only user-defined properties can be removed, not built-in ones.\n
|
||||
name : str\n Property name.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="supportedProperties">
|
||||
<Documentation>
|
||||
<UserDocu>A list of supported property types
|
||||
</UserDocu>
|
||||
<UserDocu>supportedProperties() -> list\n
|
||||
A list of supported property types.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="show">
|
||||
<Documentation>
|
||||
<UserDocu>Show the object
|
||||
</UserDocu>
|
||||
<UserDocu>show() -> None\n
|
||||
Show the object.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="hide">
|
||||
<Documentation>
|
||||
<UserDocu>Hide the object
|
||||
</UserDocu>
|
||||
<UserDocu>show() -> None\n
|
||||
Hide the object.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="isVisible">
|
||||
<Documentation>
|
||||
<UserDocu>Check if the object is visible
|
||||
</UserDocu>
|
||||
<UserDocu>isVisible() -> bool\n
|
||||
Check if the object is visible.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="canDragObject">
|
||||
<Documentation>
|
||||
<UserDocu>check whether the child object can be removed by dragging
|
||||
canDragObject(obj=None)
|
||||
</UserDocu>
|
||||
<UserDocu>canDragObject(obj) -> bool\n
|
||||
Check whether the child object can be removed by dragging.
|
||||
If 'obj' is not given, check without filter by any particular object.\n
|
||||
obj : App.DocumentObject\n Object to be dragged. Optional.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="dragObject">
|
||||
<Documentation>
|
||||
<UserDocu>remove a child object by dropping
|
||||
dragObject(obj)
|
||||
</UserDocu>
|
||||
<UserDocu>dragObject(obj) -> None\n
|
||||
Remove a child object by dropping.\n
|
||||
obj : App.DocumentObject\n Object to be dragged.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="canDropObject">
|
||||
<Methode Name="canDropObject" Keyword="true">
|
||||
<Documentation>
|
||||
<UserDocu>check whether the child object can be added by dropping
|
||||
canDropObject(obj=None,owner=None,subname=None)
|
||||
</UserDocu>
|
||||
<UserDocu>canDropObject(obj, owner, subname, elem) -> bool\n
|
||||
Check whether the child object can be added by dropping.
|
||||
If 'obj' is not given, check without filter by any particular object.\n
|
||||
obj : App.DocumentObject\n Object to be dropped. Optional.
|
||||
owner : App.DocumentObject\n Parent object of the dropping object. Optional.
|
||||
subname : str\n Subname reference to the dropping object. Optional.
|
||||
elem : sequence of str\n Non-objects subelements selected when the object is
|
||||
being dropped. Optional.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="dropObject">
|
||||
<Methode Name="dropObject" Keyword="true">
|
||||
<Documentation>
|
||||
<UserDocu>add a child object by dropping
|
||||
dropObject(obj,owner=None,subname=None)</UserDocu>
|
||||
<UserDocu>dropObject(obj, owner, subname, elem) -> str\n
|
||||
Add a child object by dropping.\n
|
||||
obj : App.DocumentObject\n Object to be dropped.
|
||||
owner : App.DocumentObject\n Parent object of the dropping object. Optional.
|
||||
subname : str\n Subname reference to the dropping object. Optional.
|
||||
elem : sequence of str\n Non-objects subelements selected when the object is
|
||||
being dropped. Optional.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="canDragAndDropObject">
|
||||
<Documentation>
|
||||
<UserDocu>Check whether the child object can be removed from other parent and added here by drag and drop
|
||||
canDragAndDropObject(obj)
|
||||
</UserDocu>
|
||||
<UserDocu>canDragAndDropObject(obj) -> bool\n
|
||||
Check whether the child object can be removed from
|
||||
other parent and added here by drag and drop.\n
|
||||
obj : App.DocumentObject\n Object to be dragged and dropped.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="replaceObject">
|
||||
<Documentation>
|
||||
<UserDocu>replace a child object
|
||||
replaceObject(oldObj, newObj) -> Int
|
||||
--
|
||||
Returns 1 if succeeded, 0 if not found, -1 if not supported
|
||||
</UserDocu>
|
||||
<UserDocu>replaceObject(oldObj, newObj) -> int\n
|
||||
Replace a child object.
|
||||
Returns 1 if succeeded, 0 if not found, -1 if not supported.\n
|
||||
oldObj : App.DocumentObject\n Old object.
|
||||
newObj : App.DocumentObject\n New object.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="doubleClicked">
|
||||
<Documentation>
|
||||
<UserDocu>Trigger double clicking the corresponding tree item of this view object
|
||||
</UserDocu>
|
||||
<UserDocu>doubleClicked() -> bool\n
|
||||
Trigger double clicking the corresponding tree item of this view object.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="addDisplayMode">
|
||||
<Documentation>
|
||||
<UserDocu>Add a new display mode to the view provider
|
||||
</UserDocu>
|
||||
<UserDocu>addDisplayMode(obj, mode) -> None\n
|
||||
Add a new display mode to the view provider.\n
|
||||
obj : coin.SoNode\n Display mode.
|
||||
mode : str\n Name of the display mode.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="listDisplayModes">
|
||||
<Documentation>
|
||||
<UserDocu>Show a list of all display modes
|
||||
</UserDocu>
|
||||
<UserDocu>listDisplayModes() -> list\n
|
||||
Show a list of all display modes.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="toString">
|
||||
<Documentation>
|
||||
<UserDocu>Return a string representation of the Inventor node
|
||||
</UserDocu>
|
||||
<UserDocu>toString() -> str\n
|
||||
Return a string representation of the Inventor node.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="setTransformation">
|
||||
<Documentation>
|
||||
<UserDocu>Set a transformation on the Inventor node
|
||||
</UserDocu>
|
||||
<UserDocu>setTransformation(trans) -> None\n
|
||||
Set a transformation on the Inventor node.\n
|
||||
trans : Base.Placement, Base.Matrix</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="claimChildren" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>Returns list of objects that are to be grouped in tree under this object.
|
||||
</UserDocu>
|
||||
<UserDocu>claimChildren() -> list\n
|
||||
Returns list of objects that are to be grouped in tree under this object.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="partialRender">
|
||||
<Documentation>
|
||||
<UserDocu>render only part of the object
|
||||
partialRender(sub=None,clear=False)
|
||||
--
|
||||
sub: string or list of string refer to the subelement. If it is None then reset the partial rendering.
|
||||
clear: true to add, or false to remove the subelement(s) for rendering.
|
||||
</UserDocu>
|
||||
<UserDocu>partialRender(sub=None, clear=False) -> int\n
|
||||
Render only part of the object.\n
|
||||
sub: None, str, sequence of str\n Refer to the subelement. If it is None then reset the partial rendering.
|
||||
clear: bool\n True to add, or False to remove the subelement(s) for rendering.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getElementColors">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
getElementColors(elementName=None) -> dict(elementName:color)
|
||||
</UserDocu>
|
||||
<UserDocu>getElementColors(elementName) -> dict\n
|
||||
Get a dictionary of the form {elementName : (r,g,b,a)}.
|
||||
If no element name is given a dictionary with all the elements is returned.\n
|
||||
elementName : str\n Name of the element. Optional.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="setElementColors">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
setElementColors(colors): set element colors
|
||||
--
|
||||
colors: color dictionary of type elementName:(r,g,b,a)
|
||||
</UserDocu>
|
||||
<UserDocu>setElementColors(colors) -> None\n
|
||||
Set element colors.\n
|
||||
colors: dict\n Color dictionary of the form {elementName:(r,g,b,a)}.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getElementPicked" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>return the picked subelement
|
||||
getElementPicked(pickPoint)
|
||||
</UserDocu>
|
||||
<UserDocu>getElementPicked(pickPoint) -> str\n
|
||||
Return the picked subelement.\n
|
||||
pickPoint : coin.SoPickedPoint</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getDetailPath" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>return Coin detail and path of an subelement
|
||||
getDetailPath(subname,path,append=True)
|
||||
--
|
||||
subelement: dot separated string reference to the sub element
|
||||
pPath: output coin path leading to the returned element detail
|
||||
append: If true, path will be first appended with the root node and the mode
|
||||
switch node of this view provider.
|
||||
</UserDocu>
|
||||
<UserDocu>getDetailPath(subelement, path, append=True) -> coin.SoDetail or None\n
|
||||
Return Coin detail and path of an subelement.\n
|
||||
subname: str\n Dot separated string reference to the sub element.
|
||||
pPath: coin.SoPath\n Output coin path leading to the returned element detail.
|
||||
append: bool\n If True, path will be first appended with the root node and the mode
|
||||
switch node of this view provider.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="signalChangeIcon" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>Trigger icon changed signal</UserDocu>
|
||||
<UserDocu>signalChangeIcon() -> None\n
|
||||
Trigger icon changed signal.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getBoundingBox">
|
||||
<Documentation>
|
||||
<UserDocu>obtain the bounding box of this view object
|
||||
getBoundingBox(subname=None, transform=True, view=None)
|
||||
--
|
||||
subname: the optional subname referring a sub-object
|
||||
transform: whether to apply the transformation matrix of this view provider
|
||||
view: the MDIView, default to active view
|
||||
</UserDocu>
|
||||
<UserDocu>getBoundingBox(subName, transform=True, view) -> Base.BoundBox\n
|
||||
Obtain the bounding box of this view object.\n
|
||||
subName : str\n Name referring a sub-object. Optional.
|
||||
transform: bool\n Whether to apply the transformation matrix of this view provider.
|
||||
view: View3DInventorPy\n Default to active view. Optional.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Attribute Name="Annotation" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>A pivy Separator to add a custom scenegraph to this ViewProvider</UserDocu>
|
||||
<UserDocu>A pivy Separator to add a custom scenegraph to this ViewProvider.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Annotation" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="Icon" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>The icon of this ViewProvider</UserDocu>
|
||||
<UserDocu>The icon of this ViewProvider.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Icon" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="RootNode" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>A pivy Separator with the root of this ViewProvider</UserDocu>
|
||||
<UserDocu>A pivy Separator with the root of this ViewProvider.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="RootNode" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="SwitchNode" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>A pivy SoSwitch for the display mode switch of this ViewProvider</UserDocu>
|
||||
<UserDocu>A pivy SoSwitch for the display mode switch of this ViewProvider.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="SwitchNode" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="DefaultMode" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>Get/Set the default display mode in turns of coin node index</UserDocu>
|
||||
<UserDocu>Get/Set the default display mode in turns of coin node index.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="DefaultNode" Type="Int" />
|
||||
</Attribute>
|
||||
@@ -233,19 +244,19 @@ view: the MDIView, default to active view
|
||||
</Attribute>
|
||||
<Attribute Name="CanRemoveChildrenFromRoot" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>Tells the tree view whether to remove the children item from root or not</UserDocu>
|
||||
<UserDocu>Tells the tree view whether to remove the children item from root or not.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="CanRemoveChildrenFromRoot" Type="Boolean" />
|
||||
</Attribute>
|
||||
<Attribute Name="LinkVisibility">
|
||||
<Documentation>
|
||||
<UserDocu>Get/set visibilities of all links to this view object</UserDocu>
|
||||
<UserDocu>Get/set visibilities of all links to this view object.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="LinkVisibility" Type="Boolean" />
|
||||
</Attribute>
|
||||
<Attribute Name="DropPrefix" ReadOnly="true" >
|
||||
<Documentation>
|
||||
<UserDocu>Subname referecing the sub-object for holding dropped object</UserDocu>
|
||||
<UserDocu>Subname referecing the sub-object for holding dropped object.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="DropPrefix" Type="String" />
|
||||
</Attribute>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "PythonWrapper.h"
|
||||
#include "SoFCDB.h"
|
||||
|
||||
// inclusion of the generated files (generated out of ViewProviderPy2.xml)
|
||||
// inclusion of the generated files (generated out of ViewProviderPy.xml)
|
||||
#include <Gui/ViewProviderPy.h>
|
||||
#include <Gui/ViewProviderPy.cpp>
|
||||
#include <Gui/View3DPy.h>
|
||||
@@ -128,88 +128,97 @@ PyObject* ViewProviderPy::show(PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
getViewProviderPtr()->show();
|
||||
Py_Return;
|
||||
} PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyObject* ViewProviderPy::hide(PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
getViewProviderPtr()->hide();
|
||||
Py_Return;
|
||||
} PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyObject* ViewProviderPy::isVisible(PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
return Py_BuildValue("O", (getViewProviderPtr()->isShow() ? Py_True : Py_False));
|
||||
} PY_CATCH;
|
||||
return Py::new_reference_to(Py::Boolean(getViewProviderPtr()->isShow()));
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyObject* ViewProviderPy::canDragObject(PyObject *args)
|
||||
{
|
||||
PyObject *obj = Py_None;
|
||||
if (!PyArg_ParseTuple(args, "|O", &obj))
|
||||
PyObject *obj = nullptr;
|
||||
if (!PyArg_ParseTuple(args, "|O!", &App::DocumentObjectPy::Type, &obj))
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
bool ret;
|
||||
if(obj == Py_None)
|
||||
if (!obj)
|
||||
ret = getViewProviderPtr()->canDragObjects();
|
||||
else if(!PyObject_TypeCheck(obj,&App::DocumentObjectPy::Type)) {
|
||||
PyErr_SetString(PyExc_TypeError, "exepcting a type of DocumentObject");
|
||||
return nullptr;
|
||||
}else
|
||||
else
|
||||
ret = getViewProviderPtr()->canDragObject(
|
||||
static_cast<App::DocumentObjectPy*>(obj)->getDocumentObjectPtr());
|
||||
|
||||
return Py::new_reference_to(Py::Boolean(ret));
|
||||
} PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyObject* ViewProviderPy::canDropObject(PyObject *args)
|
||||
PyObject* ViewProviderPy::canDropObject(PyObject *args, PyObject *kw)
|
||||
{
|
||||
PyObject *obj = Py_None;
|
||||
PyObject *owner = Py_None;
|
||||
PyObject *pyElements = Py_None;
|
||||
PyObject *obj = nullptr;
|
||||
PyObject *owner = nullptr;
|
||||
PyObject *pyElements = nullptr;
|
||||
const char *subname = nullptr;
|
||||
if (!PyArg_ParseTuple(args, "|OOsO", &obj,&owner,&subname,&pyElements))
|
||||
static char* kwlist[] = {"obj","owner","subname","elem",nullptr};
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kw, "|O!O!sO", kwlist,
|
||||
&App::DocumentObjectPy::Type,&obj, &App::DocumentObjectPy::Type, &owner,
|
||||
&subname, &pyElements))
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
bool ret;
|
||||
if(obj == Py_None)
|
||||
ret = getViewProviderPtr()->canDropObjects();
|
||||
else if(!PyObject_TypeCheck(obj,&App::DocumentObjectPy::Type)) {
|
||||
PyErr_SetString(PyExc_TypeError, "exepcting 'obj' to be of type DocumentObject");
|
||||
App::DocumentObject* pcObject;
|
||||
App::DocumentObject* pcOwner = nullptr;
|
||||
App::PropertyStringList elements;
|
||||
if (!obj && (owner || pyElements || subname)) {
|
||||
PyErr_SetString(PyExc_ValueError, "'obj' must be specified if 'owner', 'subname' or 'elem' is given");
|
||||
return nullptr;
|
||||
}
|
||||
auto pcObject = static_cast<App::DocumentObjectPy*>(obj)->getDocumentObjectPtr();
|
||||
App::DocumentObject *pcOwner = nullptr;
|
||||
if(owner!=Py_None) {
|
||||
if(!PyObject_TypeCheck(owner,&App::DocumentObjectPy::Type)) {
|
||||
PyErr_SetString(PyExc_TypeError, "exepcting 'owner' to be of type DocumentObject");
|
||||
return nullptr;
|
||||
}
|
||||
pcOwner = static_cast<App::DocumentObjectPy*>(owner)->getDocumentObjectPtr();
|
||||
if(!obj) {
|
||||
ret = getViewProviderPtr()->canDropObjects();
|
||||
return Py::new_reference_to(Py::Boolean(ret));
|
||||
}
|
||||
App::PropertyStringList elements;
|
||||
if(pyElements!=Py_None) {
|
||||
pcObject = static_cast<App::DocumentObjectPy*>(obj)->getDocumentObjectPtr();
|
||||
if (owner)
|
||||
pcOwner = static_cast<App::DocumentObjectPy*>(owner)->getDocumentObjectPtr();
|
||||
if (pyElements) {
|
||||
try {
|
||||
elements.setPyObject(pyElements);
|
||||
}
|
||||
catch(...) {
|
||||
PyErr_SetString(PyExc_TypeError, "exepcting the forth argument to be of type sequence of strings");
|
||||
PyErr_SetString(PyExc_TypeError, "'elem' must be a sequence of strings");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
ret = getViewProviderPtr()->canDropObjectEx(pcObject,pcOwner,subname,elements.getValues());
|
||||
return Py::new_reference_to(Py::Boolean(ret));
|
||||
} PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyObject* ViewProviderPy::canDragAndDropObject(PyObject *args)
|
||||
@@ -217,44 +226,46 @@ PyObject* ViewProviderPy::canDragAndDropObject(PyObject *args)
|
||||
PyObject *obj;
|
||||
if (!PyArg_ParseTuple(args, "O!", &App::DocumentObjectPy::Type,&obj))
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
bool ret = getViewProviderPtr()->canDragAndDropObject(
|
||||
static_cast<App::DocumentObjectPy*>(obj)->getDocumentObjectPtr());
|
||||
return Py::new_reference_to(Py::Boolean(ret));
|
||||
} PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyObject* ViewProviderPy::dropObject(PyObject *args)
|
||||
PyObject* ViewProviderPy::dropObject(PyObject *args, PyObject *kw)
|
||||
{
|
||||
PyObject *obj;
|
||||
PyObject *owner = Py_None;
|
||||
PyObject *pyElements = Py_None;
|
||||
PyObject *owner = nullptr;
|
||||
PyObject *pyElements = nullptr;
|
||||
const char *subname = nullptr;
|
||||
if (!PyArg_ParseTuple(args, "O!|OsO", &App::DocumentObjectPy::Type,&obj,&owner,&subname,&pyElements))
|
||||
static char* kwlist[] = {"obj","owner","subname","elem",nullptr};
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kw, "O!|O!sO", kwlist,
|
||||
&App::DocumentObjectPy::Type,&obj, &App::DocumentObjectPy::Type, &owner,
|
||||
&subname, &pyElements))
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
auto pcObject = static_cast<App::DocumentObjectPy*>(obj)->getDocumentObjectPtr();
|
||||
App::DocumentObject *pcOwner = nullptr;
|
||||
if(owner!=Py_None) {
|
||||
if(!PyObject_TypeCheck(owner,&App::DocumentObjectPy::Type)) {
|
||||
PyErr_SetString(PyExc_TypeError, "exepcting 'owner' to be of type DocumentObject");
|
||||
return nullptr;
|
||||
}
|
||||
pcOwner = static_cast<App::DocumentObjectPy*>(owner)->getDocumentObjectPtr();
|
||||
}
|
||||
App::PropertyStringList elements;
|
||||
if(pyElements!=Py_None) {
|
||||
if (owner)
|
||||
pcOwner = static_cast<App::DocumentObjectPy*>(owner)->getDocumentObjectPtr();
|
||||
if (pyElements) {
|
||||
try {
|
||||
elements.setPyObject(pyElements);
|
||||
}catch(...) {
|
||||
PyErr_SetString(PyExc_TypeError, "exepcting the forth argument to be of type sequence of strings");
|
||||
}
|
||||
catch(...) {
|
||||
PyErr_SetString(PyExc_TypeError, "'elem' must be a sequence of strings");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
auto ret = getViewProviderPtr()->dropObjectEx(
|
||||
static_cast<App::DocumentObjectPy*>(obj)->getDocumentObjectPtr(),
|
||||
pcOwner, subname,elements.getValues());
|
||||
auto ret = getViewProviderPtr()->dropObjectEx(pcObject,pcOwner, subname,elements.getValues());
|
||||
return Py::new_reference_to(Py::String(ret));
|
||||
} PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyObject* ViewProviderPy::dragObject(PyObject *args)
|
||||
@@ -262,11 +273,13 @@ PyObject* ViewProviderPy::dragObject(PyObject *args)
|
||||
PyObject *obj;
|
||||
if (!PyArg_ParseTuple(args, "O!", &App::DocumentObjectPy::Type,&obj))
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
getViewProviderPtr()->dragObject(
|
||||
static_cast<App::DocumentObjectPy*>(obj)->getDocumentObjectPtr());
|
||||
Py_Return;
|
||||
} PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyObject* ViewProviderPy::replaceObject(PyObject *args)
|
||||
@@ -277,12 +290,14 @@ PyObject* ViewProviderPy::replaceObject(PyObject *args)
|
||||
&App::DocumentObjectPy::Type,&oldObj,
|
||||
&App::DocumentObjectPy::Type,&newObj))
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
int ret = getViewProviderPtr()->replaceObject(
|
||||
static_cast<App::DocumentObjectPy*>(oldObj)->getDocumentObjectPtr(),
|
||||
static_cast<App::DocumentObjectPy*>(newObj)->getDocumentObjectPtr());
|
||||
return Py::new_reference_to(Py::Int(ret));
|
||||
} PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyObject* ViewProviderPy::addDisplayMode(PyObject * args)
|
||||
@@ -305,13 +320,15 @@ PyObject* ViewProviderPy::addDisplayMode(PyObject * args)
|
||||
SoNode* node = reinterpret_cast<SoNode*>(ptr);
|
||||
getViewProviderPtr()->addDisplayMaskMode(node,mode);
|
||||
Py_Return;
|
||||
} PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyObject* ViewProviderPy::listDisplayModes(PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
std::vector<std::string> modes = getViewProviderPtr()->getDisplayModes();
|
||||
PyObject* pyList = PyList_New(modes.size());
|
||||
@@ -323,17 +340,20 @@ PyObject* ViewProviderPy::listDisplayModes(PyObject *args)
|
||||
}
|
||||
|
||||
return pyList;
|
||||
} PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyObject* ViewProviderPy::toString(PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
std::string buffer = getViewProviderPtr()->toString();
|
||||
return Py::new_reference_to(Py::String(buffer));
|
||||
} PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyObject* ViewProviderPy::setTransformation(PyObject *args)
|
||||
@@ -346,13 +366,14 @@ PyObject* ViewProviderPy::setTransformation(PyObject *args)
|
||||
Py_Return;
|
||||
}
|
||||
PyErr_Clear();
|
||||
|
||||
if (PyArg_ParseTuple(args, "O!",&(Base::PlacementPy::Type),&p)) {
|
||||
Base::PlacementPy* plc = static_cast<Base::PlacementPy*>(p);
|
||||
getViewProviderPtr()->setTransformation(plc->getPlacementPtr()->toMatrix());
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_TypeError, "Either set matrix or placement to set transformation");
|
||||
PyErr_SetString(PyExc_TypeError, "The transformation must be a Base.Matrix or a Base.Placement");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -376,7 +397,7 @@ PyObject* ViewProviderPy::partialRender(PyObject* args)
|
||||
{
|
||||
PyObject *value = Py_None;
|
||||
PyObject *clear = Py_False;
|
||||
if (!PyArg_ParseTuple(args, "|OO",&value,&clear))
|
||||
if (!PyArg_ParseTuple(args, "|OO!",&value,&PyBool_Type,&clear))
|
||||
return nullptr;
|
||||
|
||||
std::vector<std::string> values;
|
||||
@@ -392,12 +413,13 @@ PyObject* ViewProviderPy::partialRender(PyObject* args)
|
||||
}
|
||||
values.resize(nSize);
|
||||
for (Py_ssize_t i = 0; i < nSize; ++i) {
|
||||
if(value) item = PySequence_GetItem(value, i);
|
||||
if(value)
|
||||
item = PySequence_GetItem(value, i);
|
||||
if (PyUnicode_Check(item)) {
|
||||
values[i] = PyUnicode_AsUTF8(item);
|
||||
}
|
||||
else {
|
||||
std::string error = std::string("type must be str or unicode");
|
||||
std::string error = std::string("type must be str");
|
||||
error += " not, ";
|
||||
error += item->ob_type->tp_name;
|
||||
throw Base::TypeError(error);
|
||||
@@ -405,7 +427,7 @@ PyObject* ViewProviderPy::partialRender(PyObject* args)
|
||||
}
|
||||
}
|
||||
|
||||
Py::Int ret(getViewProviderPtr()->partialRender(values,PyObject_IsTrue(clear)));
|
||||
Py::Int ret(getViewProviderPtr()->partialRender(values, PyObject_IsTrue(clear) ? true : false));
|
||||
return Py::new_reference_to(ret);
|
||||
}
|
||||
|
||||
@@ -453,14 +475,17 @@ PyObject* ViewProviderPy::getElementPicked(PyObject* args)
|
||||
PyObject *obj;
|
||||
if (!PyArg_ParseTuple(args, "O",&obj))
|
||||
return nullptr;
|
||||
|
||||
void *ptr = nullptr;
|
||||
Base::Interpreter().convertSWIGPointerObj("pivy.coin", "_p_SoPickedPoint", obj, &ptr, 0);
|
||||
SoPickedPoint *pp = reinterpret_cast<SoPickedPoint*>(ptr);
|
||||
if(!pp)
|
||||
throw Base::TypeError("type must be of coin.SoPickedPoint");
|
||||
throw Base::TypeError("type must be coin.SoPickedPoint");
|
||||
|
||||
std::string name;
|
||||
if(!getViewProviderPtr()->getElementPicked(pp,name))
|
||||
Py_Return;
|
||||
|
||||
return Py::new_reference_to(Py::String(name));
|
||||
}
|
||||
|
||||
@@ -469,22 +494,21 @@ PyObject* ViewProviderPy::getDetailPath(PyObject* args)
|
||||
const char *sub;
|
||||
PyObject *path;
|
||||
PyObject *append = Py_True;
|
||||
if (!PyArg_ParseTuple(args, "sO|O",&sub,&path,&append))
|
||||
if (!PyArg_ParseTuple(args, "sO|O!",&sub,&path,&PyBool_Type,&append))
|
||||
return nullptr;
|
||||
|
||||
void *ptr = nullptr;
|
||||
Base::Interpreter().convertSWIGPointerObj("pivy.coin", "_p_SoPath", path, &ptr, 0);
|
||||
SoPath *pPath = reinterpret_cast<SoPath*>(ptr);
|
||||
if(!pPath)
|
||||
throw Base::TypeError("type must be of coin.SoPath");
|
||||
throw Base::TypeError("'path' must be a coin.SoPath");
|
||||
SoDetail *det = nullptr;
|
||||
if(!getViewProviderPtr()->getDetailPath(
|
||||
sub,static_cast<SoFullPath*>(pPath),PyObject_IsTrue(append),det))
|
||||
{
|
||||
if(det) delete det;
|
||||
if(!getViewProviderPtr()->getDetailPath(sub,static_cast<SoFullPath*>(pPath),append,det)) {
|
||||
delete det;
|
||||
Py_Return;
|
||||
}
|
||||
if(!det)
|
||||
return Py::new_reference_to(Py::True());
|
||||
Py_Return;
|
||||
return Base::Interpreter().createSWIGPointerObj("pivy.coin", "_p_SoDetail", (void*)det, 0);
|
||||
}
|
||||
|
||||
@@ -492,6 +516,7 @@ PyObject *ViewProviderPy::signalChangeIcon(PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
|
||||
getViewProviderPtr()->signalChangeIcon();
|
||||
Py_Return;
|
||||
}
|
||||
@@ -500,24 +525,27 @@ PyObject *ViewProviderPy::getBoundingBox(PyObject *args) {
|
||||
PyObject *transform=Py_True;
|
||||
PyObject *pyView = nullptr;
|
||||
const char *subname = nullptr;
|
||||
if (!PyArg_ParseTuple(args, "|sOO!", &subname,&transform,View3DInventorPy::type_object(),&pyView))
|
||||
if (!PyArg_ParseTuple(args, "|sO!O!", &subname,&PyBool_Type,&transform,View3DInventorPy::type_object(),&pyView))
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
View3DInventor *view = nullptr;
|
||||
if(pyView)
|
||||
view = static_cast<View3DInventorPy*>(pyView)->getView3DIventorPtr();
|
||||
auto bbox = getViewProviderPtr()->getBoundingBox(subname,PyObject_IsTrue(transform),view);
|
||||
Py::Object ret(new Base::BoundBoxPy(new Base::BoundBox3d(bbox)));
|
||||
return Py::new_reference_to(ret);
|
||||
} PY_CATCH;
|
||||
return new Base::BoundBoxPy(new Base::BoundBox3d(bbox));
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyObject *ViewProviderPy::doubleClicked(PyObject *args) {
|
||||
if(!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
return Py::new_reference_to(Py::Boolean(getViewProviderPtr()->doubleClicked()));
|
||||
}PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyObject *ViewProviderPy::getCustomAttributes(const char* attr) const
|
||||
@@ -551,7 +579,7 @@ int ViewProviderPy::setCustomAttributes(const char* attr, PyObject* value)
|
||||
}
|
||||
}
|
||||
|
||||
Py::Object ViewProviderPy::getAnnotation(void) const
|
||||
Py::Object ViewProviderPy::getAnnotation() const
|
||||
{
|
||||
try {
|
||||
auto node = getViewProviderPtr()->getAnnotation();
|
||||
@@ -569,7 +597,7 @@ void ViewProviderPy::setAnnotation(Py::Object)
|
||||
|
||||
}
|
||||
|
||||
Py::Object ViewProviderPy::getRootNode(void) const
|
||||
Py::Object ViewProviderPy::getRootNode() const
|
||||
{
|
||||
try {
|
||||
SoSeparator* node = getViewProviderPtr()->getRoot();
|
||||
@@ -587,7 +615,7 @@ void ViewProviderPy::setRootNode(Py::Object)
|
||||
|
||||
}
|
||||
|
||||
Py::Object ViewProviderPy::getSwitchNode(void) const
|
||||
Py::Object ViewProviderPy::getSwitchNode() const
|
||||
{
|
||||
try {
|
||||
SoSwitch* node = getViewProviderPtr()->getModeSwitch();
|
||||
@@ -605,13 +633,13 @@ void ViewProviderPy::setSwitchNode(Py::Object)
|
||||
|
||||
}
|
||||
|
||||
Py::String ViewProviderPy::getIV(void) const
|
||||
Py::String ViewProviderPy::getIV() const
|
||||
{
|
||||
std::string buf = Gui::SoFCDB::writeNodesToString(getViewProviderPtr()->getRoot());
|
||||
return Py::String(buf);
|
||||
}
|
||||
|
||||
Py::Object ViewProviderPy::getIcon(void) const
|
||||
Py::Object ViewProviderPy::getIcon() const
|
||||
{
|
||||
#if 0
|
||||
QByteArray ba;
|
||||
@@ -628,7 +656,7 @@ Py::Object ViewProviderPy::getIcon(void) const
|
||||
#endif
|
||||
}
|
||||
|
||||
Py::Int ViewProviderPy::getDefaultMode(void) const
|
||||
Py::Int ViewProviderPy::getDefaultMode() const
|
||||
{
|
||||
return Py::Int((long)getViewProviderPtr()->getDefaultMode());
|
||||
}
|
||||
@@ -643,14 +671,17 @@ Py::Boolean ViewProviderPy::getCanRemoveChildrenFromRoot() const
|
||||
return Py::Boolean(getViewProviderPtr()->canRemoveChildrenFromRoot());
|
||||
}
|
||||
|
||||
Py::Boolean ViewProviderPy::getLinkVisibility() const {
|
||||
Py::Boolean ViewProviderPy::getLinkVisibility() const
|
||||
{
|
||||
return Py::Boolean(getViewProviderPtr()->isLinkVisible());
|
||||
}
|
||||
|
||||
void ViewProviderPy::setLinkVisibility(Py::Boolean arg) {
|
||||
void ViewProviderPy::setLinkVisibility(Py::Boolean arg)
|
||||
{
|
||||
getViewProviderPtr()->setLinkVisible(arg);
|
||||
}
|
||||
|
||||
Py::String ViewProviderPy::getDropPrefix() const {
|
||||
Py::String ViewProviderPy::getDropPrefix() const
|
||||
{
|
||||
return Py::String(getViewProviderPtr()->getDropPrefix());
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Counter of the body (or face) with a capcitance</string>
|
||||
<string>Counter of the body (or face) with a capacitance</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
|
||||
@@ -4369,8 +4369,10 @@ unsigned int GeomBezierSurface::getMemSize (void) const
|
||||
{
|
||||
unsigned int size = sizeof(Geom_BezierSurface);
|
||||
if (!mySurface.IsNull()) {
|
||||
size += mySurface->NbUPoles() * mySurface->NbVPoles() * sizeof(gp_Pnt);
|
||||
size += mySurface->NbUPoles() * mySurface->NbVPoles() * sizeof(Standard_Real);
|
||||
unsigned int poles = mySurface->NbUPoles();
|
||||
poles *= mySurface->NbVPoles();
|
||||
size += poles * sizeof(gp_Pnt);
|
||||
size += poles * sizeof(Standard_Real);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
@@ -4448,8 +4450,10 @@ unsigned int GeomBSplineSurface::getMemSize (void) const
|
||||
size += mySurface->NbUKnots() * sizeof(Standard_Integer);
|
||||
size += mySurface->NbVKnots() * sizeof(Standard_Real);
|
||||
size += mySurface->NbVKnots() * sizeof(Standard_Integer);
|
||||
size += mySurface->NbUPoles() * mySurface->NbVPoles() * sizeof(gp_Pnt);
|
||||
size += mySurface->NbUPoles() * mySurface->NbVPoles() * sizeof(Standard_Real);
|
||||
unsigned int poles = mySurface->NbUPoles();
|
||||
poles *= mySurface->NbVPoles();
|
||||
size += poles * sizeof(gp_Pnt);
|
||||
size += poles * sizeof(Standard_Real);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -41,3 +41,21 @@ import FreeCAD, FreeCADGui, os, sys, unittest, Part, PartGui
|
||||
# def tearDown(self):
|
||||
# #closing doc
|
||||
# FreeCAD.closeDocument("PartGuiTest")
|
||||
class PartGuiViewProviderTestCases(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.Doc = FreeCAD.newDocument("PartGuiTest")
|
||||
|
||||
def testCanDropObject(self):
|
||||
# https://github.com/FreeCAD/FreeCAD/pull/6850
|
||||
box = self.Doc.addObject("Part::Box", "Box")
|
||||
with self.assertRaises(TypeError):
|
||||
box.ViewObject.canDragObject(None)
|
||||
with self.assertRaises(TypeError):
|
||||
box.ViewObject.canDropObject(None)
|
||||
box.ViewObject.canDropObject()
|
||||
with self.assertRaises(TypeError):
|
||||
box.ViewObject.dropObject(box, None)
|
||||
|
||||
def tearDown(self):
|
||||
#closing doc
|
||||
FreeCAD.closeDocument("PartGuiTest")
|
||||
|
||||
@@ -116,6 +116,7 @@ private:
|
||||
Base::Console().Error("%s\n", str.c_str());
|
||||
throw Py::RuntimeError(str);
|
||||
}
|
||||
return Py::None(); //only here to prevent warning re no return value
|
||||
}
|
||||
|
||||
//! hook for FC Gui export function
|
||||
@@ -325,7 +326,7 @@ private:
|
||||
{
|
||||
PyObject *viewPy = nullptr;
|
||||
PyObject *qgiPy = nullptr;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "OO", &viewPy, &qgiPy)) {
|
||||
if (!PyArg_ParseTuple(args.ptr(), "O!O", &(TechDraw::DrawViewPy::Type), &viewPy, &qgiPy)) {
|
||||
throw Py::TypeError("expected (view, item)");
|
||||
}
|
||||
|
||||
@@ -333,28 +334,23 @@ private:
|
||||
App::DocumentObject* obj = nullptr;
|
||||
Gui::ViewProvider* vp = nullptr;
|
||||
QGIView* qgiv = nullptr;
|
||||
if (PyObject_TypeCheck(viewPy, &(TechDraw::DrawViewPy::Type))) {
|
||||
obj = static_cast<App::DocumentObjectPy*>(viewPy)->getDocumentObjectPtr();
|
||||
vp = Gui::Application::Instance->getViewProvider(obj);
|
||||
if (vp) {
|
||||
TechDrawGui::ViewProviderDrawingView* vpdv =
|
||||
dynamic_cast<TechDrawGui::ViewProviderDrawingView*>(vp);
|
||||
if (vpdv) {
|
||||
qgiv = vpdv->getQView();
|
||||
if (qgiv != nullptr) {
|
||||
Gui::PythonWrapper wrap;
|
||||
if (!wrap.loadCoreModule() ||
|
||||
!wrap.loadGuiModule() ||
|
||||
!wrap.loadWidgetsModule()) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Failed to load Python wrapper for Qt");
|
||||
return Py::None();
|
||||
}
|
||||
QGraphicsItem* item = wrap.toQGraphicsItem(qgiPy);
|
||||
if (item != nullptr) {
|
||||
qgiv->addArbitraryItem(item);
|
||||
}
|
||||
obj = static_cast<App::DocumentObjectPy*>(viewPy)->getDocumentObjectPtr();
|
||||
vp = Gui::Application::Instance->getViewProvider(obj);
|
||||
if (vp) {
|
||||
TechDrawGui::ViewProviderDrawingView* vpdv =
|
||||
dynamic_cast<TechDrawGui::ViewProviderDrawingView*>(vp);
|
||||
if (vpdv) {
|
||||
qgiv = vpdv->getQView();
|
||||
if (qgiv != nullptr) {
|
||||
Gui::PythonWrapper wrap;
|
||||
if (!wrap.loadGuiModule()) {
|
||||
throw Py::RuntimeError("Failed to load Python wrapper for Qt::Gui");
|
||||
}
|
||||
QGraphicsItem* item = wrap.toQGraphicsItem(qgiPy);
|
||||
if (item != nullptr) {
|
||||
qgiv->addArbitraryItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -373,7 +369,7 @@ private:
|
||||
{
|
||||
PyObject *viewPy = nullptr;
|
||||
PyObject *qgiPy = nullptr;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "OO", &viewPy, &qgiPy)) {
|
||||
if (!PyArg_ParseTuple(args.ptr(), "O!O", &(TechDraw::DrawViewPy::Type), &viewPy, &qgiPy)) {
|
||||
throw Py::TypeError("expected (view, item)");
|
||||
}
|
||||
|
||||
@@ -381,28 +377,23 @@ private:
|
||||
App::DocumentObject* obj = nullptr;
|
||||
Gui::ViewProvider* vp = nullptr;
|
||||
QGIView* qgiv = nullptr;
|
||||
if (PyObject_TypeCheck(viewPy, &(TechDraw::DrawViewPy::Type))) {
|
||||
obj = static_cast<App::DocumentObjectPy*>(viewPy)->getDocumentObjectPtr();
|
||||
vp = Gui::Application::Instance->getViewProvider(obj);
|
||||
if (vp) {
|
||||
TechDrawGui::ViewProviderDrawingView* vpdv =
|
||||
dynamic_cast<TechDrawGui::ViewProviderDrawingView*>(vp);
|
||||
if (vpdv) {
|
||||
qgiv = vpdv->getQView();
|
||||
if (qgiv != nullptr) {
|
||||
Gui::PythonWrapper wrap;
|
||||
if (!wrap.loadCoreModule() ||
|
||||
!wrap.loadGuiModule() ||
|
||||
!wrap.loadWidgetsModule()) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Failed to load Python wrapper for Qt");
|
||||
return Py::None();
|
||||
}
|
||||
QGraphicsObject* item = wrap.toQGraphicsObject(qgiPy);
|
||||
if (item != nullptr) {
|
||||
qgiv->addArbitraryItem(item);
|
||||
}
|
||||
obj = static_cast<App::DocumentObjectPy*>(viewPy)->getDocumentObjectPtr();
|
||||
vp = Gui::Application::Instance->getViewProvider(obj);
|
||||
if (vp) {
|
||||
TechDrawGui::ViewProviderDrawingView* vpdv =
|
||||
dynamic_cast<TechDrawGui::ViewProviderDrawingView*>(vp);
|
||||
if (vpdv) {
|
||||
qgiv = vpdv->getQView();
|
||||
if (qgiv != nullptr) {
|
||||
Gui::PythonWrapper wrap;
|
||||
if (!wrap.loadGuiModule()) {
|
||||
throw Py::RuntimeError("Failed to load Python wrapper for Qt::Gui");
|
||||
}
|
||||
}
|
||||
QGraphicsObject* item = wrap.toQGraphicsObject(qgiPy);
|
||||
if (item != nullptr) {
|
||||
qgiv->addArbitraryItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -477,8 +477,6 @@ bool TaskCenterLine::accept()
|
||||
|
||||
bool TaskCenterLine::reject()
|
||||
{
|
||||
Gui::Command::abortCommand();
|
||||
|
||||
Gui::Document* doc = Gui::Application::Instance->getDocument(m_basePage->getDocument());
|
||||
if (!doc)
|
||||
return false;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>489</width>
|
||||
<height>601</height>
|
||||
<height>611</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@@ -26,15 +26,15 @@
|
||||
<string>Format Symbols</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_GDT">
|
||||
<property name="text">
|
||||
<string>GD&T</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="grid_GDT">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_GDT">
|
||||
<property name="text">
|
||||
<string>GD&T</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="pbA01">
|
||||
<property name="toolTip">
|
||||
@@ -236,7 +236,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="pbB04">
|
||||
<property name="font">
|
||||
<font>
|
||||
@@ -401,7 +401,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
@@ -493,7 +493,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pbD03">
|
||||
<property name="toolTip">
|
||||
<string>(Arc) Second</string>
|
||||
@@ -513,7 +513,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
@@ -678,7 +678,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="pbF06">
|
||||
<property name="toolTip">
|
||||
<string>Small phi</string>
|
||||
@@ -698,7 +698,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="grid_Format">
|
||||
@@ -712,7 +712,7 @@
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="leFormat"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbPreview">
|
||||
<property name="text">
|
||||
<string>Preview:</string>
|
||||
@@ -726,7 +726,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
Reference in New Issue
Block a user