[Draft] Further cleanup of the branch

thanks to vocx revisions
This commit is contained in:
carlopav
2020-04-19 17:47:59 +02:00
committed by Yorik van Havre
parent e68bf521f6
commit 854687fd6f
3 changed files with 20 additions and 15 deletions

View File

@@ -28,11 +28,12 @@
# \brief Provide the Draft_Snap commands used by the snapping mechanism
# in Draft.
import FreeCADGui as Gui
import draftguitools.gui_base as gui_base
from PySide import QtGui
from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCADGui as Gui
import draftguitools.gui_base as gui_base
from draftutils.translate import _tr
@@ -40,7 +41,7 @@ from draftutils.translate import _tr
def get_snap_statusbar_widget():
"""retuns snap statusbar button"""
"""Return snap statusbar button."""
mw = Gui.getMainWindow()
if mw:
sb = mw.statusBar()
@@ -50,7 +51,7 @@ def get_snap_statusbar_widget():
def sync_snap_toolbar_button(button, status):
"""set snap toolbar button to given state"""
"""Set snap toolbar button to given state."""
snap_toolbar = Gui.Snapper.get_snap_toolbar()
if not snap_toolbar:
return
@@ -71,7 +72,7 @@ def sync_snap_toolbar_button(button, status):
def sync_snap_statusbar_button(button, status):
"""set snap statusbar button to given state"""
"""Set snap statusbar button to given state."""
ssw = get_snap_statusbar_widget()
if not ssw:
return

View File

@@ -29,10 +29,13 @@ This module provide the code for the Draft Statusbar, activated by initGui
# \ingroup DRAFT
# \brief This module provides the code for the Draft Statusbar.
from PySide import QtCore
from PySide import QtGui
from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCAD as App
import FreeCADGui as Gui
from PySide import QtCore, QtGui
from PySide.QtCore import QT_TRANSLATE_NOOP
from draftutils.init_tools import get_draft_snap_commands
#----------------------------------------------------------------------------
@@ -148,7 +151,8 @@ def _set_scale(action):
if custom_scale[1]:
print(custom_scale[0])
scale = label_to_scale(custom_scale[0])
if scale is None: return
if scale is None:
return
param.SetFloat("DraftAnnotationScale", scale)
cs = scale_to_label(scale)
scale_widget.scaleLabel.setText(cs)

View File

@@ -115,13 +115,13 @@ def get_draft_utility_commands():
def get_draft_snap_commands():
"""Return the snapping commands list."""
return ['Draft_Snap_Lock',
'Draft_Snap_Endpoint', 'Draft_Snap_Midpoint',
'Draft_Snap_Center', 'Draft_Snap_Angle',
return ['Draft_Snap_Lock',
'Draft_Snap_Endpoint', 'Draft_Snap_Midpoint',
'Draft_Snap_Center', 'Draft_Snap_Angle',
'Draft_Snap_Intersection', 'Draft_Snap_Perpendicular',
'Draft_Snap_Extension', 'Draft_Snap_Parallel',
'Draft_Snap_Special', 'Draft_Snap_Near',
'Draft_Snap_Ortho', 'Draft_Snap_Grid',
'Draft_Snap_Extension', 'Draft_Snap_Parallel',
'Draft_Snap_Special', 'Draft_Snap_Near',
'Draft_Snap_Ortho', 'Draft_Snap_Grid',
'Draft_Snap_WorkingPlane', 'Draft_Snap_Dimensions',
]