Draft: Added a grid toggle button to the snap toolbar

This commit is contained in:
Yorik van Havre
2015-12-29 12:10:22 -02:00
parent ed037c138e
commit d989acaae8
4 changed files with 144 additions and 1 deletions

View File

@@ -1074,6 +1074,16 @@ class Snapper:
self.toolbar.setObjectName("Draft Snap")
self.toolbar.setWindowTitle(QtCore.QCoreApplication.translate("Workbench", "Draft Snap"))
self.toolbarButtons = []
# grid button
gridbutton = QtGui.QPushButton(None)
gridbutton.setIcon(QtGui.QIcon(":/icons/Draft_Grid.svg"))
gridbutton.setIconSize(QtCore.QSize(isize, isize))
gridbutton.setMaximumSize(QtCore.QSize(bsize,bsize))
gridbutton.setToolTip(QtCore.QCoreApplication.translate("Draft_ToggleGrid","Toggles the Draft grid on/off"))
gridbutton.setObjectName("GridButton")
QtCore.QObject.connect(gridbutton,QtCore.SIGNAL("clicked()"),self.toggleGrid)
self.toolbar.addWidget(gridbutton)
# master button
self.masterbutton = QtGui.QPushButton(None)
self.masterbutton.setIcon(QtGui.QIcon(":/icons/Snap_Lock.svg"))
self.masterbutton.setIconSize(QtCore.QSize(isize, isize))
@@ -1123,6 +1133,9 @@ class Snapper:
c += 1
if not Draft.getParam("showSnapBar",True):
self.toolbar.hide()
def toggleGrid(self):
FreeCADGui.runCommand("Draft_ToggleGrid")
def saveSnapModes(self):
"saves the snap modes for next sessions"

View File

@@ -4319,7 +4319,7 @@ class ToggleGrid():
"The Draft ToggleGrid command definition"
def GetResources(self):
return {'Pixmap' : 'Snap_Grid',
return {'Pixmap' : 'Draft_Grid',
'Accel' : "G,R",
'MenuText': QtCore.QT_TRANSLATE_NOOP("Draft_ToggleGrid", "Toggle Grid"),
'ToolTip' : QtCore.QT_TRANSLATE_NOOP("Draft_ToggleGrid", "Toggles the Draft grid on/off")}

View File

@@ -67,6 +67,7 @@
<file>icons/Draft_Facebinder.svg</file>
<file>icons/Draft_FlipDimension.svg</file>
<file>icons/Draft_Mirror.svg</file>
<file>icons/Draft_Grid.svg</file>
<file>patterns/concrete.svg</file>
<file>patterns/cross.svg</file>
<file>patterns/line.svg</file>

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.4 KiB