Draft: parameters to control array options in the task panel

Use the value of the parameters `Draft_array_fuse`
and `Draft_array_Link` to set the default value
of the `Fuse` and `Link array` checkboxes in the task panels.
These default to `False` and `True`, respectively.

Whenever the user toggles a checkbox
the new value of the parameter is stored so that when
the command is used again the last state of the checkbox
is remembered.
This commit is contained in:
vocx-fc
2020-03-28 21:16:55 -06:00
committed by Yorik van Havre
parent e1c31bf927
commit 4d0c0d2d73
4 changed files with 17 additions and 7 deletions

View File

@@ -32,6 +32,7 @@ import FreeCAD as App
import FreeCADGui as Gui
import Draft_rc # include resources, icons, ui files
import DraftVecUtils
import draftutils.utils as utils
from draftutils.messages import _msg, _err, _log
from draftutils.translate import _tr
from FreeCAD import Units as U
@@ -133,8 +134,8 @@ class TaskPanelOrthoArray:
self.form.spinbox_n_Y.setValue(self.n_y)
self.form.spinbox_n_Z.setValue(self.n_z)
self.fuse = False
self.use_link = True
self.fuse = utils.get_param("Draft_array_fuse", False)
self.use_link = utils.get_param("Draft_array_Link", True)
self.form.checkbox_fuse.setChecked(self.fuse)
self.form.checkbox_link.setChecked(self.use_link)
@@ -348,6 +349,7 @@ class TaskPanelOrthoArray:
"""Execute as a callback when the fuse checkbox changes."""
self.fuse = self.form.checkbox_fuse.isChecked()
self.print_fuse_state(self.fuse)
utils.set_param("Draft_array_fuse", self.fuse)
def print_link_state(self, use_link):
"""Print the link state translated."""
@@ -361,6 +363,7 @@ class TaskPanelOrthoArray:
"""Execute as a callback when the link checkbox changes."""
self.use_link = self.form.checkbox_link.isChecked()
self.print_link_state(self.use_link)
utils.set_param("Draft_array_Link", self.use_link)
def print_messages(self):
"""Print messages about the operation."""