Skip to content

Commit

Permalink
[Draft] Edit: allow multiple objects editing
Browse files Browse the repository at this point in the history
Allow editing of multiple objects at once.
  • Loading branch information
carlopav authored and yorikvanhavre committed Nov 11, 2019
1 parent c9522a6 commit 7adca7b
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 26 deletions.
14 changes: 3 additions & 11 deletions src/Mod/Draft/DraftEdit.py
Expand Up @@ -79,8 +79,9 @@ def __init__(self):
self.originalNodes = None

# settings
self.maxObjects = 1
self.pick_radius = self.getPickRadius()
param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")
self.maxObjects = param.GetInt("DraftEditMaxObjects", 5)
self.pick_radius = param.GetInt("DraftEditPickRadius", 20)

# preview
self.ghost = None
Expand All @@ -94,15 +95,6 @@ def __init__(self):
self.supportedPartObjs = ["Sketch", "Sketcher::SketchObject", \
"Part", "Part::Line", "Part::Box"]

def getPickRadius(self):
"""return DraftEditPickRadius from user preferences"""
param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")
if param.GetInt("DraftEditPickRadius", 0) == 0:
param.SetInt("DraftEditPickRadius", 20)
return 20
else:
return param.GetInt("DraftEditPickRadius")

def GetResources(self):
return {'Pixmap' : 'Draft_Edit',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Draft_Edit", "Edit"),
Expand Down
88 changes: 73 additions & 15 deletions src/Mod/Draft/Resources/ui/preferences-draftsnap.ui
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>567</width>
<height>561</height>
<width>612</width>
<height>574</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -532,19 +532,77 @@
<property name="title">
<string>Edit</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_16" stretch="0,0,0">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_8">
<property name="toolTip">
<string>Sets the maximum number of objects Draft Edit can handle at the same time</string>
</property>
<property name="text">
<string>Maximum number of contemporary edited objects</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_14">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="Gui::PrefSpinBox" name="gui::prefspinbox_10">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Mainlines will be drawn thicker. Specify here how many squares between mainlines.</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>25</number>
</property>
<property name="value">
<number>5</number>
</property>
<property name="displayIntegerBase">
<number>10</number>
</property>
<property name="prefEntry" stdset="0">
<cstring>DraftEditMaxObjects</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Draft</cstring>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,0">
<property name="leftMargin">
Expand Down

0 comments on commit 7adca7b

Please sign in to comment.