Draft: move SelectPlane task panel to a separate module

This commit is contained in:
vocx-fc
2020-03-05 19:50:44 -06:00
committed by Yorik van Havre
parent ff9c3be72b
commit 2ede46764e
3 changed files with 53 additions and 12 deletions

View File

@@ -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
)

View File

@@ -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."""

View File

@@ -0,0 +1,50 @@
# ***************************************************************************
# * Copyright (c) 2019 Yorik van Havre <yorik@uncreated.net> *
# * *
# * 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)