Draft: grid size is now settable in preferences

This commit is contained in:
Yorik van Havre 2014-08-28 16:00:08 -03:00
parent 16ede0e55c
commit 6ff67ee5c3
5 changed files with 100 additions and 35 deletions

View File

@ -103,7 +103,7 @@ def getParamType(param):
if param in ["dimsymbol","dimPrecision","dimorientation","precision","defaultWP",
"snapRange","gridEvery","linewidth","UiMode","modconstrain","modsnap",
"maxSnapEdges","modalt","HatchPatternResolution","snapStyle",
"dimstyle"]:
"dimstyle","gridSize"]:
return "int"
elif param in ["constructiongroupname","textfont","patternFile","template",
"snapModes","FontFile"]:

View File

@ -720,7 +720,7 @@ class gridTracker(Tracker):
self.space = Draft.getParam("gridSpacing",1)
# self.mainlines = 10
self.mainlines = Draft.getParam("gridEvery",10)
self.numlines = 100
self.numlines = Draft.getParam("gridSize",100)
col = [0.2,0.2,0.3]
pick = coin.SoPickStyle()
@ -806,6 +806,10 @@ class gridTracker(Tracker):
pts.extend([[curr,-bound,0],[curr,bound,0]])
self.coords1.point.setValues(pts)
self.coords2.point.setValues(mpts)
def setSize(self,size):
self.numlines = size
self.update()
def setSpacing(self,space):
self.space = space

File diff suppressed because one or more lines are too long

View File

@ -383,7 +383,7 @@
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Max Spline Segment (mm): </string>
<string>Max Spline Segment: </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -398,6 +398,9 @@
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="suffix">
<string>mm</string>
</property>
<property name="maximum">
<double>9999.989999999999782</double>
</property>

View File

@ -263,6 +263,55 @@
<string>Grid</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_17">
<item>
<widget class="Gui::PrefCheckBox" name="gui::prefcheckbox_2">
<property name="toolTip">
<string>If checked, a grid will appear when drawing</string>
</property>
<property name="text">
<string>Use grid</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>grid</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Draft</cstring>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_15">
<item>
<widget class="Gui::PrefCheckBox" name="gui::prefcheckbox_10">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>If checked, the Draft grid will always be visible when the Draft workbench is active. Otherwise only when using a command</string>
</property>
<property name="text">
<string>Always show the grid</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>alwaysShowGrid</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Draft</cstring>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_13">
<item>
@ -296,6 +345,9 @@
<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="value">
<number>10</number>
</property>
@ -342,6 +394,12 @@
<property name="toolTip">
<string>The spacing between each grid line</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="suffix">
<string>mm</string>
</property>
<property name="decimals">
<number>4</number>
</property>
@ -362,46 +420,46 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_15">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="Gui::PrefCheckBox" name="gui::prefcheckbox_10">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>If checked, the Draft grid will always be visible when the Draft workbench is active. Otherwise only when using a command</string>
</property>
<widget class="QLabel" name="label">
<property name="text">
<string>Always show the grid</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>alwaysShowGrid</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Draft</cstring>
<string>Grid size</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_17">
<item>
<widget class="Gui::PrefCheckBox" name="gui::prefcheckbox_2">
<spacer name="horizontalSpacer">
<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="spinBox">
<property name="toolTip">
<string>If checked, a grid will appear when drawing</string>
<string>the number of horizontal or vertical lines of the grid</string>
</property>
<property name="text">
<string>Use grid</string>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="checked">
<bool>true</bool>
<property name="suffix">
<string> lines</string>
</property>
<property name="maximum">
<number>9999</number>
</property>
<property name="value">
<number>100</number>
</property>
<property name="prefEntry" stdset="0">
<cstring>grid</cstring>
<cstring>gridSize</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Draft</cstring>