View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000535||FreeCAD||Feature||public||2011-12-11 00:33||2011-12-16 23:45|
|Fixed in Version||0.13|
|Summary||0000535: request for python editible Properties panels|
|Description||It would be nice to be able to alter the Properties view/data panels through python, such that one could remove some of the default entries. |
For instance, if one wants to add a Point class in python, 'Line Color' is not needed and it would be nice to be able to remove it.
|Tags||No tags attached.|
Actually you have the "Line Color" if you use a Part::FeaturePython object, which already comes with several properties such as LineColor, but also with a couple of handy builtin mechanisms such as auto view representation. If you start from an App::FeaturePython, you will have a totally empty object, with no default properties. But you will also need to build up your own coin representation.
See the Draft _Dimension and _ViewProviderDimension classes in Draft.py for example, they use the App::FeaturePython.
That's exactly what I needed- thanks!
Let's close this issue.
Implementing from scratch is also possible but not so easy and a lot of work. I have added a method to set the type of a property.
To hide a property you can do this with:
||Done in rev 5271|
Too bad. The solution in rev 5271 has an ugly side-effect. Hiding an element causes to hide this attribute of ALL instances of this class. But this is not acceptable so I had to revert this commit.
So, the best solution is to follow Yorik's suggestion.
I found a better way out of this dilemma:
mode is a short int and meaning is:
0 -- default mode
1 -- read-only
2 -- hidden
This now works per object.
NOTE: The changes you made are not persistent. If you want it to be persistent you have to adjust your python wrapper class accordingly.
||Great addition Werner! thanks!|
Sorry to reopen this, but I can't get this one to work:
from FreeCAD import Base
def makePoint(x=0.0,y=0.0,z=0.0, name= "Point",size = 7,color =(0.0,1.0,0.0)):
obj = FreeCAD.ActiveDocument.addObject("Part::Vertex",name)
vp = obj.ViewObject
mode = 2
vp.PointColor = (float(color),float(color),float(color))
vp.PointSize = size
p1 = makePoint()
Oops, forgot to make the change also for the View tab. Fixed in rev 5317
|2011-12-11 00:33||danielfalck||New Issue|
|2011-12-11 12:23||yorik||Note Added: 0001463|
|2011-12-11 14:54||danielfalck||Note Added: 0001464|
|2011-12-11 20:23||wmayer||Note Added: 0001465|
|2011-12-11 20:23||wmayer||Note Added: 0001466|
|2011-12-11 20:23||wmayer||Status||new => closed|
|2011-12-11 20:23||wmayer||Resolution||open => fixed|
|2011-12-11 20:23||wmayer||Fixed in Version||=> 0.13|
|2011-12-11 23:07||wmayer||Note Added: 0001467|
|2011-12-12 11:43||wmayer||Note Added: 0001468|
|2011-12-12 12:49||yorik||Note Added: 0001469|
|2011-12-16 21:38||danielfalck||Note Added: 0001487|
|2011-12-16 21:38||danielfalck||Status||closed => feedback|
|2011-12-16 21:38||danielfalck||Resolution||fixed => reopened|
|2011-12-16 23:45||wmayer||Note Added: 0001488|
|2011-12-16 23:45||wmayer||Status||feedback => closed|
|2011-12-16 23:45||wmayer||Resolution||reopened => fixed|
|2011-12-16 23:45||wmayer||Note Edited: 0001488|