diff --git a/src/Mod/Draft/DraftGui.py b/src/Mod/Draft/DraftGui.py index 381339a78c..74a944f8c6 100644 --- a/src/Mod/Draft/DraftGui.py +++ b/src/Mod/Draft/DraftGui.py @@ -20,7 +20,7 @@ #* * #*************************************************************************** -__title__="FreeCAD Draft Workbench - GUI part" +__title__ = "FreeCAD Draft Workbench - GUI part" __author__ = "Yorik van Havre " __url__ = "https://www.freecadweb.org" @@ -152,7 +152,7 @@ class DraftTaskPanel: class DraftToolBar: """The Draft Task panel UI - Draft Toolbar is the main ui of the Draft Module. Once displayed as a + Draft Toolbar is the main ui of the Draft Module. Once displayed as a toolbar, now it define the ui of the Task Panel. Toolbar become obsolete due to lack of manteinence and was disabled by default in February 2020. @@ -167,14 +167,14 @@ class DraftToolBar: self.taskmode = 1 # Draft.getParam("UiMode",1) # taskmode = 0 was used by draft toolbar that is now obsolete. # print("taskmode: ",str(self.taskmode)) - + # OBSOLETE BUT STILL USED BY SOME ADDONS AND MACROS self.paramcolor = Draft.getParam("color",255)>>8 self.color = QtGui.QColor(self.paramcolor) self.facecolor = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View").GetUnsigned("DefaultShapeColor",4294967295)>>8 self.linewidth = Draft.getParam("linewidth",2) self.fontsize = Draft.getParam("textheight",0.20) - + self.paramconstr = Draft.getParam("constructioncolor",746455039)>>8 self.constrMode = False self.continueMode = False @@ -636,7 +636,7 @@ class DraftToolBar: self.continueCmd.setText(translate("draft", "Continue")+" ("+inCommandShortcuts["Continue"][0]+")") self.occOffset.setToolTip(translate("draft", "If checked, an OCC-style offset will be performed instead of the classic offset")) self.occOffset.setText(translate("draft", "&OCC-style offset")) - + # OBSOLETE # self.addButton.setToolTip(translate("draft", "Add points to the current object")) # self.delButton.setToolTip(translate("draft", "Remove points from the current object")) @@ -644,7 +644,7 @@ class DraftToolBar: # self.tangentButton.setToolTip(translate("draft", "Make Bezier node tangent")) # self.symmetricButton.setToolTip(translate("draft", "Make Bezier node symmetric")) # self.arc3PtButton.setToolTip(translate("draft", "Toggle radius and angles arc editing")) - + self.undoButton.setText(translate("draft", "&Undo (CTRL+Z)")) self.undoButton.setToolTip(translate("draft", "Undo the last segment")) self.closeButton.setText(translate("draft", "Close")+" ("+inCommandShortcuts["Close"][0]+")") @@ -697,14 +697,14 @@ class DraftToolBar: self.styleButton.setToolTip(translate("draft", "Change default style for new objects")) self.constrButton.setToolTip(translate("draft", "Toggle construction mode")) self.autoGroupButton.setToolTip(translate("draft", "Autogroup off")) - + # OBSOLETE - replaced by style button #self.colorButton.setToolTip(translate("draft", "Current line color")) #self.facecolorButton.setToolTip(translate("draft", "Current face color")) #self.widthButton.setToolTip(translate("draft", "Current line width")) #self.fontsizeButton.setToolTip(translate("draft", "Current font size")) #self.applyButton.setToolTip(translate("draft", "Apply to selected objects")) - + #--------------------------------------------------------------------------- # Interface modes @@ -934,7 +934,7 @@ class DraftToolBar: self.isRelative.hide() self.hasFill.hide() self.finishButton.hide() - + # OBSOLETE # self.addButton.hide() # self.delButton.hide() @@ -942,7 +942,7 @@ class DraftToolBar: # self.tangentButton.hide() # self.symmetricButton.hide() # self.arc3PtButton.hide() - + self.undoButton.hide() self.closeButton.hide() self.wipeButton.hide() @@ -1767,7 +1767,7 @@ class DraftToolBar: def setstyle(self): FreeCADGui.runCommand("Draft_SetStyle") - + def setStyleButton(self): "sets icon and text on the style button" linecolor = QtGui.QColor(Draft.getParam("color",255)>>8) @@ -2054,7 +2054,7 @@ class DraftToolBar: self.setWatchers() if hasattr(self,"tray"): self.tray.show() - else: # self.taskmode == 0 Draft toolbar is obsolete and has been disabled (February 2020) + else: # self.taskmode == 0 Draft toolbar is obsolete and has been disabled (February 2020) self.draftWidget.setVisible(True) self.draftWidget.toggleViewAction().setVisible(True) diff --git a/src/Mod/Draft/draft.dox b/src/Mod/Draft/draft.dox index 50b9e3543e..ed00139872 100644 --- a/src/Mod/Draft/draft.dox +++ b/src/Mod/Draft/draft.dox @@ -1,6 +1,6 @@ /** \defgroup DRAFT Draft -\ingroup PYTHONWORKBENCHES -\brief Basic 2D drawing tools and other generic tools + * \ingroup PYTHONWORKBENCHES + * \brief Basic 2D drawing tools and other generic tools The Draft workbench provides many tools for building geometrical objects in a two-dimensional space, normally supported by a working plane diff --git a/src/Mod/Draft/draftfunctions/rotate.py b/src/Mod/Draft/draftfunctions/rotate.py index 64b88d2cba..785e7b7503 100644 --- a/src/Mod/Draft/draftfunctions/rotate.py +++ b/src/Mod/Draft/draftfunctions/rotate.py @@ -42,11 +42,11 @@ import draftmake.make_copy as make_copy def rotate(objectslist, angle, center=App.Vector(0,0,0), axis=App.Vector(0,0,1), copy=False): """rotate(objects,angle,[center,axis,copy]) - + Rotates the objects contained in objects (that can be a list of objects - or an object) of the given angle (in degrees) around the center, using - axis as a rotation axis. - + or an object) of the given angle (in degrees) around the center, using + axis as a rotation axis. + Parameters ---------- objectlist : list @@ -57,10 +57,10 @@ def rotate(objectslist, angle, center=App.Vector(0,0,0), axis : Base.Vector If axis is omitted, the rotation will be around the vertical Z axis. - + copy : bool If copy is True, the actual objects are not moved, but copies - are created instead. + are created instead. Return ---------- @@ -114,7 +114,7 @@ def rotate(objectslist, angle, center=App.Vector(0,0,0), elif utils.get_type(obj) == "Point": v = App.Vector(obj.X,obj.Y,obj.Z) rv = v.sub(real_center) - rv = DraftVecUtils.rotate(rv, math.radians(angle),real_axis) + rv = DraftVecUtils.rotate(rv, math.radians(angle), real_axis) v = real_center.add(rv) newobj.X = v.x newobj.Y = v.y diff --git a/src/Mod/Draft/draftguitools/gui_patharray.py b/src/Mod/Draft/draftguitools/gui_patharray.py index 9ab06d5405..c025668901 100644 --- a/src/Mod/Draft/draftguitools/gui_patharray.py +++ b/src/Mod/Draft/draftguitools/gui_patharray.py @@ -1,7 +1,7 @@ # *************************************************************************** # * Copyright (c) 2009, 2010 Yorik van Havre * # * Copyright (c) 2009, 2010 Ken Cline * -# * Copyright (c) 2013 Wandererfan * +# * Copyright (c) 2013 WandererFan * # * Copyright (c) 2019 Zheng, Lei (realthunder)* # * Copyright (c) 2020 Carlo Pavan * # * Copyright (c) 2020 Eliud Cabrera Castillo * diff --git a/src/Mod/Draft/draftmake/make_patharray.py b/src/Mod/Draft/draftmake/make_patharray.py index e611a435cc..bd23218a8f 100644 --- a/src/Mod/Draft/draftmake/make_patharray.py +++ b/src/Mod/Draft/draftmake/make_patharray.py @@ -1,7 +1,7 @@ # *************************************************************************** # * Copyright (c) 2009, 2010 Yorik van Havre * # * Copyright (c) 2009, 2010 Ken Cline * -# * Copyright (c) 2013 Wandererfan * +# * Copyright (c) 2013 WandererFan * # * Copyright (c) 2019 Zheng, Lei (realthunder)* # * Copyright (c) 2020 Carlo Pavan * # * Copyright (c) 2020 Eliud Cabrera Castillo * diff --git a/src/Mod/Draft/draftobjects/patharray.py b/src/Mod/Draft/draftobjects/patharray.py index 58e72e0245..59b1e0a438 100644 --- a/src/Mod/Draft/draftobjects/patharray.py +++ b/src/Mod/Draft/draftobjects/patharray.py @@ -1,7 +1,7 @@ # *************************************************************************** # * Copyright (c) 2009, 2010 Yorik van Havre * # * Copyright (c) 2009, 2010 Ken Cline * -# * Copyright (c) 2013 Wandererfan * +# * Copyright (c) 2013 WandererFan * # * Copyright (c) 2019 Zheng, Lei (realthunder)* # * Copyright (c) 2020 Carlo Pavan * # * Copyright (c) 2020 Eliud Cabrera Castillo * diff --git a/src/Mod/Draft/draftutils/init_draft_statusbar.py b/src/Mod/Draft/draftutils/init_draft_statusbar.py index 6ef020598a..02dead1a71 100644 --- a/src/Mod/Draft/draftutils/init_draft_statusbar.py +++ b/src/Mod/Draft/draftutils/init_draft_statusbar.py @@ -1,5 +1,4 @@ # *************************************************************************** -# * * # * Copyright (c) 2020 Carlo Pavan * # * * # * This file is part of the FreeCAD CAx development system. * @@ -45,31 +44,31 @@ from draftutils.init_tools import get_draft_snap_commands # SCALE WIDGET FUNCTIONS #---------------------------------------------------------------------------- -draft_scales_metrics = ["1:1000", "1:500", "1:250", "1:200", "1:100", +draft_scales_metrics = ["1:1000", "1:500", "1:250", "1:200", "1:100", "1:50", "1:25","1:20", "1:10", "1:5","1:2", "1:1", - "2:1", "5:1", "10:1", "20:1", - QT_TRANSLATE_NOOP("draft","custom"), + "2:1", "5:1", "10:1", "20:1", + QT_TRANSLATE_NOOP("draft","custom"), ] draft_scales_arch_imperial = ["1/16in=1ft", "3/32in=1ft", "1/8in=1ft", - "3/16in=1ft", "1/4in=1ft","3/8in=1ft", - "1/2in=1ft", "3/4in=1ft", "1in=1ft", - "1.5in=1ft", "3in=1ft", + "3/16in=1ft", "1/4in=1ft","3/8in=1ft", + "1/2in=1ft", "3/4in=1ft", "1in=1ft", + "1.5in=1ft", "3in=1ft", QT_TRANSLATE_NOOP("draft","custom"), ] draft_scales_eng_imperial = ["1in=10ft", "1in=20ft", "1in=30ft", - "1in=40ft", "1in=50ft", "1in=60ft", - "1in=70ft", "1in=80ft", "1in=90ft", - "1in=100ft", + "1in=40ft", "1in=50ft", "1in=60ft", + "1in=70ft", "1in=80ft", "1in=90ft", + "1in=100ft", QT_TRANSLATE_NOOP("draft","custom"), ] def get_scales(unit_system = 0): """ returns the list of preset scales accordin to unit system. - + Parameters: unit_system = 0 : default from user preferences 1 : metrics @@ -106,7 +105,7 @@ def scale_to_label(scale): return label else: return str(scale) - + def label_to_scale(label): """ transform a scale string into scale factor as float @@ -140,7 +139,7 @@ def _set_scale(action): """ # set the label of the scale button param = App.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft") - + mw = Gui.getMainWindow() sb = mw.statusBar() scale_widget = sb.findChild(QtGui.QToolBar,"draft_status_scale_widget") @@ -179,12 +178,12 @@ def init_draft_statusbar_scale(): sb = mw.statusBar() if sb is None: return - else: + else: return scale_widget = QtGui.QToolBar() scale_widget.setObjectName("draft_status_scale_widget") - + # get scales list according to system units draft_scales = get_scales() @@ -210,7 +209,7 @@ def init_draft_statusbar_scale(): scaleLabel.setToolTip(QT_TRANSLATE_NOOP("draft",tooltip)) scale_widget.addWidget(scaleLabel) scale_widget.scaleLabel = scaleLabel - + # add scale widget to the statusbar sb.insertPermanentWidget(3, scale_widget) scale_widget.show() @@ -227,15 +226,15 @@ def init_draft_statusbar_snap(): sb = mw.statusBar() if sb is None: return - else: + else: return - + # SNAP WIDGET - init ---------------------------------------------------- - + snap_widget = QtGui.QToolBar() snap_widget.setObjectName("draft_snap_widget") snap_widget.setIconSize(QtCore.QSize(16,16)) - + # GRID BUTTON - init gridbutton = QtGui.QPushButton(snap_widget) gridbutton.setIcon(QtGui.QIcon.fromTheme("Draft", @@ -247,7 +246,7 @@ def init_draft_statusbar_snap(): gridbutton.setWhatsThis("Draft_ToggleGrid") gridbutton.setFlat(True) QtCore.QObject.connect(gridbutton,QtCore.SIGNAL("clicked()"), - lambda f=Gui.doCommand, + lambda f=Gui.doCommand, arg='Gui.runCommand("Draft_ToggleGrid")':f(arg)) snap_widget.addWidget(gridbutton) @@ -267,7 +266,7 @@ def init_draft_statusbar_snap(): snaps_menu = QtGui.QMenu(snapbutton) snaps_menu.setObjectName("draft_statusbar_snap_toolbar") - + snap_gui_commands = get_draft_snap_commands() if 'Draft_Snap_Ortho' in snap_gui_commands: snap_gui_commands.remove('Draft_Snap_Ortho') @@ -299,7 +298,7 @@ def init_draft_statusbar_snap(): dimbutton.setCheckable(True) dimbutton.setChecked(bool(int(dimpref))) QtCore.QObject.connect(dimbutton,QtCore.SIGNAL("clicked()"), - lambda f=Gui.doCommand, + lambda f=Gui.doCommand, arg='Gui.runCommand("Draft_Snap_Dimensions")':f(arg)) snap_widget.addWidget(dimbutton) @@ -317,7 +316,7 @@ def init_draft_statusbar_snap(): orthobutton.setCheckable(True) orthobutton.setChecked(bool(int(ortopref))) QtCore.QObject.connect(orthobutton,QtCore.SIGNAL("clicked()"), - lambda f=Gui.doCommand, + lambda f=Gui.doCommand, arg='Gui.runCommand("Draft_Snap_Ortho")':f(arg)) snap_widget.addWidget(orthobutton) @@ -335,7 +334,7 @@ def init_draft_statusbar_snap(): wpbutton.setCheckable(True) wpbutton.setChecked(bool(int(wppref))) QtCore.QObject.connect(wpbutton,QtCore.SIGNAL("clicked()"), - lambda f=Gui.doCommand, + lambda f=Gui.doCommand, arg='Gui.runCommand("Draft_Snap_WorkingPlane")':f(arg)) snap_widget.addWidget(wpbutton) @@ -343,7 +342,7 @@ def init_draft_statusbar_snap(): sb.insertPermanentWidget(2, snap_widget) snap_widget.show() - + def show_draft_statusbar(): """ shows draft statusbar if present or initializes it @@ -371,7 +370,7 @@ def show_draft_statusbar(): elif params.GetBool("DisplayStatusbarScaleWidget", True): t = QtCore.QTimer() t.singleShot(500, init_draft_statusbar_scale) - + snap_widget = sb.findChild(QtGui.QToolBar,"draft_snap_widget") if snap_widget: snap_widget.show() @@ -393,7 +392,7 @@ def hide_draft_statusbar(): if not mw: return sb = mw.statusBar() - + # hide scale widget scale_widget = sb.findChild(QtGui.QToolBar, "draft_status_scale_widget") @@ -406,7 +405,7 @@ def hide_draft_statusbar(): "draft_status_scale_widget") if scale_widget: scale_widget.hide() - + # hide snap widget snap_widget = sb.findChild(QtGui.QToolBar,"draft_snap_widget") if snap_widget: diff --git a/src/Mod/Draft/draftutils/init_tools.py b/src/Mod/Draft/draftutils/init_tools.py index 6a9afe8d7f..6e24722e0e 100644 --- a/src/Mod/Draft/draftutils/init_tools.py +++ b/src/Mod/Draft/draftutils/init_tools.py @@ -97,7 +97,7 @@ def get_draft_context_commands(): return ["Draft_ApplyStyle", "Draft_ToggleDisplayMode", "Draft_AddToGroup", "Draft_SelectGroup", "Draft_SelectPlane", "Draft_ShowSnapBar", - "Draft_ToggleGrid", "Draft_AutoGroup", + "Draft_ToggleGrid", "Draft_AutoGroup", "Draft_SetStyle"]