Draft: Renamed Layer to VisGroup

This commit is contained in:
Yorik van Havre 2014-06-10 10:21:01 -03:00
parent 2320e994b3
commit 4e595bd7bb
9 changed files with 31 additions and 31 deletions

View File

@ -93,7 +93,7 @@ class ArchWorkbench(Workbench):
"Draft_SelectGroup","Draft_SelectPlane",
"Draft_ShowSnapBar","Draft_ToggleGrid","Draft_UndoLine",
"Draft_FinishLine","Draft_CloseLine"]
self.draftutils = ["Draft_Layer","Draft_Heal","Draft_FlipDimension",
self.draftutils = ["Draft_VisGroup","Draft_Heal","Draft_FlipDimension",
"Draft_ToggleConstructionMode","Draft_ToggleContinueMode"]
self.snapList = ['Draft_Snap_Lock','Draft_Snap_Midpoint','Draft_Snap_Perpendicular',
'Draft_Snap_Grid','Draft_Snap_Intersection','Draft_Snap_Parallel',

View File

@ -1083,13 +1083,13 @@ def makeEllipse(majradius,minradius,placement=None,face=True,support=None):
FreeCAD.ActiveDocument.recompute()
return obj
def makeLayer(group=None,name="Layer"):
'''makeLayer([group]): creates a Layer object in the given group, or in the
def makeVisGroup(group=None,name="VisGroup"):
'''makeVisGroup([group]): creates a VisGroup object in the given group, or in the
active document if no group is given'''
obj = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroupPython",name)
_Layer(obj)
_VisGroup(obj)
if FreeCAD.GuiUp:
_ViewProviderLayer(obj.ViewObject)
_ViewProviderVisGroup(obj.ViewObject)
formatObject(obj)
if group:
group.addObject(obj)
@ -4890,10 +4890,10 @@ class _Facebinder(_DraftObject):
obj.Faces = objs
self.execute(obj)
class _Layer:
"The Layer object"
class _VisGroup:
"The VisGroup object"
def __init__(self,obj):
self.Type = "Layer"
self.Type = "VisGroup"
obj.Proxy = self
self.Object = obj
@ -4907,8 +4907,8 @@ class _Layer:
def execute(self,obj):
pass
class _ViewProviderLayer:
"A View Provider for the Floor object"
class _ViewProviderVisGroup:
"A View Provider for the VisGroup object"
def __init__(self,vobj):
vobj.addProperty("App::PropertyColor","LineColor","Base","")
vobj.addProperty("App::PropertyColor","ShapeColor","Base","")
@ -4923,7 +4923,7 @@ class _ViewProviderLayer:
def getIcon(self):
import Arch_rc
return ":/icons/Draft_Layer.svg"
return ":/icons/Draft_VisGroup.svg"
def attach(self,vobj):
self.Object = vobj.Object

View File

@ -4230,23 +4230,23 @@ class Draft_FlipDimension():
FreeCAD.ActiveDocument.recompute()
class Layer():
class VisGroup():
def GetResources(self):
return {'Pixmap' : 'Draft_Layer',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Draft_Layer", "Layer"),
'ToolTip' : QtCore.QT_TRANSLATE_NOOP("Draft_Layer", "Adds a layer")}
return {'Pixmap' : 'Draft_VisGroup',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Draft_VisGroup", "VisGroup"),
'ToolTip' : QtCore.QT_TRANSLATE_NOOP("Draft_VisGroup", "Adds a VisGroup")}
def Activated(self):
s = FreeCADGui.Selection.getSelection()
FreeCAD.ActiveDocument.openTransaction("Create layer")
FreeCAD.ActiveDocument.openTransaction("Create VisGroup")
FreeCADGui.doCommand("import Draft")
if len(s) == 1:
if s[0].isDerivedFrom("App::DocumentObjectGroup"):
FreeCADGui.doCommand("Draft.makeLayer(FreeCAD.ActiveDocument."+s[0].Name+")")
FreeCADGui.doCommand("Draft.makeVisGroup(FreeCAD.ActiveDocument."+s[0].Name+")")
FreeCAD.ActiveDocument.commitTransaction()
FreeCAD.ActiveDocument.recompute()
return
FreeCADGui.doCommand("Draft.makeLayer()")
FreeCADGui.doCommand("Draft.makeVisGroup()")
FreeCAD.ActiveDocument.commitTransaction()
FreeCAD.ActiveDocument.recompute()
@ -4461,7 +4461,7 @@ FreeCADGui.addCommand('Draft_Array',Array())
FreeCADGui.addCommand('Draft_Clone',Draft_Clone())
FreeCADGui.addCommand('Draft_PathArray',PathArray())
FreeCADGui.addCommand('Draft_Heal',Heal())
FreeCADGui.addCommand('Draft_Layer',Layer())
FreeCADGui.addCommand('Draft_VisGroup',VisGroup())
# context commands
FreeCADGui.addCommand('Draft_FinishLine',FinishLine())

File diff suppressed because one or more lines are too long

View File

@ -118,7 +118,7 @@ class DraftWorkbench (Workbench):
"Draft_SelectGroup","Draft_SelectPlane",
"Draft_ShowSnapBar","Draft_ToggleGrid"]
self.lineList = ["Draft_UndoLine","Draft_FinishLine","Draft_CloseLine"]
self.utils = ["Draft_Layer","Draft_Heal","Draft_FlipDimension",
self.utils = ["Draft_VisGroup","Draft_Heal","Draft_FlipDimension",
"Draft_ToggleConstructionMode","Draft_ToggleContinueMode"]
self.snapList = ['Draft_Snap_Lock','Draft_Snap_Midpoint','Draft_Snap_Perpendicular',
'Draft_Snap_Grid','Draft_Snap_Intersection','Draft_Snap_Parallel',

View File

@ -45,7 +45,7 @@
<file>icons/Draft_Point.svg</file>
<file>icons/Draft_Snap.svg</file>
<file>icons/Draft_PathArray.svg</file>
<file>icons/Draft_Layer.svg</file>
<file>icons/Draft_VisGroup.svg</file>
<file>icons/Snap_Lock.svg</file>
<file>icons/Snap_Endpoint.svg</file>
<file>icons/Snap_Midpoint.svg</file>

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -291,13 +291,13 @@
<item>
<widget class="Gui::PrefCheckBox" name="checkBox">
<property name="toolTip">
<string>If this is checked, DXF layers will be imported as Draft layers</string>
<string>If this is checked, DXF layers will be imported as Draft VisGroups</string>
</property>
<property name="text">
<string>Use Draft Layers</string>
<string>Use VisGroups</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>dxfUseDraftLayers</cstring>
<cstring>dxfUseDraftVisGroups</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Draft</cstring>

View File

@ -140,8 +140,8 @@ def locateLayer(wantedLayer,color=None):
for l in layers:
if wantedLayerName==l.Label:
return l
if dxfUseDraftLayers:
newLayer = Draft.makeLayer(name=wantedLayer)
if dxfUseDraftVisGroups:
newLayer = Draft.makeVisGroup(name=wantedLayer)
else:
newLayer = doc.addObject("App::DocumentObjectGroup",wantedLayer)
newLayer.Label = wantedLayerName
@ -1833,6 +1833,6 @@ dxfImportPoints = p.GetBool("dxfImportPoints",False)
dxfImportHatches = p.GetBool("importDxfHatches",False)
dxfUseStandardSize = p.GetBool("dxfStdSize",False)
dxfGetColors = p.GetBool("dxfGetOriginalColors",False)
dxfUseDraftLayers = p.GetBool("dxfUseDraftLayers",False)
dxfUseDraftVisGroups = p.GetBool("dxfUseDraftVisGroups",False)
dxfBrightBackground = isBrightBackground()
dxfDefaultColor = getColor()