Merge pull request #11715 from Roy-043/Draft-implement-new-get_param-functions-step-3
Draft: implement new get_param functions (step 3)
This commit is contained in:
@@ -34,10 +34,9 @@ import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
import Draft_rc # include resources, icons, ui files
|
||||
import DraftVecUtils
|
||||
import draftutils.utils as utils
|
||||
|
||||
from FreeCAD import Units as U
|
||||
from draftutils.messages import _msg, _wrn, _err, _log
|
||||
from draftutils import params
|
||||
from draftutils.messages import _err, _log, _msg, _wrn
|
||||
from draftutils.translate import translate
|
||||
|
||||
# The module is used to prevent complaints from code checkers (flake8)
|
||||
@@ -136,8 +135,8 @@ class TaskPanelCircularArray:
|
||||
self.form.input_c_z.setProperty('rawValue', self.center.z)
|
||||
self.form.input_c_z.setProperty('unit', length_unit)
|
||||
|
||||
self.fuse = utils.get_param("Draft_array_fuse", False)
|
||||
self.use_link = utils.get_param("Draft_array_Link", True)
|
||||
self.fuse = params.get_param("Draft_array_fuse")
|
||||
self.use_link = params.get_param("Draft_array_Link")
|
||||
|
||||
self.form.checkbox_fuse.setChecked(self.fuse)
|
||||
self.form.checkbox_link.setChecked(self.use_link)
|
||||
@@ -344,7 +343,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)
|
||||
params.set_param("Draft_array_fuse", self.fuse)
|
||||
|
||||
def print_link_state(self, use_link):
|
||||
"""Print the link state translated."""
|
||||
@@ -358,7 +357,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)
|
||||
params.set_param("Draft_array_Link", self.use_link)
|
||||
|
||||
def print_messages(self):
|
||||
"""Print messages about the operation."""
|
||||
|
||||
@@ -34,10 +34,9 @@ import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
import Draft_rc # include resources, icons, ui files
|
||||
import DraftVecUtils
|
||||
import draftutils.utils as utils
|
||||
|
||||
from FreeCAD import Units as U
|
||||
from draftutils.messages import _msg, _err, _log
|
||||
from draftutils import params
|
||||
from draftutils.messages import _err, _log, _msg
|
||||
from draftutils.translate import translate
|
||||
|
||||
# The module is used to prevent complaints from code checkers (flake8)
|
||||
@@ -137,8 +136,8 @@ class TaskPanelOrthoArray:
|
||||
self.form.spinbox_n_Y.setValue(self.n_y)
|
||||
self.form.spinbox_n_Z.setValue(self.n_z)
|
||||
|
||||
self.fuse = utils.get_param("Draft_array_fuse", False)
|
||||
self.use_link = utils.get_param("Draft_array_Link", True)
|
||||
self.fuse = params.get_param("Draft_array_fuse")
|
||||
self.use_link = params.get_param("Draft_array_Link")
|
||||
|
||||
self.form.checkbox_fuse.setChecked(self.fuse)
|
||||
self.form.checkbox_link.setChecked(self.use_link)
|
||||
@@ -347,7 +346,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)
|
||||
params.set_param("Draft_array_fuse", self.fuse)
|
||||
|
||||
def print_link_state(self, use_link):
|
||||
"""Print the link state translated."""
|
||||
@@ -361,7 +360,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)
|
||||
params.set_param("Draft_array_Link", self.use_link)
|
||||
|
||||
def print_messages(self):
|
||||
"""Print messages about the operation."""
|
||||
|
||||
@@ -34,10 +34,9 @@ import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
import Draft_rc # include resources, icons, ui files
|
||||
import DraftVecUtils
|
||||
import draftutils.utils as utils
|
||||
|
||||
from FreeCAD import Units as U
|
||||
from draftutils.messages import _msg, _wrn, _err, _log
|
||||
from draftutils import params
|
||||
from draftutils.messages import _err, _log, _msg, _wrn
|
||||
from draftutils.translate import translate
|
||||
|
||||
# The module is used to prevent complaints from code checkers (flake8)
|
||||
@@ -124,8 +123,8 @@ class TaskPanelPolarArray:
|
||||
self.form.input_c_z.setProperty('rawValue', self.center.z)
|
||||
self.form.input_c_z.setProperty('unit', length_unit)
|
||||
|
||||
self.fuse = utils.get_param("Draft_array_fuse", False)
|
||||
self.use_link = utils.get_param("Draft_array_Link", True)
|
||||
self.fuse = params.get_param("Draft_array_fuse")
|
||||
self.use_link = params.get_param("Draft_array_Link")
|
||||
|
||||
self.form.checkbox_fuse.setChecked(self.fuse)
|
||||
self.form.checkbox_link.setChecked(self.use_link)
|
||||
@@ -299,7 +298,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)
|
||||
params.set_param("Draft_array_fuse", self.fuse)
|
||||
|
||||
def print_link_state(self, use_link):
|
||||
"""Print the link state translated."""
|
||||
@@ -313,7 +312,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)
|
||||
params.set_param("Draft_array_Link", self.use_link)
|
||||
|
||||
def print_messages(self):
|
||||
"""Print messages about the operation."""
|
||||
|
||||
@@ -35,7 +35,7 @@ import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
import Draft
|
||||
import Draft_rc
|
||||
|
||||
from draftutils import params
|
||||
from draftutils.translate import translate
|
||||
|
||||
# So the resource file doesn't trigger errors from code checkers (flake8)
|
||||
@@ -46,7 +46,7 @@ class ScaleTaskPanel:
|
||||
"""The task panel for the Draft Scale tool."""
|
||||
|
||||
def __init__(self):
|
||||
decimals = App.ParamGet("User parameter:BaseApp/Preferences/Units").GetInt("Decimals", 2)
|
||||
decimals = params.get_param("Decimals", path="Units")
|
||||
self.sourceCmd = None
|
||||
self.form = QtGui.QWidget()
|
||||
self.form.setWindowIcon(QtGui.QIcon(":/icons/Draft_Scale.svg"))
|
||||
@@ -73,19 +73,19 @@ class ScaleTaskPanel:
|
||||
self.zValue.setValue(1)
|
||||
layout.addWidget(self.zValue,2,1,1,1)
|
||||
self.lock = QtGui.QCheckBox()
|
||||
self.lock.setChecked(App.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetBool("ScaleUniform", False))
|
||||
self.lock.setChecked(params.get_param("ScaleUniform"))
|
||||
layout.addWidget(self.lock,3,0,1,2)
|
||||
self.relative = QtGui.QCheckBox()
|
||||
self.relative.setChecked(App.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetBool("ScaleRelative", False))
|
||||
self.relative.setChecked(params.get_param("ScaleRelative"))
|
||||
layout.addWidget(self.relative,4,0,1,2)
|
||||
self.isCopy = QtGui.QCheckBox()
|
||||
self.isCopy.setChecked(App.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetBool("ScaleCopy", False))
|
||||
self.isCopy.setChecked(params.get_param("ScaleCopy"))
|
||||
layout.addWidget(self.isCopy,5,0,1,2)
|
||||
self.isSubelementMode = QtGui.QCheckBox()
|
||||
layout.addWidget(self.isSubelementMode,6,0,1,2)
|
||||
self.isClone = QtGui.QCheckBox()
|
||||
layout.addWidget(self.isClone,7,0,1,2)
|
||||
self.isClone.setChecked(App.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetBool("ScaleClone", False))
|
||||
self.isClone.setChecked(params.get_param("ScaleClone"))
|
||||
self.pickrefButton = QtGui.QPushButton()
|
||||
layout.addWidget(self.pickrefButton,8,0,1,2)
|
||||
QtCore.QObject.connect(self.xValue,QtCore.SIGNAL("valueChanged(double)"),self.setValue)
|
||||
@@ -101,7 +101,7 @@ class ScaleTaskPanel:
|
||||
|
||||
def setLock(self, state):
|
||||
"""Set the uniform scaling."""
|
||||
App.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").SetBool("ScaleUniform", state)
|
||||
params.set_param("ScaleUniform", state)
|
||||
if state:
|
||||
val = self.xValue.value()
|
||||
self.yValue.setValue(val)
|
||||
@@ -109,13 +109,13 @@ class ScaleTaskPanel:
|
||||
|
||||
def setRelative(self, state):
|
||||
"""Set the relative scaling."""
|
||||
App.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").SetBool("ScaleRelative", state)
|
||||
params.set_param("ScaleRelative", state)
|
||||
if self.sourceCmd:
|
||||
self.sourceCmd.scaleGhost(self.xValue.value(),self.yValue.value(),self.zValue.value(),self.relative.isChecked())
|
||||
|
||||
def setCopy(self, state):
|
||||
"""Set the scale and copy option."""
|
||||
App.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").SetBool("ScaleCopy", state)
|
||||
params.set_param("ScaleCopy", state)
|
||||
if state and self.isClone.isChecked():
|
||||
self.isClone.setChecked(False)
|
||||
|
||||
@@ -128,7 +128,7 @@ class ScaleTaskPanel:
|
||||
|
||||
def setClone(self, state):
|
||||
"""Set the clone and scale option."""
|
||||
App.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").SetBool("ScaleClone", state)
|
||||
params.set_param("ScaleClone", state)
|
||||
if state and self.isCopy.isChecked():
|
||||
self.isCopy.setChecked(False)
|
||||
if state and self.isSubelementMode.isChecked():
|
||||
|
||||
@@ -34,13 +34,11 @@ import PySide.QtGui as QtGui
|
||||
import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
import Draft_rc
|
||||
|
||||
import draftguitools.gui_tool_utils as gui_tool_utils
|
||||
|
||||
from DraftVecUtils import toString
|
||||
from draftutils.utils import get_param
|
||||
from draftguitools import gui_tool_utils
|
||||
from draftutils.messages import _err, _msg
|
||||
from draftutils.params import get_param
|
||||
from draftutils.translate import translate
|
||||
from draftutils.messages import _msg, _err
|
||||
from DraftVecUtils import toString
|
||||
|
||||
# So the resource file doesn't trigger errors from code checkers (flake8)
|
||||
True if Draft_rc.__name__ else False
|
||||
@@ -69,7 +67,7 @@ class ShapeStringTaskPanel:
|
||||
self.stringText = string if string else translate("draft", "Default")
|
||||
self.form.leString.setText(self.stringText)
|
||||
self.platWinDialog("Overwrite")
|
||||
self.fileSpec = font if font else get_param("FontFile", "")
|
||||
self.fileSpec = font if font else get_param("FontFile")
|
||||
self.form.fcFontFile.setFileName(self.fileSpec)
|
||||
self.point = point
|
||||
self.pointPicked = False
|
||||
@@ -116,15 +114,7 @@ class ShapeStringTaskPanel:
|
||||
"""Handle the type of dialog depending on the platform."""
|
||||
ParamGroup = App.ParamGet("User parameter:BaseApp/Preferences/Dialog")
|
||||
if flag == "Overwrite":
|
||||
GroupContent = ParamGroup.GetContents()
|
||||
found = False
|
||||
if GroupContent:
|
||||
for ParamSet in GroupContent:
|
||||
if ParamSet[1] == "DontUseNativeFontDialog":
|
||||
found = True
|
||||
break
|
||||
|
||||
if found is False:
|
||||
if "DontUseNativeFontDialog" not in ParamGroup.GetBools():
|
||||
# initialize nonexisting one
|
||||
ParamGroup.SetBool("DontUseNativeFontDialog", True)
|
||||
|
||||
|
||||
@@ -40,9 +40,9 @@ import math
|
||||
import os
|
||||
|
||||
import FreeCAD as App
|
||||
import draftutils.utils as utils
|
||||
|
||||
from draftutils.messages import _msg, _wrn, _err
|
||||
from draftutils import params
|
||||
from draftutils import utils
|
||||
from draftutils.messages import _err, _msg, _wrn
|
||||
from draftutils.translate import translate
|
||||
|
||||
if App.GuiUp:
|
||||
@@ -188,7 +188,7 @@ def dim_symbol(symbol=None, invert=False):
|
||||
----------
|
||||
symbol: int, optional
|
||||
It defaults to `None`, in which it gets the value from the parameter
|
||||
database, `get_param("dimsymbol", 0)`.
|
||||
database, `get_param("dimsymbol")`.
|
||||
|
||||
A numerical value defines different markers
|
||||
* 0, `SoSphere`
|
||||
@@ -211,7 +211,7 @@ def dim_symbol(symbol=None, invert=False):
|
||||
that will be used as a dimension symbol.
|
||||
"""
|
||||
if symbol is None:
|
||||
symbol = utils.get_param("dimsymbol", 0)
|
||||
symbol = params.get_param("dimsymbol")
|
||||
|
||||
if symbol == 0:
|
||||
# marker = coin.SoMarkerSet()
|
||||
@@ -520,9 +520,9 @@ def format_object(target, origin=None):
|
||||
elif "FontName" not in obprops:
|
||||
# Apply 2 Draft style preferences, other style preferences are applied by Core.
|
||||
if "DrawStyle" in obprops:
|
||||
obrep.DrawStyle = utils.DRAW_STYLES[utils.getParam("DefaultDrawStyle", 0)]
|
||||
obrep.DrawStyle = utils.DRAW_STYLES[params.get_param("DefaultDrawStyle")]
|
||||
if "DisplayMode" in obprops:
|
||||
dm = utils.DISPLAY_MODES[utils.getParam("DefaultDisplayMode", 0)]
|
||||
dm = utils.DISPLAY_MODES[params.get_param("DefaultDisplayMode")]
|
||||
if dm in obrep.listDisplayModes():
|
||||
obrep.DisplayMode = dm
|
||||
if Gui.draftToolBar.isConstructionMode():
|
||||
@@ -531,7 +531,7 @@ def format_object(target, origin=None):
|
||||
grp = doc.getObject("Draft_Construction")
|
||||
if not grp:
|
||||
grp = doc.addObject("App::DocumentObjectGroup", "Draft_Construction")
|
||||
grp.Label = utils.get_param("constructiongroupname", "Construction")
|
||||
grp.Label = params.get_param("constructiongroupname")
|
||||
grp.addObject(target)
|
||||
if "TextColor" in obprops:
|
||||
obrep.TextColor = col
|
||||
|
||||
@@ -36,7 +36,7 @@ import PySide.QtGui as QtGui
|
||||
|
||||
import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
|
||||
from draftutils import params
|
||||
from draftutils.init_tools import get_draft_snap_commands
|
||||
from draftutils.translate import translate
|
||||
|
||||
@@ -77,8 +77,7 @@ def get_scales(unit_system = 0):
|
||||
"""
|
||||
|
||||
if unit_system == 0:
|
||||
param = App.ParamGet("User parameter:BaseApp/Preferences/Units")
|
||||
scale_units_system = param.GetInt("UserSchema", 0)
|
||||
scale_units_system = params.get_param("UserSchema", path="Units")
|
||||
if scale_units_system in [0, 1, 4, 6]:
|
||||
return draft_scales_metrics
|
||||
elif scale_units_system in [2, 3, 5]:
|
||||
@@ -141,11 +140,8 @@ def label_to_scale(label):
|
||||
|
||||
def _set_scale(action):
|
||||
"""
|
||||
triggered by scale pushbutton, set DraftAnnotationScale in preferences
|
||||
triggered by scale pushbutton, set DefaultAnnoScaleMultiplier in preferences
|
||||
"""
|
||||
# set the label of the scale button
|
||||
param = App.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")
|
||||
|
||||
mw = Gui.getMainWindow()
|
||||
sb = mw.statusBar()
|
||||
|
||||
@@ -163,14 +159,14 @@ def _set_scale(action):
|
||||
return
|
||||
if scale <= 0:
|
||||
return
|
||||
param.SetFloat("DefaultAnnoScaleMultiplier", 1 / scale)
|
||||
params.set_param("DefaultAnnoScaleMultiplier", 1 / scale)
|
||||
cs = scale_to_label(scale)
|
||||
scale_widget.scaleLabel.setText(cs)
|
||||
else:
|
||||
text_scale = action.text()
|
||||
scale_widget.scaleLabel.setText(text_scale)
|
||||
scale = label_to_scale(text_scale)
|
||||
param.SetFloat("DefaultAnnoScaleMultiplier", 1 / scale)
|
||||
params.set_param("DefaultAnnoScaleMultiplier", 1 / scale)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# MAIN DRAFT STATUSBAR FUNCTIONS
|
||||
@@ -180,8 +176,6 @@ def init_draft_statusbar_scale():
|
||||
"""
|
||||
this function initializes draft statusbar scale widget
|
||||
"""
|
||||
param = App.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")
|
||||
|
||||
mw = Gui.getMainWindow()
|
||||
sb = mw.statusBar()
|
||||
|
||||
@@ -192,7 +186,7 @@ def init_draft_statusbar_scale():
|
||||
draft_scales = get_scales()
|
||||
|
||||
# get draft annotation scale
|
||||
scale_multiplier = param.GetFloat("DefaultAnnoScaleMultiplier", 1)
|
||||
scale_multiplier = params.get_param("DefaultAnnoScaleMultiplier")
|
||||
annotation_scale = 1 / scale_multiplier if scale_multiplier > 0 else 1
|
||||
|
||||
# initializes scale widget
|
||||
@@ -288,12 +282,10 @@ def show_draft_statusbar():
|
||||
"""
|
||||
shows draft statusbar if present or initializes it
|
||||
"""
|
||||
params = App.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")
|
||||
|
||||
mw = Gui.getMainWindow()
|
||||
sb = mw.statusBar()
|
||||
|
||||
if params.GetBool("DisplayStatusbarScaleWidget", True):
|
||||
if params.get_param("DisplayStatusbarScaleWidget"):
|
||||
scale_widget = sb.findChild(QtGui.QToolBar, "draft_scale_widget")
|
||||
if scale_widget:
|
||||
scale_widget.show()
|
||||
@@ -306,7 +298,7 @@ def show_draft_statusbar():
|
||||
t = QtCore.QTimer()
|
||||
t.singleShot(500, init_draft_statusbar_scale)
|
||||
|
||||
if params.GetBool("DisplayStatusbarSnapWidget", True):
|
||||
if params.get_param("DisplayStatusbarSnapWidget"):
|
||||
snap_widget = sb.findChild(QtGui.QToolBar, "draft_snap_widget")
|
||||
if snap_widget:
|
||||
snap_widget.setOrientation(QtCore.Qt.Orientation.Horizontal)
|
||||
|
||||
@@ -34,8 +34,7 @@ added manually.
|
||||
## \addtogroup draftutils
|
||||
# @{
|
||||
import FreeCAD as App
|
||||
|
||||
params = App.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")
|
||||
from draftutils import params
|
||||
|
||||
|
||||
def _msg(text, end="\n"):
|
||||
@@ -60,7 +59,7 @@ def _log(text, end="\n"):
|
||||
def _toolmsg(text, end="\n"):
|
||||
"""Write messages to the console including the line ending,
|
||||
only if ToolMessages pref setting is True"""
|
||||
if params.GetBool("ToolMessages", False):
|
||||
if params.get_param("ToolMessages"):
|
||||
App.Console.PrintMessage(text + end)
|
||||
|
||||
## @}
|
||||
|
||||
@@ -31,9 +31,7 @@ import Draft_rc
|
||||
import Arch_rc
|
||||
|
||||
from draftutils import init_draft_statusbar
|
||||
from draftutils import utils
|
||||
from draftutils.translate import translate
|
||||
from draftviewproviders import view_base
|
||||
|
||||
if App.GuiUp:
|
||||
import FreeCADGui as Gui
|
||||
@@ -151,6 +149,9 @@ def _param_observer_callback_snapcolor():
|
||||
|
||||
|
||||
def _param_observer_callback_svg_pattern():
|
||||
# imports have to happen here to avoid circular imports
|
||||
from draftutils import utils
|
||||
from draftviewproviders import view_base
|
||||
utils.load_svg_patterns()
|
||||
if App.ActiveDocument is None:
|
||||
return
|
||||
@@ -363,8 +364,13 @@ def _get_param_dictionary():
|
||||
"LayersManagerWidth": ("int", 640),
|
||||
"maxSnapEdges": ("int", 0),
|
||||
"Offset_OCC": ("bool", False),
|
||||
"ScaleClone": ("bool", False),
|
||||
"ScaleCopy": ("bool", False),
|
||||
"ScaleRelative": ("bool", False),
|
||||
"ScaleUniform": ("bool", False),
|
||||
"snapModes": ("string", "100000000000000"),
|
||||
"snapRange": ("int", 8),
|
||||
"SvgLinesBlack": ("bool", True),
|
||||
"useSupport": ("bool", False),
|
||||
|
||||
|
||||
@@ -372,6 +378,7 @@ def _get_param_dictionary():
|
||||
|
||||
# Arch parameters that are not in the preferences:
|
||||
param_dict["Mod/Arch"] = {
|
||||
"ColorHelpers": ("unsigned", 674321151),
|
||||
|
||||
|
||||
}
|
||||
@@ -386,15 +393,18 @@ def _get_param_dictionary():
|
||||
"DefaultShapeVertexColor": ("unsigned", 421075455),
|
||||
"EnableSelection": ("bool", True),
|
||||
"MarkerSize": ("int", 9),
|
||||
|
||||
|
||||
}
|
||||
|
||||
# For the Units parameters we do not check the preferences:
|
||||
param_dict["Units"] = {
|
||||
"Decimals": ("int", 2),
|
||||
"UserSchema": ("int", 0),
|
||||
}
|
||||
|
||||
# For the Mod/TechDraw/PAT parameters we do not check the preferences:
|
||||
param_dict["Mod/TechDraw/PAT"] = {
|
||||
"FilePattern": ("string", ""),
|
||||
"NamePattern": ("string", "Diamant"),
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ import os
|
||||
import PySide.QtCore as QtCore
|
||||
|
||||
import FreeCAD as App
|
||||
|
||||
from draftutils import params
|
||||
from draftutils.messages import _msg, _wrn, _err, _log
|
||||
from draftutils.translate import translate
|
||||
|
||||
@@ -61,44 +61,41 @@ arrowtypes = ARROW_TYPES
|
||||
|
||||
|
||||
def get_default_annotation_style():
|
||||
param = App.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")
|
||||
arrow_type_index = param.GetInt("dimsymbol", 0)
|
||||
arrow_type_index = params.get_param("dimsymbol")
|
||||
return {
|
||||
"ArrowSize": ("float", param.GetFloat("arrowsize", 1)),
|
||||
"ArrowSize": ("float", params.get_param("arrowsize")),
|
||||
"ArrowType": ("index", arrow_type_index, ARROW_TYPES[arrow_type_index]),
|
||||
"Decimals": ("int", param.GetInt("dimPrecision", 2)),
|
||||
"DimOvershoot": ("float", param.GetFloat("dimovershoot", 0)),
|
||||
"ExtLines": ("float", param.GetFloat("extlines", -0.5)),
|
||||
"ExtOvershoot": ("float", param.GetFloat("extovershoot", 2)),
|
||||
"FontName": ("font", param.GetString("textfont", "Sans")),
|
||||
"FontSize": ("float", param.GetFloat("textheight", 3.5)),
|
||||
"LineColor": ("color", param.GetUnsigned("DefaultAnnoLineColor", 255)),
|
||||
"LineSpacing": ("float", param.GetFloat("LineSpacing", 1)),
|
||||
"LineWidth": ("int", param.GetInt("DefaultAnnoLineWidth", 2)),
|
||||
"ScaleMultiplier": ("float", param.GetFloat("DefaultAnnoScaleMultiplier", 1)),
|
||||
"ShowLine": ("bool", param.GetBool("DimShowLine", True)),
|
||||
"ShowUnit": ("bool", param.GetBool("showUnit", True)),
|
||||
"TextColor": ("color", param.GetUnsigned("DefaultTextColor", 255)),
|
||||
"TextSpacing": ("float", param.GetFloat("dimspacing", 1)),
|
||||
"UnitOverride": ("str", param.GetString("overrideUnit", ""))
|
||||
"Decimals": ("int", params.get_param("dimPrecision")),
|
||||
"DimOvershoot": ("float", params.get_param("dimovershoot")),
|
||||
"ExtLines": ("float", params.get_param("extlines")),
|
||||
"ExtOvershoot": ("float", params.get_param("extovershoot")),
|
||||
"FontName": ("font", params.get_param("textfont")),
|
||||
"FontSize": ("float", params.get_param("textheight")),
|
||||
"LineColor": ("color", params.get_param("DefaultAnnoLineColor")),
|
||||
"LineSpacing": ("float", params.get_param("LineSpacing")),
|
||||
"LineWidth": ("int", params.get_param("DefaultAnnoLineWidth")),
|
||||
"ScaleMultiplier": ("float", params.get_param("DefaultAnnoScaleMultiplier")),
|
||||
"ShowLine": ("bool", params.get_param("DimShowLine")),
|
||||
"ShowUnit": ("bool", params.get_param("showUnit")),
|
||||
"TextColor": ("color", params.get_param("DefaultTextColor")),
|
||||
"TextSpacing": ("float", params.get_param("dimspacing")),
|
||||
"UnitOverride": ("str", params.get_param("overrideUnit"))
|
||||
}
|
||||
|
||||
|
||||
def get_default_shape_style():
|
||||
# Uses the same format as get_default_annotation_style().
|
||||
param_draft = App.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")
|
||||
param_view = App.ParamGet("User parameter:BaseApp/Preferences/View")
|
||||
display_mode_index = param_draft.GetInt("DefaultDisplayMode", 0)
|
||||
draw_style_index = param_draft.GetInt("DefaultDrawStyle", 0)
|
||||
display_mode_index = params.get_param("DefaultDisplayMode")
|
||||
draw_style_index = params.get_param("DefaultDrawStyle")
|
||||
return {
|
||||
"DisplayMode": ("index", display_mode_index, DISPLAY_MODES[display_mode_index]),
|
||||
"DrawStyle": ("index", draw_style_index, DRAW_STYLES[draw_style_index]),
|
||||
"LineColor": ("color", param_view.GetUnsigned("DefaultShapeLineColor", 255)),
|
||||
"LineWidth": ("int", param_view.GetInt("DefaultShapeLineWidth", 2)),
|
||||
"PointColor": ("color", param_view.GetUnsigned("DefaultShapeVertexColor", 255)),
|
||||
"PointSize": ("int", param_view.GetInt("DefaultShapePointSize", 2)),
|
||||
"ShapeColor": ("color", param_view.GetUnsigned("DefaultShapeColor", 3435973887)),
|
||||
"Transparency": ("int", param_view.GetInt("DefaultShapeTransparency", 0))
|
||||
"LineColor": ("color", params.get_param_view("DefaultShapeLineColor")),
|
||||
"LineWidth": ("int", params.get_param_view("DefaultShapeLineWidth")),
|
||||
"PointColor": ("color", params.get_param_view("DefaultShapeVertexColor")),
|
||||
"PointSize": ("int", params.get_param_view("DefaultShapePointSize")),
|
||||
"ShapeColor": ("color", params.get_param_view("DefaultShapeColor")),
|
||||
"Transparency": ("int", params.get_param_view("DefaultShapeTransparency"))
|
||||
}
|
||||
|
||||
|
||||
@@ -259,7 +256,7 @@ def get_param(param, default=None):
|
||||
|
||||
p = App.ParamGet(draft_params)
|
||||
v = App.ParamGet(view_params)
|
||||
t = getParamType(param)
|
||||
t = get_param_type(param)
|
||||
# print("getting param ",param, " of type ",t, " default: ",str(default))
|
||||
if t == "int":
|
||||
if default is None:
|
||||
@@ -322,7 +319,7 @@ def set_param(param, value):
|
||||
|
||||
p = App.ParamGet(draft_params)
|
||||
v = App.ParamGet(view_params)
|
||||
t = getParamType(param)
|
||||
t = get_param_type(param)
|
||||
|
||||
if t == "int":
|
||||
if param == "linewidth":
|
||||
@@ -363,9 +360,9 @@ def precision():
|
||||
Returns
|
||||
-------
|
||||
int
|
||||
get_param("precision", 6)
|
||||
params.get_param("precision")
|
||||
"""
|
||||
return getParam("precision", 6)
|
||||
return params.get_param("precision")
|
||||
|
||||
|
||||
def tolerance():
|
||||
@@ -743,7 +740,7 @@ def load_svg_patterns():
|
||||
App.svgpatterns.update(p)
|
||||
|
||||
# Get patterns in a user defined file
|
||||
altpat = getParam("patternFile", "")
|
||||
altpat = params.get_param("patternFile")
|
||||
if os.path.isdir(altpat):
|
||||
for f in os.listdir(altpat):
|
||||
if f[-4:].upper() == ".SVG":
|
||||
@@ -811,8 +808,8 @@ def get_rgb(color, testbw=True):
|
||||
col = "#"+r+g+b
|
||||
if testbw:
|
||||
if col == "#ffffff":
|
||||
# print(getParam('SvgLinesBlack'))
|
||||
if getParam('SvgLinesBlack', True):
|
||||
# print(params.get_param("SvgLinesBlack"))
|
||||
if params.get_param("SvgLinesBlack"):
|
||||
col = "#000000"
|
||||
return col
|
||||
|
||||
|
||||
@@ -35,8 +35,9 @@ import PySide.QtGui as QtGui
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
|
||||
import FreeCAD as App
|
||||
import draftutils.utils as utils
|
||||
import draftutils.gui_utils as gui_utils
|
||||
from draftutils import gui_utils
|
||||
from draftutils import params
|
||||
from draftutils import utils
|
||||
from draftutils.translate import translate
|
||||
|
||||
if App.GuiUp:
|
||||
@@ -116,7 +117,7 @@ class ViewProviderDraft(object):
|
||||
"Draft",
|
||||
QT_TRANSLATE_NOOP("App::Property",
|
||||
"Defines the size of the SVG pattern."))
|
||||
vobj.PatternSize = utils.get_param("HatchPatternSize", 1)
|
||||
vobj.PatternSize = params.get_param("HatchPatternSize")
|
||||
|
||||
def dumps(self):
|
||||
"""Return a tuple of all serializable objects or None.
|
||||
@@ -303,7 +304,7 @@ class ViewProviderDraft(object):
|
||||
if i.exists():
|
||||
size = None
|
||||
if ".SVG" in path.upper():
|
||||
size = utils.get_param("HatchPatternResolution", 128)
|
||||
size = params.get_param("HatchPatternResolution")
|
||||
if not size:
|
||||
size = 128
|
||||
im = gui_utils.load_texture(path, size)
|
||||
|
||||
@@ -40,12 +40,11 @@ from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
|
||||
import FreeCAD as App
|
||||
import DraftVecUtils
|
||||
import draftutils.units as units
|
||||
import draftutils.utils as utils
|
||||
import draftutils.gui_utils as gui_utils
|
||||
|
||||
from draftviewproviders.view_draft_annotation \
|
||||
import ViewProviderDraftAnnotation
|
||||
from draftutils import gui_utils
|
||||
from draftutils import params
|
||||
from draftutils import units
|
||||
from draftutils import utils
|
||||
from draftviewproviders.view_draft_annotation import ViewProviderDraftAnnotation
|
||||
|
||||
# Delay import of module until first use because it is heavy
|
||||
Part = lz.LazyLoader("Part", globals(), "Part")
|
||||
@@ -126,7 +125,7 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
|
||||
"TextSpacing",
|
||||
"Text",
|
||||
_tip)
|
||||
vobj.TextSpacing = utils.get_param("dimspacing", 1)
|
||||
vobj.TextSpacing = params.get_param("dimspacing")
|
||||
|
||||
if "FlipText" not in properties:
|
||||
_tip = QT_TRANSLATE_NOOP("App::Property",
|
||||
@@ -169,7 +168,7 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
|
||||
"Decimals",
|
||||
"Units",
|
||||
_tip)
|
||||
vobj.Decimals = utils.get_param("dimPrecision", 2)
|
||||
vobj.Decimals = params.get_param("dimPrecision")
|
||||
|
||||
if "ShowUnit" not in properties:
|
||||
_tip = QT_TRANSLATE_NOOP("App::Property",
|
||||
@@ -178,7 +177,7 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
|
||||
"ShowUnit",
|
||||
"Units",
|
||||
_tip)
|
||||
vobj.ShowUnit = utils.get_param("showUnit", True)
|
||||
vobj.ShowUnit = params.get_param("showUnit")
|
||||
|
||||
if "UnitOverride" not in properties:
|
||||
_tip = QT_TRANSLATE_NOOP("App::Property",
|
||||
@@ -189,7 +188,7 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
|
||||
"UnitOverride",
|
||||
"Units",
|
||||
_tip)
|
||||
vobj.UnitOverride = utils.get_param("overrideUnit", '')
|
||||
vobj.UnitOverride = params.get_param("overrideUnit")
|
||||
|
||||
def set_graphics_properties(self, vobj, properties):
|
||||
"""Set graphics properties only if they don't already exist."""
|
||||
@@ -202,7 +201,7 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
|
||||
"ArrowSize",
|
||||
"Graphics",
|
||||
_tip)
|
||||
vobj.ArrowSize = utils.get_param("arrowsize", 1)
|
||||
vobj.ArrowSize = params.get_param("arrowsize")
|
||||
|
||||
if "ArrowType" not in properties:
|
||||
_tip = QT_TRANSLATE_NOOP("App::Property",
|
||||
@@ -212,7 +211,7 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
|
||||
"Graphics",
|
||||
_tip)
|
||||
vobj.ArrowType = utils.ARROW_TYPES
|
||||
vobj.ArrowType = utils.ARROW_TYPES[utils.get_param("dimsymbol", 0)]
|
||||
vobj.ArrowType = utils.ARROW_TYPES[params.get_param("dimsymbol")]
|
||||
|
||||
if "FlipArrows" not in properties:
|
||||
_tip = QT_TRANSLATE_NOOP("App::Property",
|
||||
@@ -232,7 +231,7 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
|
||||
"DimOvershoot",
|
||||
"Graphics",
|
||||
_tip)
|
||||
vobj.DimOvershoot = utils.get_param("dimovershoot", 0)
|
||||
vobj.DimOvershoot = params.get_param("dimovershoot")
|
||||
|
||||
if "ExtLines" not in properties:
|
||||
_tip = QT_TRANSLATE_NOOP("App::Property",
|
||||
@@ -241,7 +240,7 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
|
||||
"ExtLines",
|
||||
"Graphics",
|
||||
_tip)
|
||||
vobj.ExtLines = utils.get_param("extlines", 0.3)
|
||||
vobj.ExtLines = params.get_param("extlines")
|
||||
|
||||
if "ExtOvershoot" not in properties:
|
||||
_tip = QT_TRANSLATE_NOOP("App::Property",
|
||||
@@ -251,7 +250,7 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
|
||||
"ExtOvershoot",
|
||||
"Graphics",
|
||||
_tip)
|
||||
vobj.ExtOvershoot = utils.get_param("extovershoot", 0)
|
||||
vobj.ExtOvershoot = params.get_param("extovershoot")
|
||||
|
||||
if "ShowLine" not in properties:
|
||||
_tip = QT_TRANSLATE_NOOP("App::Property",
|
||||
@@ -260,7 +259,7 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
|
||||
"ShowLine",
|
||||
"Graphics",
|
||||
_tip)
|
||||
vobj.ShowLine = utils.get_param("DimShowLine", True)
|
||||
vobj.ShowLine = params.get_param("DimShowLine")
|
||||
|
||||
def getIcon(self):
|
||||
"""Return the path to the icon used by the viewprovider."""
|
||||
@@ -547,7 +546,7 @@ class ViewProviderLinearDimension(ViewProviderDimensionBase):
|
||||
try:
|
||||
m = vobj.DisplayMode
|
||||
except AssertionError:
|
||||
m = ["World", "Screen"][utils.get_param("DefaultAnnoDisplayMode", 0)]
|
||||
m = ["World", "Screen"][params.get_param("DefaultAnnoDisplayMode")]
|
||||
|
||||
if m == "Screen":
|
||||
offset = offset.negative()
|
||||
@@ -583,14 +582,12 @@ class ViewProviderLinearDimension(ViewProviderDimensionBase):
|
||||
unit = vobj.UnitOverride
|
||||
|
||||
# Special representation if we use 'Building US' scheme
|
||||
u_params = App.ParamGet("User parameter:BaseApp/Preferences/Units")
|
||||
if u_params.GetInt("UserSchema", 0) == 5:
|
||||
if params.get_param("UserSchema", path="Units") == 5:
|
||||
self.string = App.Units.Quantity(length, App.Units.Length).UserString
|
||||
if self.string.count('"') > 1:
|
||||
# multiple inch tokens
|
||||
self.string = self.string.replace('"',"",self.string.count('"')-1)
|
||||
d_params = App.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")
|
||||
sep = d_params.GetString("FeetSeparator"," ")
|
||||
self.string = self.string.replace('"', "", self.string.count('"')-1)
|
||||
sep = params.get_param("FeetSeparator")
|
||||
# use a custom separator
|
||||
self.string = self.string.replace("' ", "'" + sep)
|
||||
self.string = self.string.replace("+", " ")
|
||||
@@ -972,7 +969,7 @@ class ViewProviderAngularDimension(ViewProviderDimensionBase):
|
||||
try:
|
||||
m = vobj.DisplayMode
|
||||
except AssertionError:
|
||||
m = ["World", "Screen"][utils.get_param("DefaultAnnoDisplayMode", 0)]
|
||||
m = ["World", "Screen"][params.get_param("DefaultAnnoDisplayMode")]
|
||||
|
||||
# Set the arc
|
||||
first = self.circle.FirstParameter
|
||||
|
||||
@@ -48,8 +48,8 @@ import PySide.QtGui as QtGui
|
||||
|
||||
import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
|
||||
import draftutils.utils as utils
|
||||
from draftutils import params
|
||||
from draftutils import utils
|
||||
from draftutils.messages import _msg
|
||||
from draftutils.translate import translate
|
||||
|
||||
@@ -87,7 +87,7 @@ class ViewProviderDraftAnnotation(object):
|
||||
"ScaleMultiplier",
|
||||
"Annotation",
|
||||
_tip)
|
||||
vobj.ScaleMultiplier = utils.get_param("DefaultAnnoScaleMultiplier", 1)
|
||||
vobj.ScaleMultiplier = params.get_param("DefaultAnnoScaleMultiplier")
|
||||
|
||||
if "AnnotationStyle" not in properties:
|
||||
_tip = QT_TRANSLATE_NOOP("App::Property",
|
||||
@@ -119,7 +119,7 @@ class ViewProviderDraftAnnotation(object):
|
||||
"FontName",
|
||||
"Text",
|
||||
_tip)
|
||||
vobj.FontName = utils.get_param("textfont", "sans")
|
||||
vobj.FontName = params.get_param("textfont")
|
||||
|
||||
if "FontSize" not in properties:
|
||||
_tip = QT_TRANSLATE_NOOP("App::Property",
|
||||
@@ -128,7 +128,7 @@ class ViewProviderDraftAnnotation(object):
|
||||
"FontSize",
|
||||
"Text",
|
||||
_tip)
|
||||
vobj.FontSize = utils.get_param("textheight", 1)
|
||||
vobj.FontSize = params.get_param("textheight")
|
||||
|
||||
if "TextColor" not in properties:
|
||||
_tip = QT_TRANSLATE_NOOP("App::Property",
|
||||
@@ -137,7 +137,7 @@ class ViewProviderDraftAnnotation(object):
|
||||
"TextColor",
|
||||
"Text",
|
||||
_tip)
|
||||
vobj.TextColor = utils.get_param("DefaultTextColor", 255) & 0xFFFFFF00
|
||||
vobj.TextColor = params.get_param("DefaultTextColor") & 0xFFFFFF00
|
||||
|
||||
def set_units_properties(self, vobj, properties):
|
||||
return
|
||||
@@ -150,7 +150,7 @@ class ViewProviderDraftAnnotation(object):
|
||||
"LineWidth",
|
||||
"Graphics",
|
||||
_tip)
|
||||
vobj.LineWidth = utils.get_param("DefaultAnnoLineWidth", 2)
|
||||
vobj.LineWidth = params.get_param("DefaultAnnoLineWidth")
|
||||
|
||||
if "LineColor" not in properties:
|
||||
_tip = QT_TRANSLATE_NOOP("App::Property", "Line color")
|
||||
@@ -158,7 +158,7 @@ class ViewProviderDraftAnnotation(object):
|
||||
"LineColor",
|
||||
"Graphics",
|
||||
_tip)
|
||||
vobj.LineColor = utils.get_param("DefaultAnnoLineColor", 255) & 0xFFFFFF00
|
||||
vobj.LineColor = params.get_param("DefaultAnnoLineColor") & 0xFFFFFF00
|
||||
|
||||
def dumps(self):
|
||||
"""Return a tuple of objects to save or None."""
|
||||
@@ -182,7 +182,7 @@ class ViewProviderDraftAnnotation(object):
|
||||
|
||||
def getDefaultDisplayMode(self):
|
||||
"""Return the default display mode."""
|
||||
return ["World", "Screen"][utils.get_param("DefaultAnnoDisplayMode", 0)]
|
||||
return ["World", "Screen"][params.get_param("DefaultAnnoDisplayMode")]
|
||||
|
||||
def setDisplayMode(self, mode):
|
||||
"""Return the saved display mode."""
|
||||
|
||||
@@ -36,17 +36,14 @@ import pivy.coin as coin
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
|
||||
import FreeCAD as App
|
||||
import draftutils.utils as utils
|
||||
import draftutils.gui_utils as gui_utils
|
||||
|
||||
from draftviewproviders.view_draft_annotation \
|
||||
import ViewProviderDraftAnnotation
|
||||
from draftutils import gui_utils
|
||||
from draftutils import params
|
||||
from draftutils import utils
|
||||
from draftviewproviders.view_draft_annotation import ViewProviderDraftAnnotation
|
||||
|
||||
if App.GuiUp:
|
||||
import FreeCADGui as Gui
|
||||
|
||||
param = App.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")
|
||||
|
||||
|
||||
class ViewProviderLabel(ViewProviderDraftAnnotation):
|
||||
"""Viewprovider for the Label annotation object."""
|
||||
@@ -90,7 +87,7 @@ class ViewProviderLabel(ViewProviderDraftAnnotation):
|
||||
"LineSpacing",
|
||||
"Text",
|
||||
_tip)
|
||||
vobj.LineSpacing = utils.get_param("LineSpacing", 1)
|
||||
vobj.LineSpacing = params.get_param("LineSpacing")
|
||||
|
||||
def set_graphics_properties(self, vobj, properties):
|
||||
"""Set graphics properties only if they don't already exist."""
|
||||
@@ -103,7 +100,7 @@ class ViewProviderLabel(ViewProviderDraftAnnotation):
|
||||
"ArrowSize",
|
||||
"Graphics",
|
||||
_tip)
|
||||
vobj.ArrowSize = utils.get_param("arrowsize", 1)
|
||||
vobj.ArrowSize = params.get_param("arrowsize")
|
||||
|
||||
if "ArrowType" not in properties:
|
||||
_tip = QT_TRANSLATE_NOOP("App::Property",
|
||||
@@ -113,7 +110,7 @@ class ViewProviderLabel(ViewProviderDraftAnnotation):
|
||||
"Graphics",
|
||||
_tip)
|
||||
vobj.ArrowType = utils.ARROW_TYPES
|
||||
vobj.ArrowType = utils.ARROW_TYPES[utils.get_param("dimsymbol", 0)]
|
||||
vobj.ArrowType = utils.ARROW_TYPES[params.get_param("dimsymbol")]
|
||||
|
||||
if "Frame" not in properties:
|
||||
_tip = QT_TRANSLATE_NOOP("App::Property",
|
||||
@@ -176,7 +173,7 @@ class ViewProviderLabel(ViewProviderDraftAnnotation):
|
||||
self.text_wld.string = self.text_scr.string = "Label"
|
||||
self.text_wld.justification = coin.SoAsciiText.RIGHT
|
||||
self.text_scr.justification = coin.SoText2.RIGHT
|
||||
self.font.name = utils.get_param("textfont")
|
||||
self.font.name = params.get_param("textfont")
|
||||
|
||||
switchnode = coin.SoSeparator()
|
||||
switchnode.addChild(self.line)
|
||||
|
||||
@@ -36,11 +36,11 @@ from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
|
||||
import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
|
||||
import draftutils.utils as utils
|
||||
from draftobjects.layer import Layer
|
||||
from draftutils import params
|
||||
from draftutils import utils
|
||||
from draftutils.messages import _msg
|
||||
from draftutils.translate import translate
|
||||
from draftobjects.layer import Layer
|
||||
|
||||
|
||||
class ViewProviderLayer:
|
||||
@@ -92,11 +92,8 @@ class ViewProviderLayer:
|
||||
"Print",
|
||||
_tip)
|
||||
|
||||
|
||||
def set_visual_properties(self, vobj, properties):
|
||||
"""Set visual properties only if they don't already exist."""
|
||||
view_group = App.ParamGet("User parameter:BaseApp/Preferences/View")
|
||||
|
||||
if "LineColor" not in properties:
|
||||
_tip = QT_TRANSLATE_NOOP("App::Property",
|
||||
"The line color of the objects "
|
||||
@@ -105,11 +102,7 @@ class ViewProviderLayer:
|
||||
"LineColor",
|
||||
"Layer",
|
||||
_tip)
|
||||
|
||||
c = view_group.GetUnsigned("DefaultShapeLineColor", 255)
|
||||
vobj.LineColor = (((c >> 24) & 0xFF) / 255,
|
||||
((c >> 16) & 0xFF) / 255,
|
||||
((c >> 8) & 0xFF) / 255)
|
||||
vobj.LineColor = params.get_param_view("DefaultShapeLineColor") & 0xFFFFFF00
|
||||
|
||||
if "ShapeColor" not in properties:
|
||||
_tip = QT_TRANSLATE_NOOP("App::Property",
|
||||
@@ -119,11 +112,7 @@ class ViewProviderLayer:
|
||||
"ShapeColor",
|
||||
"Layer",
|
||||
_tip)
|
||||
|
||||
c = view_group.GetUnsigned("DefaultShapeColor", 4294967295)
|
||||
vobj.ShapeColor = (((c >> 24) & 0xFF) / 255,
|
||||
((c >> 16) & 0xFF) / 255,
|
||||
((c >> 8) & 0xFF) / 255)
|
||||
vobj.ShapeColor = params.get_param_view("DefaultShapeColor") & 0xFFFFFF00
|
||||
|
||||
if "LineWidth" not in properties:
|
||||
_tip = QT_TRANSLATE_NOOP("App::Property",
|
||||
@@ -133,9 +122,7 @@ class ViewProviderLayer:
|
||||
"LineWidth",
|
||||
"Layer",
|
||||
_tip)
|
||||
|
||||
width = view_group.GetInt("DefaultShapeLineWidth", 2)
|
||||
vobj.LineWidth = width
|
||||
vobj.LineWidth = params.get_param_view("DefaultShapeLineWidth")
|
||||
|
||||
if "DrawStyle" not in properties:
|
||||
_tip = QT_TRANSLATE_NOOP("App::Property",
|
||||
@@ -145,8 +132,8 @@ class ViewProviderLayer:
|
||||
"DrawStyle",
|
||||
"Layer",
|
||||
_tip)
|
||||
vobj.DrawStyle = ["Solid", "Dashed", "Dotted", "Dashdot"]
|
||||
vobj.DrawStyle = "Solid"
|
||||
vobj.DrawStyle = utils.DRAW_STYLES
|
||||
vobj.DrawStyle = params.get_param("DefaultDrawStyle")
|
||||
|
||||
if "Transparency" not in properties:
|
||||
_tip = QT_TRANSLATE_NOOP("App::Property",
|
||||
@@ -156,7 +143,7 @@ class ViewProviderLayer:
|
||||
"Transparency",
|
||||
"Layer",
|
||||
_tip)
|
||||
vobj.Transparency = 0
|
||||
vobj.Transparency = params.get_param_view("DefaultShapeTransparency")
|
||||
|
||||
if "LinePrintColor" not in properties:
|
||||
_tip = QT_TRANSLATE_NOOP("App::Property",
|
||||
@@ -167,6 +154,7 @@ class ViewProviderLayer:
|
||||
"LinePrintColor",
|
||||
"Print",
|
||||
_tip)
|
||||
vobj.LinePrintColor = params.get_param("DefaultPrintColor")
|
||||
|
||||
def getIcon(self):
|
||||
"""Return the path to the icon used by the viewprovider.
|
||||
|
||||
@@ -35,12 +35,9 @@ from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
|
||||
import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
|
||||
import draftutils.utils as utils
|
||||
from draftutils import params
|
||||
from draftutils.translate import translate
|
||||
|
||||
from draftviewproviders.view_draft_annotation \
|
||||
import ViewProviderDraftAnnotation
|
||||
from draftviewproviders.view_draft_annotation import ViewProviderDraftAnnotation
|
||||
|
||||
|
||||
class ViewProviderText(ViewProviderDraftAnnotation):
|
||||
@@ -66,7 +63,7 @@ class ViewProviderText(ViewProviderDraftAnnotation):
|
||||
"LineSpacing",
|
||||
"Text",
|
||||
_tip)
|
||||
vobj.LineSpacing = utils.get_param("LineSpacing", 1)
|
||||
vobj.LineSpacing = params.get_param("LineSpacing")
|
||||
|
||||
def getIcon(self):
|
||||
"""Return the path to the icon used by the view provider."""
|
||||
|
||||
@@ -40,13 +40,12 @@ import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
import DraftVecUtils
|
||||
import WorkingPlane
|
||||
import draftgeoutils.wires as wires
|
||||
import draftutils.utils as utils
|
||||
import draftutils.gui_utils as gui_utils
|
||||
|
||||
from draftgeoutils import wires
|
||||
from draftutils import gui_utils
|
||||
from draftutils import params
|
||||
from draftutils import utils
|
||||
from draftutils.messages import _msg
|
||||
from draftutils.translate import translate
|
||||
|
||||
from draftviewproviders.view_base import ViewProviderDraft
|
||||
|
||||
|
||||
@@ -75,7 +74,7 @@ class ViewProviderWire(ViewProviderDraft):
|
||||
"ArrowSize",
|
||||
"Draft",
|
||||
QT_TRANSLATE_NOOP("App::Property", _tip))
|
||||
vobj.ArrowSize = utils.get_param("arrowsize", 0.1)
|
||||
vobj.ArrowSize = params.get_param("arrowsize")
|
||||
|
||||
if not hasattr(vobj, "ArrowType"):
|
||||
_tip = "Arrow type"
|
||||
@@ -84,7 +83,7 @@ class ViewProviderWire(ViewProviderDraft):
|
||||
"Draft",
|
||||
QT_TRANSLATE_NOOP("App::Property", _tip))
|
||||
vobj.ArrowType = utils.ARROW_TYPES
|
||||
vobj.ArrowType = utils.ARROW_TYPES[utils.get_param("dimsymbol", 0)]
|
||||
vobj.ArrowType = utils.ARROW_TYPES[params.get_param("dimsymbol")]
|
||||
|
||||
def attach(self, vobj):
|
||||
self.Object = vobj.Object
|
||||
@@ -127,7 +126,7 @@ class ViewProviderWire(ViewProviderDraft):
|
||||
if hasattr(vobj,"ArrowSize"):
|
||||
s = vobj.ArrowSize
|
||||
else:
|
||||
s = utils.get_param("arrowsize",0.1)
|
||||
s = params.get_param("arrowsize")
|
||||
self.coords.scaleFactor.setValue((s,s,s))
|
||||
rn.addChild(self.pt)
|
||||
else:
|
||||
|
||||
@@ -34,6 +34,7 @@ from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
|
||||
import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
from draftutils import params
|
||||
|
||||
|
||||
class ViewProviderWorkingPlaneProxy:
|
||||
@@ -70,9 +71,7 @@ class ViewProviderWorkingPlaneProxy:
|
||||
vobj.Transparency = 70
|
||||
vobj.LineWidth = 1
|
||||
|
||||
param = App.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
|
||||
c = param.GetUnsigned("ColorHelpers", 674321151)
|
||||
vobj.LineColor = c & 0xFFFFFF00
|
||||
vobj.LineColor = params.get_param_arch("ColorHelpers") & 0xFFFFFF00
|
||||
|
||||
vobj.Proxy = self
|
||||
vobj.RestoreView = True
|
||||
|
||||
Reference in New Issue
Block a user