Skip to content

Commit

Permalink
Draft: grid size is now settable in preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Aug 28, 2014
1 parent 16ede0e commit 6ff67ee
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/Mod/Draft/Draft.py
Expand Up @@ -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"]:
Expand Down
6 changes: 5 additions & 1 deletion src/Mod/Draft/DraftTrackers.py
Expand Up @@ -720,7 +720,7 @@ def __init__(self):
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()
Expand Down Expand Up @@ -806,6 +806,10 @@ def update(self):
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
Expand Down
6 changes: 3 additions & 3 deletions src/Mod/Draft/Draft_rc.py

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/Mod/Draft/Resources/ui/userprefs-import1.ui
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
114 changes: 86 additions & 28 deletions src/Mod/Draft/Resources/ui/userprefs-snap.ui
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand All @@ -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>
<string>Grid size</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>alwaysShowGrid</cstring>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Draft</cstring>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_17">
<item>
<widget class="Gui::PrefCheckBox" name="gui::prefcheckbox_2">
<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>
Expand Down

0 comments on commit 6ff67ee

Please sign in to comment.