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:
@@ -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, _wrn, _err, _log
|
||||
from draftutils.translate import _tr
|
||||
from FreeCAD import Units as U
|
||||
@@ -132,8 +133,8 @@ class TaskPanelCircularArray:
|
||||
self.form.input_c_z.setProperty('rawValue', self.center.z)
|
||||
self.form.input_c_z.setProperty('unit', length_unit)
|
||||
|
||||
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)
|
||||
@@ -354,6 +355,7 @@ class TaskPanelCircularArray:
|
||||
"""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."""
|
||||
@@ -367,6 +369,7 @@ class TaskPanelCircularArray:
|
||||
"""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."""
|
||||
|
||||
@@ -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."""
|
||||
|
||||
@@ -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, _wrn, _err, _log
|
||||
from draftutils.translate import _tr
|
||||
from FreeCAD import Units as U
|
||||
@@ -120,8 +121,8 @@ class TaskPanelPolarArray:
|
||||
self.form.input_c_z.setProperty('rawValue', self.center.z)
|
||||
self.form.input_c_z.setProperty('unit', length_unit)
|
||||
|
||||
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)
|
||||
@@ -302,6 +303,7 @@ class TaskPanelPolarArray:
|
||||
"""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."""
|
||||
@@ -315,6 +317,7 @@ class TaskPanelPolarArray:
|
||||
"""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."""
|
||||
|
||||
@@ -157,7 +157,8 @@ def get_param_type(param):
|
||||
"SvgLinesBlack", "dxfStdSize", "showSnapBar",
|
||||
"hideSnapBar", "alwaysShowGrid", "renderPolylineWidth",
|
||||
"showPlaneTracker", "UsePartPrimitives",
|
||||
"DiscretizeEllipses", "showUnit"):
|
||||
"DiscretizeEllipses", "showUnit",
|
||||
"Draft_array_fuse", "Draft_array_Link"):
|
||||
return "bool"
|
||||
elif param in ("color", "constructioncolor",
|
||||
"snapcolor", "gridColor"):
|
||||
|
||||
Reference in New Issue
Block a user