From 687b2778d3609a3efe5f1cd2622f318454c06428 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Sun, 26 May 2019 20:00:00 +1000 Subject: [PATCH] Add draft grid color setting --- src/Mod/Draft/DraftTrackers.py | 9 +++- .../Resources/ui/preferences-draftsnap.ui | 54 +++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/src/Mod/Draft/DraftTrackers.py b/src/Mod/Draft/DraftTrackers.py index c38bb770eb7a..ba69cca35795 100644 --- a/src/Mod/Draft/DraftTrackers.py +++ b/src/Mod/Draft/DraftTrackers.py @@ -808,7 +808,7 @@ def update(self,wire,forceclosed=False): class gridTracker(Tracker): "A grid tracker" def __init__(self): - col = [0.2,0.2,0.3] + col = self.getGridColor() pick = coin.SoPickStyle() pick.style.setValue(coin.SoPickStyle.UNPICKABLE) self.trans = coin.SoTransform() @@ -844,6 +844,13 @@ def __init__(self): Tracker.__init__(self,children=[s],name="gridTracker") self.reset() + def getGridColor(self): + color = Draft.getParam("gridColor", 842157055) + r = ((color>>24)&0xFF)/255 + g = ((color>>16)&0xFF)/255 + b = ((color>>8)&0xFF)/255 + return [r, g, b] + def update(self): "redraws the grid" # resize the grid to make sure it fits an exact pair number of main lines diff --git a/src/Mod/Draft/Resources/ui/preferences-draftsnap.ui b/src/Mod/Draft/Resources/ui/preferences-draftsnap.ui index fa099ca5c1fa..e4ea23bc79fc 100644 --- a/src/Mod/Draft/Resources/ui/preferences-draftsnap.ui +++ b/src/Mod/Draft/Resources/ui/preferences-draftsnap.ui @@ -468,6 +468,50 @@ + + + + + + Grid color + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + The default color for new objects + + + + 50 + 50 + 75 + + + + gridColor + + + Mod/Draft + + + + + @@ -489,11 +533,21 @@ qPixmapFromMimeSource + + Gui::ColorButton + QPushButton +
Gui/Widgets.h
+
Gui::PrefSpinBox QSpinBox
Gui/PrefWidgets.h
+ + Gui::PrefColorButton + Gui::ColorButton +
Gui/PrefWidgets.h
+
Gui::PrefCheckBox QCheckBox