From 2ede46764eedac15de102dc708d829afd872473d Mon Sep 17 00:00:00 2001 From: vocx-fc Date: Thu, 5 Mar 2020 19:50:44 -0600 Subject: [PATCH] Draft: move SelectPlane task panel to a separate module --- src/Mod/Draft/CMakeLists.txt | 1 + .../Draft/draftguitools/gui_selectplane.py | 14 +----- .../Draft/drafttaskpanels/task_selectplane.py | 50 +++++++++++++++++++ 3 files changed, 53 insertions(+), 12 deletions(-) create mode 100644 src/Mod/Draft/drafttaskpanels/task_selectplane.py diff --git a/src/Mod/Draft/CMakeLists.txt b/src/Mod/Draft/CMakeLists.txt index 12857548f5..33bf9751ab 100644 --- a/src/Mod/Draft/CMakeLists.txt +++ b/src/Mod/Draft/CMakeLists.txt @@ -95,6 +95,7 @@ SET(Draft_task_panels drafttaskpanels/task_orthoarray.py drafttaskpanels/task_polararray.py drafttaskpanels/task_scale.py + drafttaskpanels/task_selectplane.py drafttaskpanels/task_shapestring.py drafttaskpanels/README.md ) diff --git a/src/Mod/Draft/draftguitools/gui_selectplane.py b/src/Mod/Draft/draftguitools/gui_selectplane.py index ed9b9636cd..ccd7f122b2 100644 --- a/src/Mod/Draft/draftguitools/gui_selectplane.py +++ b/src/Mod/Draft/draftguitools/gui_selectplane.py @@ -33,6 +33,7 @@ import FreeCADGui import Draft import Draft_rc import DraftVecUtils +import drafttaskpanels.task_selectplane as task_selectplane from draftutils.todo import todo from draftutils.messages import _msg from draftutils.translate import translate @@ -91,7 +92,7 @@ class Draft_SelectPlane: # Create task panel FreeCADGui.Control.closeDialog() - self.taskd = SelectPlane_TaskPanel() + self.taskd = task_selectplane.SelectPlaneTaskPanel() # Fill values self.taskd.form.checkCenter.setChecked(self.param.GetBool("CenterPlaneOnView", False)) @@ -493,17 +494,6 @@ class Draft_SelectPlane: FreeCADGui.doCommandGui("FreeCADGui.Snapper.setGrid()") -class SelectPlane_TaskPanel: - """The task panel definition of the Draft_SelectPlane command.""" - - def __init__(self): - self.form = FreeCADGui.PySideUic.loadUi(":/ui/TaskSelectPlane.ui") - - def getStandardButtons(self): - """Execute to set the standard buttons.""" - return 2097152 # int(QtGui.QDialogButtonBox.Close) - - class Draft_SetWorkingPlaneProxy: """The Draft_SetWorkingPlaneProxy FreeCAD command definition.""" diff --git a/src/Mod/Draft/drafttaskpanels/task_selectplane.py b/src/Mod/Draft/drafttaskpanels/task_selectplane.py new file mode 100644 index 0000000000..8889cd6e85 --- /dev/null +++ b/src/Mod/Draft/drafttaskpanels/task_selectplane.py @@ -0,0 +1,50 @@ +# *************************************************************************** +# * Copyright (c) 2019 Yorik van Havre * +# * * +# * This file is part of the FreeCAD CAx development system. * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU Lesser General Public License (LGPL) * +# * as published by the Free Software Foundation; either version 2 of * +# * the License, or (at your option) any later version. * +# * for detail see the LICENCE text file. * +# * * +# * FreeCAD is distributed in the hope that it will be useful, * +# * but WITHOUT ANY WARRANTY; without even the implied warranty of * +# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +# * GNU Library General Public License for more details. * +# * * +# * You should have received a copy of the GNU Library General Public * +# * License along with FreeCAD; if not, write to the Free Software * +# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +# * USA * +# * * +# *************************************************************************** +"""Provides the task panel for the Draft SelectPlane tool.""" +## @package task_selectplane +# \ingroup DRAFT +# \brief This module provides the task panel code for the SelectPlane tool. + +import FreeCADGui as Gui + +# As it is right now this code only loads the task panel .ui file. +# All logic on how to use the widgets is located in the GuiCommand class +# itself. +# On the other hand, the newer tools introduced in v0.19 like OrthoArray, +# PolarArray, and CircularArray include the logic and manipulation +# of the widgets in this task panel class. +# In addition, the task panel code launches the actual function +# using the delayed mechanism defined by the `todo.ToDo` class. +# Therefore, at some point this class should be refactored +# to be more similar to OrthoArray and the new tools. + + +class SelectPlaneTaskPanel: + """The task panel definition of the Draft_SelectPlane command.""" + + def __init__(self): + self.form = Gui.PySideUic.loadUi(":/ui/TaskSelectPlane.ui") + + def getStandardButtons(self): + """Execute to set the standard buttons.""" + return 2097152 # int(QtGui.QDialogButtonBox.Close)