[Draft] Edit: pick radius according to user preferences (issue #4162)

Reference tracker issue #4162 https://freecadweb.org/tracker/view.php?id=4162
Reference topic. https://forum.freecadweb.org/viewtopic.php?f=23&t=40060.
Changed ui file to insert edit preferences (at the moment inside draft and grid, for the affinity with snap). Created a new draft preference: DraftEditPickRadius.
This commit is contained in:
carlopav
2019-10-20 16:39:56 +02:00
committed by Yorik van Havre
parent b58019c365
commit d87e6324e5
2 changed files with 111 additions and 5 deletions

View File

@@ -80,7 +80,7 @@ class Edit():
# settings
self.maxObjects = 1
self.pick_radius = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View").GetFloat("PickRadius")
self.pick_radius = self.getPickRadius()
# preview
self.ghost = None
@@ -94,6 +94,15 @@ class Edit():
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"),

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>492</width>
<height>432</height>
<width>567</width>
<height>561</height>
</rect>
</property>
<property name="windowTitle">
@@ -17,7 +17,16 @@
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<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>
<item>
@@ -338,7 +347,7 @@
</spacer>
</item>
<item>
<widget class="Gui::PrefSpinBox" name="gui::prefspinbox_4">
<widget class="Gui::PrefSpinBox" name="gui::prefspinbox_5">
<property name="enabled">
<bool>true</bool>
</property>
@@ -515,6 +524,94 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="verticalGroupBox">
<property name="toolTip">
<string>Draft edit preferences</string>
</property>
<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>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" 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_3">
<property name="toolTip">
<string>Controls pick radius of edit nodes</string>
</property>
<property name="text">
<string>Draft edit pick radius</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<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_4">
<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="value">
<number>20</number>
</property>
<property name="prefEntry" stdset="0">
<cstring>DraftEditPickRadius</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Draft</cstring>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">