Move Path.Base and Path.Base.Gui refactoring

This commit is contained in:
Markus Lampert
2022-08-13 19:53:53 -07:00
parent f1596599ee
commit 5ca5a94f5e
63 changed files with 274 additions and 298 deletions

View File

@@ -27,6 +27,8 @@ SET(PathPython_SRCS
Path/__init__.py
Path/Log.py
Path/Geom.py
Path/GuiInit.py
Path/Preferences.py
)
SET(PathPythonBase_SRCS
@@ -35,9 +37,23 @@ SET(PathPythonBase_SRCS
Path/Base/FeedRate.py
Path/Base/Property.py
Path/Base/PropertyBag.py
Path/Base/SetupSheet.py
Path/Base/SetupSheetOpPrototype.py
Path/Base/Util.py
)
SET(PathPythonBaseGui_SRCS
Path/Base/Gui/__init__.py
Path/Base/Gui/GetPoint.py
Path/Base/Gui/IconViewProvider.py
Path/Base/Gui/PreferencesAdvanced.py
Path/Base/Gui/PropertyBag.py
Path/Base/Gui/PropertyEditor.py
Path/Base/Gui/SetupSheet.py
Path/Base/Gui/SetupSheetOpPrototype.py
Path/Base/Gui/Util.py
)
SET(PathPythonDressup_SRCS
Path/Dressup/__init__.py
Path/Dressup/Utils.py
@@ -177,27 +193,15 @@ SET(PathScripts_SRCS
PathScripts/PathFeatureExtensions.py
PathScripts/PathFeatureExtensionsGui.py
PathScripts/PathFixture.py
PathScripts/PathGetPoint.py
PathScripts/PathGui.py
PathScripts/PathGuiInit.py
PathScripts/PathHop.py
PathScripts/PathIconViewProvider.py
PathScripts/PathInspect.py
PathScripts/PathJob.py
PathScripts/PathJobCmd.py
PathScripts/PathJobDlg.py
PathScripts/PathJobGui.py
PathScripts/PathPreferences.py
PathScripts/PathPreferencesAdvanced.py
PathScripts/PathPreferencesPathJob.py
PathScripts/PathPropertyBagGui.py
PathScripts/PathPropertyEditor.py
PathScripts/PathSanity.py
PathScripts/PathSelection.py
PathScripts/PathSetupSheet.py
PathScripts/PathSetupSheetGui.py
PathScripts/PathSetupSheetOpPrototype.py
PathScripts/PathSetupSheetOpPrototypeGui.py
PathScripts/PathSimpleCopy.py
PathScripts/PathSimulatorGui.py
PathScripts/PathStock.py

View File

@@ -69,9 +69,6 @@ class PathWorkbench(Workbench):
PathPreferencesPathDressup.DressupPreferencesPage, "Path"
)
# Check enablement of experimental features
from PathScripts import PathPreferences
# load the builtin modules
import Path
import PathScripts
@@ -80,7 +77,7 @@ class PathWorkbench(Workbench):
FreeCADGui.addLanguagePath(":/translations")
FreeCADGui.addIconPath(":/icons")
from PathScripts import PathGuiInit
import Path.GuiInit
from PathScripts import PathJobCmd
from Path.Tool.Gui import BitCmd as PathToolBitCmd
@@ -92,7 +89,7 @@ class PathWorkbench(Workbench):
import subprocess
from packaging.version import Version, parse
PathGuiInit.Startup()
Path.GuiInit.Startup()
# build commands list
projcmdlist = ["Path_Job", "Path_Post"]
@@ -148,14 +145,14 @@ class PathWorkbench(Workbench):
)
threedcmdgroup = threedopcmdlist
if PathPreferences.experimentalFeaturesEnabled():
if Path.Preferences.experimentalFeaturesEnabled():
projcmdlist.append("Path_Sanity")
prepcmdlist.append("Path_Shape")
extracmdlist.extend(["Path_Area", "Path_Area_Workplane"])
specialcmdlist.append("Path_ThreadMilling")
twodopcmdlist.append("Path_Slot")
if PathPreferences.advancedOCLFeaturesEnabled():
if Path.Preferences.advancedOCLFeaturesEnabled():
try:
r = subprocess.run(
["camotics", "--version"], capture_output=True, text=True
@@ -182,7 +179,7 @@ class PathWorkbench(Workbench):
),
)
except ImportError:
if not PathPreferences.suppressOpenCamLibWarning():
if not Path.Preferences.suppressOpenCamLibWarning():
FreeCAD.Console.PrintError("OpenCamLib is not working!\n")
self.appendToolbar(QT_TRANSLATE_NOOP("Workbench", "Project Setup"), projcmdlist)
@@ -255,13 +252,13 @@ class PathWorkbench(Workbench):
self.dressupcmds = dressupcmdlist
curveAccuracy = PathPreferences.defaultLibAreaCurveAccuracy()
curveAccuracy = Path.Preferences.defaultLibAreaCurveAccuracy()
if curveAccuracy:
Path.Area.setDefaultParams(Accuracy=curveAccuracy)
# keep this one the last entry in the preferences
import PathScripts.PathPreferencesAdvanced as PathPreferencesAdvanced
from PathScripts.PathPreferences import preferences
import Path.Base.Gui.PreferencesAdvanced as PathPreferencesAdvanced
from Path.Preferences import preferences
FreeCADGui.addPreferencePage(
PathPreferencesAdvanced.AdvancedPreferencesPage, "Path"
@@ -269,7 +266,7 @@ class PathWorkbench(Workbench):
Log("Loading Path workbench... done\n")
# Warn user if current schema doesn't use minute for time in velocity
if not PathPreferences.suppressVelocity():
if not Path.Preferences.suppressVelocity():
velString = FreeCAD.Units.Quantity(
1, FreeCAD.Units.Velocity
).getUserPreferred()[2][3:]

View File

@@ -22,7 +22,6 @@
import FreeCADGui
import Path
import PathScripts.PathPreferences as PathPreferences
if False:
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
@@ -38,7 +37,7 @@ class AdvancedPreferencesPage:
self.form.EnableAdvancedOCLFeatures.stateChanged.connect(self.updateSelection)
def saveSettings(self):
PathPreferences.setPreferencesAdvanced(
Path.Preferences.setPreferencesAdvanced(
self.form.EnableAdvancedOCLFeatures.isChecked(),
self.form.WarningSuppressAllSpeeds.isChecked(),
self.form.WarningSuppressRapidSpeeds.isChecked(),
@@ -50,21 +49,21 @@ class AdvancedPreferencesPage:
def loadSettings(self):
Path.Log.track()
self.form.WarningSuppressAllSpeeds.setChecked(
PathPreferences.suppressAllSpeedsWarning()
Path.Preferences.suppressAllSpeedsWarning()
)
self.form.WarningSuppressRapidSpeeds.setChecked(
PathPreferences.suppressRapidSpeedsWarning(False)
Path.Preferences.suppressRapidSpeedsWarning(False)
)
self.form.WarningSuppressSelectionMode.setChecked(
PathPreferences.suppressSelectionModeWarning()
Path.Preferences.suppressSelectionModeWarning()
)
self.form.EnableAdvancedOCLFeatures.setChecked(
PathPreferences.advancedOCLFeaturesEnabled()
Path.Preferences.advancedOCLFeaturesEnabled()
)
self.form.WarningSuppressOpenCamLib.setChecked(
PathPreferences.suppressOpenCamLibWarning()
Path.Preferences.suppressOpenCamLibWarning()
)
self.form.WarningSuppressVelocity.setChecked(PathPreferences.suppressVelocity())
self.form.WarningSuppressVelocity.setChecked(Path.Preferences.suppressVelocity())
self.updateSelection()
def updateSelection(self, state=None):

View File

@@ -22,7 +22,7 @@
import FreeCAD
import Path
import PathScripts.PathSetupSheetOpPrototype as PathSetupSheetOpPrototype
import Path.Base.SetupSheetOpPrototype as PathSetupSheetOpPrototype
from PySide import QtCore, QtGui

View File

@@ -23,12 +23,12 @@
import FreeCAD
import FreeCADGui
import Path
import Path.Base.Gui.IconViewProvider as PathIconViewProvider
import Path.Base.Gui.SetupSheetOpPrototypeGui as PathSetupSheetOpPrototypeGui
import Path.Base.Gui.Util as PathGuiUtil
import Path.Base.SetupSheet as PathSetupSheet
import Path.Base.Util as PathUtil
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathScripts.PathGui as PathGui
import PathScripts.PathIconViewProvider as PathIconViewProvider
import PathScripts.PathSetupSheet as PathSetupSheet
import PathScripts.PathSetupSheetOpPrototypeGui as PathSetupSheetOpPrototypeGui
import PathGui
from PySide import QtCore, QtGui
@@ -347,16 +347,16 @@ class GlobalEditor(object):
self.updateUI()
def setupUi(self):
self.clearanceHeightOffs = PathGui.QuantitySpinBox(
self.clearanceHeightOffs = PathGuiUtil.QuantitySpinBox(
self.form.setupClearanceHeightOffs, self.obj, "ClearanceHeightOffset"
)
self.safeHeightOffs = PathGui.QuantitySpinBox(
self.safeHeightOffs = PathGuiUtil.QuantitySpinBox(
self.form.setupSafeHeightOffs, self.obj, "SafeHeightOffset"
)
self.rapidHorizontal = PathGui.QuantitySpinBox(
self.rapidHorizontal = PathGuiUtil.QuantitySpinBox(
self.form.setupRapidHorizontal, self.obj, "HorizRapid"
)
self.rapidVertical = PathGui.QuantitySpinBox(
self.rapidVertical = PathGuiUtil.QuantitySpinBox(
self.form.setupRapidVertical, self.obj, "VertRapid"
)
self.form.setupCoolantMode.addItems(self.obj.CoolantModes)

View File

@@ -22,7 +22,7 @@
import FreeCAD
import Path
import PathScripts.PathSetupSheetOpPrototype as PathSetupSheetOpPrototype
import Path.Base.SetupSheetOpPrototype as PathSetupSheetOpPrototype
from PySide import QtCore, QtGui

View File

View File

@@ -23,7 +23,7 @@
import FreeCAD
import Path
import Path.Base.Util as PathUtil
import PathScripts.PathSetupSheetOpPrototype as PathSetupSheetOpPrototype
import Path.Base.SetupSheetOpPrototype as PathSetupSheetOpPrototype
from PySide.QtCore import QT_TRANSLATE_NOOP
__title__ = "Setup Sheet for a Job."

View File

View File

@@ -23,8 +23,8 @@
import FreeCAD
import Path
import math
import Path.Base.Gui.Util as PathGuiUtil
import PathScripts.PathUtils as PathUtils
import PathScripts.PathGui as PathGui
from PySide.QtCore import QT_TRANSLATE_NOOP
if False:
@@ -168,7 +168,7 @@ class TaskPanel:
def __init__(self, obj):
self.obj = obj
self.form = FreeCADGui.PySideUic.loadUi(":/panels/AxisMapEdit.ui")
self.radius = PathGui.QuantitySpinBox(self.form.radius, obj, "Radius")
self.radius = PathGuiUtil.QuantitySpinBox(self.form.radius, obj, "Radius")
FreeCAD.ActiveDocument.openTransaction("Edit Dragknife Dress-up")
def reject(self):

View File

@@ -23,10 +23,10 @@
from __future__ import print_function
import FreeCAD
import Path
import Path.Base.Gui.Util as PathGuiUtil
from PySide import QtCore
import math
import PathScripts.PathUtils as PathUtils
import PathScripts.PathGui as PathGui
from PySide.QtCore import QT_TRANSLATE_NOOP
# lazily loaded modules
@@ -498,13 +498,13 @@ class TaskPanel:
def __init__(self, obj):
self.obj = obj
self.form = FreeCADGui.PySideUic.loadUi(":/panels/DragKnifeEdit.ui")
self.filterAngle = PathGui.QuantitySpinBox(
self.filterAngle = PathGuiUtil.QuantitySpinBox(
self.form.filterAngle, obj, "filterAngle"
)
self.offsetDistance = PathGui.QuantitySpinBox(
self.offsetDistance = PathGuiUtil.QuantitySpinBox(
self.form.offsetDistance, obj, "offset"
)
self.pivotHeight = PathGui.QuantitySpinBox(
self.pivotHeight = PathGuiUtil.QuantitySpinBox(
self.form.pivotHeight, obj, "pivotheight"
)

View File

@@ -26,7 +26,7 @@ import FreeCAD
import FreeCADGui
import Path
import Path.Dressup.PathBoundary as PathDressupPathBoundary
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathGui
if False:
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())

View File

@@ -23,7 +23,6 @@
import FreeCAD
import Path
import Path.Dressup.Gui.Preferences as PathPreferencesPathDressup
import PathScripts.PathPreferences as PathPreferences
if False:
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
@@ -43,7 +42,7 @@ class HoldingTagPreferences:
@classmethod
def defaultWidth(cls, ifNotSet):
value = PathPreferences.preferences().GetFloat(
value = Path.Preferences.preferences().GetFloat(
cls.DefaultHoldingTagWidth, ifNotSet
)
if value == 0.0:
@@ -52,7 +51,7 @@ class HoldingTagPreferences:
@classmethod
def defaultHeight(cls, ifNotSet):
value = PathPreferences.preferences().GetFloat(
value = Path.Preferences.preferences().GetFloat(
cls.DefaultHoldingTagHeight, ifNotSet
)
if value == 0.0:
@@ -61,7 +60,7 @@ class HoldingTagPreferences:
@classmethod
def defaultAngle(cls, ifNotSet=45.0):
value = PathPreferences.preferences().GetFloat(
value = Path.Preferences.preferences().GetFloat(
cls.DefaultHoldingTagAngle, ifNotSet
)
if value < 10.0:
@@ -70,7 +69,7 @@ class HoldingTagPreferences:
@classmethod
def defaultCount(cls, ifNotSet=4):
value = PathPreferences.preferences().GetUnsigned(
value = Path.Preferences.preferences().GetUnsigned(
cls.DefaultHoldingTagCount, ifNotSet
)
if value < 2:
@@ -79,7 +78,7 @@ class HoldingTagPreferences:
@classmethod
def defaultRadius(cls, ifNotSet=0.0):
return PathPreferences.preferences().GetFloat(
return Path.Preferences.preferences().GetFloat(
cls.DefaultHoldingTagRadius, ifNotSet
)
@@ -112,7 +111,7 @@ class HoldingTagPreferences:
self.form.sbCount.setValue(self.defaultCount())
def saveSettings(self):
pref = PathPreferences.preferences()
pref = Path.Preferences.preferences()
pref.SetFloat(
self.DefaultHoldingTagWidth,
FreeCAD.Units.Quantity(self.form.ifWidth.text()).Value,

View File

@@ -26,10 +26,9 @@ from pivy import coin
import FreeCAD
import FreeCADGui
import Path
import Path.Base.Gui.GetPoint as PathGetPoint
import Path.Dressup.Tags as PathDressupTag
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathScripts.PathGetPoint as PathGetPoint
import PathScripts.PathPreferences as PathPreferences
import PathGui
import PathScripts.PathUtils as PathUtils
@@ -394,7 +393,7 @@ class PathDressupTagViewProvider:
v = [((val >> n) & 0xFF) / 255.0 for n in [24, 16, 8, 0]]
return coin.SbColor(v[0], v[1], v[2])
pref = PathPreferences.preferences()
pref = Path.Preferences.preferences()
# R G B A
npc = pref.GetUnsigned(
"DefaultPathMarkerColor", ((85 * 256 + 255) * 256 + 0) * 256 + 255

View File

@@ -38,7 +38,8 @@ def Startup():
global Processed
if not Processed:
Path.Log.debug("Initializing PathGui")
from Path.Op.Gui import Adaptive
from Path.Base.Gui import PropertyBag
from Path.Base.Gui import PathSetupSheetGui
from Path.Dressup.Gui import AxisMap
from Path.Dressup.Gui import Dogbone
from Path.Dressup.Gui import Dragknife
@@ -47,6 +48,7 @@ def Startup():
from Path.Dressup.Gui import RampEntry
from Path.Dressup.Gui import Tags
from Path.Dressup.Gui import ZCorrect
from Path.Op.Gui import Adaptive
from Path.Op.Gui import Custom
from Path.Op.Gui import Deburr
from Path.Op.Gui import Drilling
@@ -68,9 +70,7 @@ def Startup():
from PathScripts import PathFixture
from PathScripts import PathHop
from PathScripts import PathInspect
from PathScripts import PathPropertyBagGui
from PathScripts import PathSanity
from PathScripts import PathSetupSheetGui
from PathScripts import PathSimpleCopy
from PathScripts import PathSimulatorGui
from PathScripts import PathStop

View File

@@ -25,7 +25,6 @@ from PathScripts.PathUtils import waiting_effects
from PySide.QtCore import QT_TRANSLATE_NOOP
import Path
import Path.Base.Util as PathUtil
import PathScripts.PathPreferences as PathPreferences
import PathScripts.PathUtils as PathUtils
import math
import time
@@ -844,7 +843,7 @@ class ObjectOp(object):
if (
hFeedrate == 0 or vFeedrate == 0
) and not PathPreferences.suppressAllSpeedsWarning():
) and not Path.Preferences.suppressAllSpeedsWarning():
Path.Log.warning(
translate(
"Path",
@@ -855,7 +854,7 @@ class ObjectOp(object):
if (
hRapidrate == 0 or vRapidrate == 0
) and not PathPreferences.suppressRapidSpeedsWarning():
) and not Path.Preferences.suppressRapidSpeedsWarning():
Path.Log.warning(
translate(
"Path",

View File

@@ -23,15 +23,14 @@
import FreeCAD
import FreeCADGui
import Path
import Path.Base.Gui.GetPoint as PathGetPoint
import Path.Base.Gui.Util as PathGuiUtil
import Path.Base.SetupSheet as PathSetupSheet
import Path.Base.Util as PathUtil
import Path.Op.Base as PathOp
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathScripts.PathGetPoint as PathGetPoint
import PathScripts.PathGui as PathGui
import PathGui
import PathScripts.PathJob as PathJob
import PathScripts.PathPreferences as PathPreferences
import PathScripts.PathSelection as PathSelection
import PathScripts.PathSetupSheet as PathSetupSheet
import PathScripts.PathUtils as PathUtils
import importlib
from PySide.QtCore import QT_TRANSLATE_NOOP
@@ -375,8 +374,8 @@ class TaskPanelPage(object):
return
def populateCombobox(self, form, enumTups, comboBoxesPropertyMap):
"""populateCombobox(form, enumTups, comboBoxesPropertyMap) ... proxy for PathGui.populateCombobox()"""
PathGui.populateCombobox(form, enumTups, comboBoxesPropertyMap)
"""populateCombobox(form, enumTups, comboBoxesPropertyMap) ... proxy for PathGuiUtil.populateCombobox()"""
PathGuiUtil.populateCombobox(form, enumTups, comboBoxesPropertyMap)
def resetToolController(self, job, tc):
if self.obj is not None:
@@ -823,10 +822,10 @@ class TaskPanelHeightsPage(TaskPanelPage):
return FreeCADGui.PySideUic.loadUi(":/panels/PageHeightsEdit.ui")
def initPage(self, obj):
self.safeHeight = PathGui.QuantitySpinBox(
self.safeHeight = PathGuiUtil.QuantitySpinBox(
self.form.safeHeight, obj, "SafeHeight"
)
self.clearanceHeight = PathGui.QuantitySpinBox(
self.clearanceHeight = PathGuiUtil.QuantitySpinBox(
self.form.clearanceHeight, obj, "ClearanceHeight"
)
@@ -891,7 +890,7 @@ class TaskPanelDepthsPage(TaskPanelPage):
def initPage(self, obj):
if self.haveStartDepth():
self.startDepth = PathGui.QuantitySpinBox(
self.startDepth = PathGuiUtil.QuantitySpinBox(
self.form.startDepth, obj, "StartDepth"
)
else:
@@ -900,7 +899,7 @@ class TaskPanelDepthsPage(TaskPanelPage):
self.form.startDepthSet.hide()
if self.haveFinalDepth():
self.finalDepth = PathGui.QuantitySpinBox(
self.finalDepth = PathGuiUtil.QuantitySpinBox(
self.form.finalDepth, obj, "FinalDepth"
)
else:
@@ -918,13 +917,13 @@ class TaskPanelDepthsPage(TaskPanelPage):
self.form.finalDepthSet.hide()
if self.haveStepDown():
self.stepDown = PathGui.QuantitySpinBox(self.form.stepDown, obj, "StepDown")
self.stepDown = PathGuiUtil.QuantitySpinBox(self.form.stepDown, obj, "StepDown")
else:
self.form.stepDown.hide()
self.form.stepDownLabel.hide()
if self.haveFinishDepth():
self.finishDepth = PathGui.QuantitySpinBox(
self.finishDepth = PathGuiUtil.QuantitySpinBox(
self.form.finishDepth, obj, "FinishDepth"
)
else:
@@ -1029,10 +1028,10 @@ class TaskPanelDiametersPage(TaskPanelPage):
return FreeCADGui.PySideUic.loadUi(":/panels/PageDiametersEdit.ui")
def initPage(self, obj):
self.minDiameter = PathGui.QuantitySpinBox(
self.minDiameter = PathGuiUtil.QuantitySpinBox(
self.form.minDiameter, obj, "MinDiameter"
)
self.maxDiameter = PathGui.QuantitySpinBox(
self.maxDiameter = PathGuiUtil.QuantitySpinBox(
self.form.maxDiameter, obj, "MaxDiameter"
)
@@ -1132,7 +1131,7 @@ class TaskPanel(object):
page.initPage(obj)
page.onDirtyChanged(self.pageDirtyChanged)
taskPanelLayout = PathPreferences.defaultTaskPanelLayout()
taskPanelLayout = Path.Preferences.defaultTaskPanelLayout()
if taskPanelLayout < 2:
opTitle = opPage.getTitle(obj)

View File

@@ -24,7 +24,7 @@ import FreeCAD
import FreeCADGui
import Path
import Path.Op.Gui.Base as PathOpGui
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathGui
from PySide import QtCore, QtGui

View File

@@ -23,9 +23,9 @@
import FreeCAD
import FreeCADGui
import Path
import Path.Base.Gui.Util as PathGuiUtil
import Path.Op.Deburr as PathDeburr
import Path.Op.Gui.Base as PathOpGui
import PathScripts.PathGui as PathGui
from PySide import QtCore, QtGui
from PySide.QtCore import QT_TRANSLATE_NOOP
@@ -83,8 +83,8 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
self.form.joinRound.setIcon(iconRound)
def getFields(self, obj):
PathGui.updateInputField(obj, "Width", self.form.value_W)
PathGui.updateInputField(obj, "ExtraDepth", self.form.value_h)
PathGuiUtil.updateInputField(obj, "Width", self.form.value_W)
PathGuiUtil.updateInputField(obj, "ExtraDepth", self.form.value_h)
if self.form.joinRound.isChecked():
obj.Join = "Round"
elif self.form.joinMiter.isChecked():
@@ -113,10 +113,10 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
self.selectInComboBox(obj.Direction, self.form.direction)
def updateWidth(self):
PathGui.updateInputField(self.obj, "Width", self.form.value_W)
PathGuiUtil.updateInputField(self.obj, "Width", self.form.value_W)
def updateExtraDepth(self):
PathGui.updateInputField(self.obj, "ExtraDepth", self.form.value_h)
PathGuiUtil.updateInputField(self.obj, "ExtraDepth", self.form.value_h)
def getSignalsForUpdate(self, obj):
signals = []

View File

@@ -23,11 +23,11 @@
import FreeCAD
import FreeCADGui
import Path
import Path.Base.Gui.Util as PathGuiUtil
import Path.Op.Drilling as PathDrilling
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Gui.CircularHoleBase as PathCircularHoleBaseGui
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathScripts.PathGui as PathGui
import PathGui
from PySide import QtCore
@@ -48,13 +48,13 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
"""Controller for the drilling operation's page"""
def initPage(self, obj):
self.peckDepthSpinBox = PathGui.QuantitySpinBox(
self.peckDepthSpinBox = PathGuiUtil.QuantitySpinBox(
self.form.peckDepth, obj, "PeckDepth"
)
self.peckRetractSpinBox = PathGui.QuantitySpinBox(
self.peckRetractSpinBox = PathGuiUtil.QuantitySpinBox(
self.form.peckRetractHeight, obj, "RetractHeight"
)
self.dwellTimeSpinBox = PathGui.QuantitySpinBox(
self.dwellTimeSpinBox = PathGuiUtil.QuantitySpinBox(
self.form.dwellTime, obj, "DwellTime"
)
self.form.chipBreakEnabled.setEnabled(False)

View File

@@ -25,7 +25,7 @@ import FreeCADGui
import Path
import Path.Op.Engrave as PathEngrave
import Path.Op.Gui.Base as PathOpGui
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathGui
import PathScripts.PathUtils as PathUtils
from PySide import QtCore, QtGui

View File

@@ -23,11 +23,11 @@
import FreeCAD
import FreeCADGui
import Path
import Path.Base.Gui.Util as PathGuiUtil
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Gui.CircularHoleBase as PathCircularHoleBaseGui
import Path.Op.Helix as PathHelix
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathScripts.PathGui as PathGui
import PathGui
from PySide.QtCore import QT_TRANSLATE_NOOP
translate = FreeCAD.Qt.translate
@@ -68,7 +68,7 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
obj.StartSide = str(self.form.startSide.currentData())
if obj.StepOver != self.form.stepOverPercent.value():
obj.StepOver = self.form.stepOverPercent.value()
PathGui.updateInputField(obj, "OffsetExtra", self.form.extraOffset)
PathGuiUtil.updateInputField(obj, "OffsetExtra", self.form.extraOffset)
self.updateToolController(obj, self.form.toolController)
self.updateCoolant(obj, self.form.coolantController)

View File

@@ -23,10 +23,10 @@
import FreeCAD
import FreeCADGui
import Path
import Path.Base.Gui.Util as PathGuiUtil
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Pocket as PathPocket
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathScripts.PathGui as PathGui
import PathGui
__title__ = "Path Pocket Base Operation UI"
__author__ = "sliptonic (Brad Collette)"
@@ -112,7 +112,7 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
self.form.zigZagAngle.setEnabled(True)
if setModel:
PathGui.updateInputField(obj, "ZigZagAngle", self.form.zigZagAngle)
PathGuiUtil.updateInputField(obj, "ZigZagAngle", self.form.zigZagAngle)
def getFields(self, obj):
"""getFields(obj) ... transfers values from UI to obj's proprties"""
@@ -123,7 +123,7 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
if obj.OffsetPattern != str(self.form.offsetPattern.currentData()):
obj.OffsetPattern = str(self.form.offsetPattern.currentData())
PathGui.updateInputField(obj, "ExtraOffset", self.form.extraOffset)
PathGuiUtil.updateInputField(obj, "ExtraOffset", self.form.extraOffset)
self.updateToolController(obj, self.form.toolController)
self.updateCoolant(obj, self.form.coolantController)
self.updateZigZagAngle(obj)

View File

@@ -23,10 +23,10 @@
import FreeCAD
import FreeCADGui
import Path
import Path.Base.Gui.Util as PathGuiUtil
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Probe as PathProbe
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathScripts.PathGui as PathGui
import PathGui
from PySide.QtCore import QT_TRANSLATE_NOOP
from PySide import QtCore, QtGui
@@ -56,8 +56,8 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
def getFields(self, obj):
"""getFields(obj) ... transfers values from UI to obj's proprties"""
self.updateToolController(obj, self.form.toolController)
PathGui.updateInputField(obj, "Xoffset", self.form.Xoffset)
PathGui.updateInputField(obj, "Yoffset", self.form.Yoffset)
PathGuiUtil.updateInputField(obj, "Xoffset", self.form.Xoffset)
PathGuiUtil.updateInputField(obj, "Yoffset", self.form.Yoffset)
obj.PointCountX = self.form.PointCountX.value()
obj.PointCountY = self.form.PointCountY.value()
obj.OutputFileName = str(self.form.OutputFileName.text())

View File

@@ -22,10 +22,10 @@
import FreeCAD
import FreeCADGui
import Path.Base.Gui.Util as PathGuiUtil
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Profile as PathProfile
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathScripts.PathGui as PathGui
import PathGui
from PySide.QtCore import QT_TRANSLATE_NOOP
@@ -76,7 +76,7 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
obj.Side = str(self.form.cutSide.currentData())
if obj.Direction != str(self.form.direction.currentData()):
obj.Direction = str(self.form.direction.currentData())
PathGui.updateInputField(obj, "OffsetExtra", self.form.extraOffset)
PathGuiUtil.updateInputField(obj, "OffsetExtra", self.form.extraOffset)
if obj.UseComp != self.form.useCompensation.isChecked():
obj.UseComp = self.form.useCompensation.isChecked()

View File

@@ -22,10 +22,10 @@
import FreeCAD
import FreeCADGui
import Path.Base.Gui.Util as PathGuiUtil
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Slot as PathSlot
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathScripts.PathGui as PathGui
import PathGui
from PySide import QtCore
@@ -62,10 +62,10 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
self.setTitle("Slot - " + obj.Label)
# retrieve property enumerations
# Requirements due to Gui::QuantitySpinBox class use in UI panel
self.geo1Extension = PathGui.QuantitySpinBox(
self.geo1Extension = PathGuiUtil.QuantitySpinBox(
self.form.geo1Extension, obj, "ExtendPathStart"
)
self.geo2Extension = PathGui.QuantitySpinBox(
self.geo2Extension = PathGuiUtil.QuantitySpinBox(
self.form.geo2Extension, obj, "ExtendPathEnd"
)

View File

@@ -24,10 +24,10 @@ from PySide import QtCore
import FreeCAD
import FreeCADGui
import Path
import Path.Base.Gui.Util as PathGuiUtil
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Surface as PathSurface
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathScripts.PathGui as PathGui
import PathGui
__title__ = "Path Surface Operation UI"
@@ -66,7 +66,7 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
("dropCutterDirSelect", "DropCutterDir"),
]
enumTups = PathSurface.ObjectSurface.propertyEnumerations(dataType="raw")
PathGui.populateCombobox(form, enumTups, comboToPropertyMap)
PathGuiUtil.populateCombobox(form, enumTups, comboToPropertyMap)
return form
@@ -120,12 +120,12 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
if obj.DropCutterDir != str(self.form.dropCutterDirSelect.currentData()):
obj.DropCutterDir = str(self.form.dropCutterDirSelect.currentData())
PathGui.updateInputField(obj, "DepthOffset", self.form.depthOffset)
PathGuiUtil.updateInputField(obj, "DepthOffset", self.form.depthOffset)
if obj.StepOver != self.form.stepOver.value():
obj.StepOver = self.form.stepOver.value()
PathGui.updateInputField(obj, "SampleInterval", self.form.sampleInterval)
PathGuiUtil.updateInputField(obj, "SampleInterval", self.form.sampleInterval)
if obj.UseStartPoint != self.form.useStartPoint.isChecked():
obj.UseStartPoint = self.form.useStartPoint.isChecked()

View File

@@ -23,11 +23,11 @@
import FreeCAD
import FreeCADGui
import Path
import Path.Base.Gui.Util as PathGuiUtil
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Gui.CircularHoleBase as PathCircularHoleBaseGui
import Path.Op.ThreadMilling as PathThreadMilling
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathScripts.PathGui as PathGui
import PathGui
import csv
from PySide.QtCore import QT_TRANSLATE_NOOP
@@ -72,13 +72,13 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
"""Controller for the thread milling operation's page"""
def initPage(self, obj):
self.majorDia = PathGui.QuantitySpinBox(
self.majorDia = PathGuiUtil.QuantitySpinBox(
self.form.threadMajor, obj, "MajorDiameter"
)
self.minorDia = PathGui.QuantitySpinBox(
self.minorDia = PathGuiUtil.QuantitySpinBox(
self.form.threadMinor, obj, "MinorDiameter"
)
self.pitch = PathGui.QuantitySpinBox(self.form.threadPitch, obj, "Pitch")
self.pitch = PathGuiUtil.QuantitySpinBox(self.form.threadPitch, obj, "Pitch")
def getForm(self):
"""getForm() ... return UI"""

View File

@@ -25,7 +25,7 @@ import FreeCADGui
import Path
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Vcarve as PathVcarve
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathGui
import PathScripts.PathUtils as PathUtils
from PySide import QtCore, QtGui

View File

@@ -26,9 +26,9 @@ from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCAD
import FreeCADGui
import Path
import Path.Base.Gui.Util as PathGuiUtil
import Path.Op.Gui.Base as PathOpGui
import Path.Op.Waterline as PathWaterline
import PathScripts.PathGui as PathGui
__title__ = "Path Waterline Operation UI"
__author__ = "sliptonic (Brad Collette), russ4262 (Russell Johnson)"
@@ -61,7 +61,7 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
("cutPattern", "CutPattern"),
]
enumTups = PathWaterline.ObjectWaterline.propertyEnumerations(dataType="raw")
PathGui.populateCombobox(form, enumTups, comboToPropertyMap)
PathGuiUtil.populateCombobox(form, enumTups, comboToPropertyMap)
return form
def getFields(self, obj):
@@ -81,14 +81,14 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
if obj.CutPattern != str(self.form.cutPattern.currentData()):
obj.CutPattern = str(self.form.cutPattern.currentData())
PathGui.updateInputField(
PathGuiUtil.updateInputField(
obj, "BoundaryAdjustment", self.form.boundaryAdjustment
)
if obj.StepOver != self.form.stepOver.value():
obj.StepOver = self.form.stepOver.value()
PathGui.updateInputField(obj, "SampleInterval", self.form.sampleInterval)
PathGuiUtil.updateInputField(obj, "SampleInterval", self.form.sampleInterval)
if obj.OptimizeLinearPaths != self.form.optimizeEnabled.isChecked():
obj.OptimizeLinearPaths = self.form.optimizeEnabled.isChecked()

View File

@@ -26,7 +26,6 @@ import Path
import Path.Op.Base as PathOp
import Path.Op.EngraveBase as PathEngraveBase
import PathScripts.PathUtils as PathUtils
import PathScripts.PathPreferences as PathPreferences
import math
from PySide.QtCore import QT_TRANSLATE_NOOP
@@ -244,7 +243,7 @@ class ObjectVcarve(PathEngraveBase.ObjectOp):
)
obj.Colinear = 10.0
obj.Discretize = 0.01
obj.Tolerance = PathPreferences.defaultGeometryTolerance()
obj.Tolerance = Path.Preferences.defaultGeometryTolerance()
self.setupAdditionalProperties(obj)
def opOnDocumentRestored(self, obj):

View File

@@ -871,15 +871,13 @@ class ObjectWaterline(PathOp.ObjectOp):
useDGT = True
except AttributeError as ee:
Path.Log.warning(
"{}\nPlease set Job.GeometryTolerance to an acceptable value. Using PathPreferences.defaultGeometryTolerance().".format(
"{}\nPlease set Job.GeometryTolerance to an acceptable value. Using Path.Preferences.defaultGeometryTolerance().".format(
ee
)
)
useDGT = True
if useDGT:
import PathScripts.PathPreferences as PathPreferences
self.geoTlrnc = PathPreferences.defaultGeometryTolerance()
self.geoTlrnc = Path.Preferences.defaultGeometryTolerance()
# Calculate default depthparams for operation
self.depthParams = PathUtils.depth_params(

View File

@@ -29,7 +29,6 @@ import FreeCADGui
import Path
import Path.Base.Util as PathUtil
import PathScripts.PathJob as PathJob
import PathScripts.PathPreferences as PathPreferences
import PathScripts.PathUtils as PathUtils
import os
import re
@@ -160,7 +159,7 @@ def resolveFileName(job, subpartname, sequencenumber):
validFilenameSubstitutions = ["j", "d", "T", "t", "W", "O", "S"]
# Look for preference default
outputpath, filename = os.path.split(PathPreferences.defaultOutputFile())
outputpath, filename = os.path.split(Path.Preferences.defaultOutputFile())
filename, ext = os.path.splitext(filename)
# Override with document default if it exists
@@ -209,7 +208,7 @@ def resolveFileName(job, subpartname, sequencenumber):
)
# This section determines whether user interaction is necessary
policy = PathPreferences.defaultOutputPolicy()
policy = Path.Preferences.defaultOutputPolicy()
openDialog = policy == "Open File Dialog"
# if os.path.isdir(filename) or not os.path.isdir(os.path.dirname(filename)):
@@ -427,7 +426,7 @@ class DlgSelectPostProcessor:
def __init__(self, parent=None):
self.dialog = FreeCADGui.PySideUic.loadUi(":/panels/DlgSelectPostProcessor.ui")
firstItem = None
for post in PathPreferences.allEnabledPostProcessors():
for post in Path.Preferences.allEnabledPostProcessors():
item = QtGui.QListWidgetItem(post)
item.setFlags(
QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled
@@ -465,7 +464,7 @@ class CommandPathPost:
def resolvePostProcessor(self, job):
if hasattr(job, "PostProcessor"):
post = PathPreferences.defaultPostProcessor()
post = Path.Preferences.defaultPostProcessor()
if job.PostProcessor:
post = job.PostProcessor
if post and PostProcessor.exists(post):
@@ -502,7 +501,7 @@ class CommandPathPost:
# slist = objs[1]
Path.Log.track(objs, partname)
postArgs = PathPreferences.defaultPostProcessorArgs()
postArgs = Path.Preferences.defaultPostProcessorArgs()
if hasattr(job, "PostProcessorArgs") and job.PostProcessorArgs:
postArgs = job.PostProcessorArgs
elif hasattr(job, "PostProcessor") and job.PostProcessor:

View File

@@ -21,7 +21,6 @@
# ***************************************************************************
import Path
import PathScripts.PathPreferences as PathPreferences
import sys
Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
@@ -30,13 +29,13 @@ Path.Log.setLevel(Path.Log.Level.INFO, Path.Log.thisModule())
class PostProcessor:
@classmethod
def exists(cls, processor):
return processor in PathPreferences.allAvailablePostProcessors()
return processor in Path.Preferences.allAvailablePostProcessors()
@classmethod
def load(cls, processor):
Path.Log.track(processor)
syspath = sys.path
paths = PathPreferences.searchPathsPost()
paths = Path.Preferences.searchPathsPost()
paths.extend(sys.path)
sys.path = paths

View File

@@ -24,7 +24,6 @@ import FreeCAD
import Path
import glob
import os
from PySide.QtGui import QMessageBox
if False:
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())

View File

@@ -24,7 +24,6 @@ import FreeCAD
import Path
import Path.Base.Util as PathUtil
import Path.Base.PropertyBag as PathPropertyBag
import PathScripts.PathPreferences as PathPreferences
import json
import os
import zipfile
@@ -62,7 +61,7 @@ def _findToolFile(name, containerFile, typ):
paths = [os.path.join(rootPath, typ)]
else:
paths = []
paths.extend(PathPreferences.searchPathsTool(typ))
paths.extend(Path.Preferences.searchPathsTool(typ))
def _findFile(path, name):
Path.Log.track(path, name)
@@ -109,7 +108,7 @@ def findToolLibrary(name, path=None):
def _findRelativePath(path, typ):
Path.Log.track(path, typ)
relative = path
for p in PathPreferences.searchPathsTool(typ):
for p in Path.Preferences.searchPathsTool(typ):
if path.startswith(p):
p = path[len(p) :]
if os.path.sep == p[0]:
@@ -447,7 +446,7 @@ class ToolBit(object):
attrs = {}
attrs["version"] = 2
attrs["name"] = obj.Label
if PathPreferences.toolsStoreAbsolutePaths():
if Path.Preferences.toolsStoreAbsolutePaths():
attrs["shape"] = obj.BitShape
else:
# attrs['shape'] = findRelativePathShape(obj.BitShape)

View File

@@ -26,7 +26,6 @@ from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCAD
import Path
import Path.Tool.Bit as PathToolBit
import PathScripts.PathPreferences as PathPreferences
from Generators import toolchange_generator as toolchange_generator
from Generators.toolchange_generator import SpindleDirection

View File

@@ -25,10 +25,9 @@ from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCAD
import FreeCADGui
import Path
import Path.Base.Gui.IconViewProvider as PathIconViewProvider
import Path.Tool.Bit as PathToolBit
import Path.Tool.Gui.BitEdit as PathToolBitEdit
import PathScripts.PathIconViewProvider as PathIconViewProvider
import PathScripts.PathPreferences as PathPreferences
import os
__title__ = "Tool Bit UI"
@@ -191,7 +190,7 @@ def GetNewToolFile(parent=None):
parent = QtGui.QApplication.activeWindow()
foo = QtGui.QFileDialog.getSaveFileName(
parent, "Tool", PathPreferences.lastPathToolBit(), "*.fctb"
parent, "Tool", Path.Preferences.lastPathToolBit(), "*.fctb"
)
if foo and foo[0]:
if not isValidFileName(foo[0]):
@@ -200,7 +199,7 @@ def GetNewToolFile(parent=None):
msgBox.setText(msg)
msgBox.exec_()
else:
PathPreferences.setLastPathToolBit(os.path.dirname(foo[0]))
Path.Preferences.setLastPathToolBit(os.path.dirname(foo[0]))
return foo[0]
return None
@@ -209,10 +208,10 @@ def GetToolFile(parent=None):
if parent is None:
parent = QtGui.QApplication.activeWindow()
foo = QtGui.QFileDialog.getOpenFileName(
parent, "Tool", PathPreferences.lastPathToolBit(), "*.fctb"
parent, "Tool", Path.Preferences.lastPathToolBit(), "*.fctb"
)
if foo and foo[0]:
PathPreferences.setLastPathToolBit(os.path.dirname(foo[0]))
Path.Preferences.setLastPathToolBit(os.path.dirname(foo[0]))
return foo[0]
return None
@@ -221,10 +220,10 @@ def GetToolFiles(parent=None):
if parent is None:
parent = QtGui.QApplication.activeWindow()
foo = QtGui.QFileDialog.getOpenFileNames(
parent, "Tool", PathPreferences.lastPathToolBit(), "*.fctb"
parent, "Tool", Path.Preferences.lastPathToolBit(), "*.fctb"
)
if foo and foo[0]:
PathPreferences.setLastPathToolBit(os.path.dirname(foo[0][0]))
Path.Preferences.setLastPathToolBit(os.path.dirname(foo[0][0]))
return foo[0]
return []
@@ -233,11 +232,11 @@ def GetToolShapeFile(parent=None):
if parent is None:
parent = QtGui.QApplication.activeWindow()
location = PathPreferences.lastPathToolShape()
location = Path.Preferences.lastPathToolShape()
if os.path.isfile(location):
location = os.path.split(location)[0]
elif not os.path.isdir(location):
location = PathPreferences.filePath()
location = Path.Preferences.filePath()
fname = QtGui.QFileDialog.getOpenFileName(
parent, "Select Tool Shape", location, "*.fcstd"
@@ -245,7 +244,7 @@ def GetToolShapeFile(parent=None):
if fname and fname[0]:
if fname != location:
newloc = os.path.dirname(fname[0])
PathPreferences.setLastPathToolShape(newloc)
Path.Preferences.setLastPathToolShape(newloc)
return fname[0]
else:
return None

View File

@@ -108,7 +108,7 @@ class CommandToolBitSave:
fname = tool.File
else:
fname = os.path.join(
PathScripts.PathPreferences.lastPathToolBit(),
Path.Preferences.lastPathToolBit(),
tool.Label + ".fctb",
)
foo = QtGui.QFileDialog.getSaveFileName(
@@ -123,7 +123,7 @@ class CommandToolBitSave:
if not path.endswith(".fctb"):
path += ".fctb"
tool.Proxy.saveToFile(tool, path)
PathScripts.PathPreferences.setLastPathToolBit(os.path.dirname(path))
Path.Preferences.setLastPathToolBit(os.path.dirname(path))
class CommandToolBitLoad:

View File

@@ -23,10 +23,9 @@
from PySide import QtCore, QtGui
import FreeCADGui
import Path
import Path.Base.Gui.Util as PathGuiUtil
import Path.Base.PropertyEditor as PathPropertyEditor
import Path.Base.Util as PathUtil
import PathScripts.PathGui as PathGui
import PathScripts.PathPreferences as PathPreferences
import PathScripts.PathPropertyEditor as PathPropertyEditor
import os
import re
@@ -128,7 +127,7 @@ class ToolBitEditor(object):
qsb.show()
else:
qsb = ui.createWidget("Gui::QuantitySpinBox")
editor = PathGui.QuantitySpinBox(qsb, tool, name)
editor = PathGuiUtil.QuantitySpinBox(qsb, tool, name)
label = QtGui.QLabel(labelText(name))
self.widgets.append((label, qsb, editor))
Path.Log.debug("create row: {} [{}] {}".format(nr, name, type(qsb)))
@@ -262,12 +261,12 @@ class ToolBitEditor(object):
Path.Log.track()
path = self.tool.BitShape
if not path:
path = PathPreferences.lastPathToolShape()
path = Path.Preferences.lastPathToolShape()
foo = QtGui.QFileDialog.getOpenFileName(
self.form, "Path - Tool Shape", path, "*.fcstd"
)
if foo and foo[0]:
PathPreferences.setLastPathToolShape(os.path.dirname(foo[0]))
Path.Preferences.setLastPathToolShape(os.path.dirname(foo[0]))
self.form.shapePath.setText(foo[0])
self.updateShape()

View File

@@ -29,8 +29,7 @@ import Path.Tool.Bit as PathToolBit
import Path.Tool.Gui.Bit as PathToolBitGui
import Path.Tool.Gui.BitEdit as PathToolBitEdit
import Path.Tool.Gui.Controller as PathToolControllerGui
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathScripts.PathPreferences as PathPreferences
import PathGui
import PathScripts.PathUtilsGui as PathUtilsGui
import PySide
import glob
@@ -61,8 +60,8 @@ def checkWorkingDir():
# working directory should be writable
Path.Log.track()
workingdir = os.path.dirname(PathPreferences.lastPathToolLibrary())
defaultdir = os.path.dirname(PathPreferences.pathDefaultToolsPath())
workingdir = os.path.dirname(Path.Preferences.lastPathToolLibrary())
defaultdir = os.path.dirname(Path.Preferences.pathDefaultToolsPath())
Path.Log.debug("workingdir: {} defaultdir: {}".format(workingdir, defaultdir))
@@ -85,16 +84,16 @@ def checkWorkingDir():
msg = translate("Path_ToolBit", "Choose a writable location for your toolbits")
while not dirOK():
workingdir = PySide.QtGui.QFileDialog.getExistingDirectory(
None, msg, PathPreferences.filePath()
None, msg, Path.Preferences.filePath()
)
if workingdir[-8:] == os.path.sep + "Library":
workingdir = workingdir[:-8] # trim off trailing /Library if user chose it
PathPreferences.setLastPathToolLibrary(
Path.Preferences.setLastPathToolLibrary(
"{}{}Library".format(workingdir, os.path.sep)
)
PathPreferences.setLastPathToolBit("{}{}Bit".format(workingdir, os.path.sep))
Path.Preferences.setLastPathToolBit("{}{}Bit".format(workingdir, os.path.sep))
Path.Log.debug("setting workingdir to: {}".format(workingdir))
# Copy only files of default Path/Tool folder to working directory (targeting the README.md help file)
@@ -154,14 +153,14 @@ def checkWorkingDir():
shutil.copy(full_file_name, subdir)
# if no library is set, choose the first one in the Library directory
if PathPreferences.lastFileToolLibrary() is None:
if Path.Preferences.lastFileToolLibrary() is None:
libFiles = [
f
for f in glob.glob(
PathPreferences.lastPathToolLibrary() + os.path.sep + "*.fctl"
Path.Preferences.lastPathToolLibrary() + os.path.sep + "*.fctl"
)
]
PathPreferences.setLastFileToolLibrary(libFiles[0])
Path.Preferences.setLastFileToolLibrary(libFiles[0])
return True
@@ -251,7 +250,7 @@ class ModelFactory(object):
def __libraryLoad(self, path, datamodel):
Path.Log.track(path)
PathPreferences.setLastFileToolLibrary(path)
Path.Preferences.setLastFileToolLibrary(path)
# self.currenLib = path
with open(path) as fp:
@@ -321,7 +320,7 @@ class ModelFactory(object):
Returns a QStandardItemModel
"""
Path.Log.track()
path = PathPreferences.lastPathToolLibrary()
path = Path.Preferences.lastPathToolLibrary()
if os.path.isdir(path): # opening all tables in a directory
libFiles = [f for f in glob.glob(path + os.path.sep + "*.fctl")]
@@ -346,7 +345,7 @@ class ModelFactory(object):
Path.Log.track(lib)
if lib == "":
lib = PathPreferences.lastFileToolLibrary()
lib = Path.Preferences.lastFileToolLibrary()
if lib == "" or lib is None:
return model
@@ -373,7 +372,7 @@ class ToolBitSelector(object):
return ["#", "Tool"]
def currentLibrary(self, shortNameOnly):
libfile = PathPreferences.lastFileToolLibrary()
libfile = Path.Preferences.lastFileToolLibrary()
if libfile is None or libfile == "":
return ""
elif shortNameOnly:
@@ -578,12 +577,12 @@ class ToolBitLibrary(object):
def libraryPath(self):
Path.Log.track()
path = PySide.QtGui.QFileDialog.getExistingDirectory(
self.form, "Tool Library Path", PathPreferences.lastPathToolLibrary()
self.form, "Tool Library Path", Path.Preferences.lastPathToolLibrary()
)
if len(path) == 0:
return
PathPreferences.setLastPathToolLibrary(path)
Path.Preferences.setLastPathToolLibrary(path)
self.loadData()
def cleanupDocument(self):
@@ -669,7 +668,7 @@ class ToolBitLibrary(object):
filename = PySide.QtGui.QFileDialog.getSaveFileName(
self.form,
translate("Path_ToolBit", "Save toolbit library"),
PathPreferences.lastPathToolLibrary(),
Path.Preferences.lastPathToolLibrary(),
"{}".format(TooltableTypeJSON),
)
@@ -700,7 +699,7 @@ class ToolBitLibrary(object):
self.toolModel.index(row, 0), PySide.QtCore.Qt.EditRole
)
toolPath = self.toolModel.data(self.toolModel.index(row, 0), _PathRole)
if PathPreferences.toolsStoreAbsolutePaths():
if Path.Preferences.toolsStoreAbsolutePaths():
bitPath = toolPath
else:
# bitPath = PathToolBit.findRelativePathTool(toolPath)
@@ -720,8 +719,8 @@ class ToolBitLibrary(object):
self.form.close()
def libPaths(self):
lib = PathPreferences.lastFileToolLibrary()
loc = PathPreferences.lastPathToolLibrary()
lib = Path.Preferences.lastFileToolLibrary()
loc = Path.Preferences.lastPathToolLibrary()
Path.Log.track("lib: {} loc: {}".format(lib, loc))
return lib, loc
@@ -747,7 +746,7 @@ class ToolBitLibrary(object):
self.factory.libraryOpen(self.toolModel, lib=path)
self.path = path
self.form.setWindowTitle("{}".format(PathPreferences.lastPathToolLibrary()))
self.form.setWindowTitle("{}".format(Path.Preferences.lastPathToolLibrary()))
self.toolModel.setHorizontalHeaderLabels(self.columnNames())
self.listModel.setHorizontalHeaderLabels(["Library"])
@@ -799,7 +798,7 @@ class ToolBitLibrary(object):
filename = PySide.QtGui.QFileDialog.getSaveFileName(
self.form,
translate("Path_ToolBit", "Save toolbit library"),
PathPreferences.lastPathToolLibrary(),
Path.Preferences.lastPathToolLibrary(),
"{};;{};;{}".format(
TooltableTypeJSON, TooltableTypeLinuxCNC, TooltableTypeCamotics
),

View File

@@ -25,11 +25,11 @@ from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCAD
import FreeCADGui
import Path
import Path.Base.Gui.Util as PathGuiUtil
import Path.Base.Util as PathUtil
import Path.Tool.Controller as PathToolController
import Path.Tool.Gui.Bit as PathToolBitGui
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathScripts.PathGui as PathGui
import PathGui
# lazily loaded modules
from lazy_loader.lazy_loader import LazyLoader
@@ -188,11 +188,11 @@ class ToolControllerEditor(object):
dataType="raw"
)
PathGui.populateCombobox(self.form, enumTups, comboToPropertyMap)
self.vertFeed = PathGui.QuantitySpinBox(self.form.vertFeed, obj, "VertFeed")
self.horizFeed = PathGui.QuantitySpinBox(self.form.horizFeed, obj, "HorizFeed")
self.vertRapid = PathGui.QuantitySpinBox(self.form.vertRapid, obj, "VertRapid")
self.horizRapid = PathGui.QuantitySpinBox(
PathGuiUtil.populateCombobox(self.form, enumTups, comboToPropertyMap)
self.vertFeed = PathGuiUtil.QuantitySpinBox(self.form.vertFeed, obj, "VertFeed")
self.horizFeed = PathGuiUtil.QuantitySpinBox(self.form.horizFeed, obj, "HorizFeed")
self.vertRapid = PathGuiUtil.QuantitySpinBox(self.form.vertRapid, obj, "VertRapid")
self.horizRapid = PathGuiUtil.QuantitySpinBox(
self.form.horizRapid, obj, "HorizRapid"
)

View File

@@ -2,3 +2,4 @@ from PathApp import *
import Path.Log as Log
import Path.Geom as Geom
import Path.Preferences as Preferences

View File

@@ -25,9 +25,9 @@ from pivy import coin
import FreeCAD
import FreeCADGui
import Path
import Path.Base.Gui.Util as PathGuiUtil
import Path.Op.Gui.Base as PathOpGui
import PathScripts.PathFeatureExtensions as FeatureExtensions
import PathScripts.PathGui as PathGui
# lazily loaded modules
from lazy_loader.lazy_loader import LazyLoader
@@ -197,7 +197,7 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
self.extensions = list()
self.defaultLength = PathGui.QuantitySpinBox(
self.defaultLength = PathGuiUtil.QuantitySpinBox(
self.form.defaultLength, obj, "ExtensionLengthDefault"
)

View File

@@ -24,11 +24,10 @@ from PySide import QtCore
from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCAD
import Path
import Path.Base.SetupSheet as PathSetupSheet
import Path.Base.Util as PathUtil
from Path.Post.Processor import PostProcessor
import Path.Tool.Controller as PathToolController
import PathScripts.PathPreferences as PathPreferences
import PathScripts.PathSetupSheet as PathSetupSheet
import PathScripts.PathStock as PathStock
import json
import time
@@ -83,9 +82,9 @@ def createResourceClone(obj, orig, name, icon):
clone.addProperty("App::PropertyString", "PathResource")
clone.PathResource = name
if clone.ViewObject:
import PathScripts.PathIconViewProvider
import Path.Base.Gui.IconViewProvider
PathScripts.PathIconViewProvider.Attach(clone.ViewObject, icon)
Path.Base.Gui.IconViewProvider.Attach(clone.ViewObject, icon)
clone.ViewObject.Visibility = False
clone.ViewObject.Transparency = 80
obj.Document.recompute() # necessary to create the clone shape
@@ -223,16 +222,16 @@ class ObjectJob:
for n in self.propertyEnumerations():
setattr(obj, n[0], n[1])
obj.PostProcessorOutputFile = PathPreferences.defaultOutputFile()
obj.PostProcessor = postProcessors = PathPreferences.allEnabledPostProcessors()
defaultPostProcessor = PathPreferences.defaultPostProcessor()
obj.PostProcessorOutputFile = Path.Preferences.defaultOutputFile()
obj.PostProcessor = postProcessors = Path.Preferences.allEnabledPostProcessors()
defaultPostProcessor = Path.Preferences.defaultPostProcessor()
# Check to see if default post processor hasn't been 'lost' (This can happen when Macro dir has changed)
if defaultPostProcessor in postProcessors:
obj.PostProcessor = defaultPostProcessor
else:
obj.PostProcessor = postProcessors[0]
obj.PostProcessorArgs = PathPreferences.defaultPostProcessorArgs()
obj.GeometryTolerance = PathPreferences.defaultGeometryTolerance()
obj.PostProcessorArgs = Path.Preferences.defaultPostProcessorArgs()
obj.GeometryTolerance = Path.Preferences.defaultGeometryTolerance()
self.setupOperations(obj)
self.setupSetupSheet(obj)
@@ -307,9 +306,9 @@ class ObjectJob:
)
obj.SetupSheet = PathSetupSheet.Create()
if obj.SetupSheet.ViewObject:
import PathScripts.PathIconViewProvider
import Path.Base.Gui.IconViewProvider
PathScripts.PathIconViewProvider.Attach(
Path.Base.Gui.IconViewProvider.Attach(
obj.SetupSheet.ViewObject, "SetupSheet"
)
obj.SetupSheet.Label = "SetupSheet"
@@ -383,7 +382,7 @@ class ObjectJob:
def setupStock(self, obj):
"""setupStock(obj)... setup the Stock for the Job object."""
if not obj.Stock:
stockTemplate = PathPreferences.defaultStockTemplate()
stockTemplate = Path.Preferences.defaultStockTemplate()
if stockTemplate:
obj.Stock = PathStock.CreateFromTemplate(obj, json.loads(stockTemplate))
if not obj.Stock:

View File

@@ -28,7 +28,6 @@ import Path
import Path.Base.Util as PathUtil
import PathScripts.PathJob as PathJob
import PathScripts.PathJobDlg as PathJobDlg
import PathScripts.PathPreferences as PathPreferences
import PathScripts.PathStock as PathStock
import json
import os
@@ -136,7 +135,7 @@ class CommandJobTemplateExport:
foo = QtGui.QFileDialog.getSaveFileName(
QtGui.QApplication.activeWindow(),
"Path - Job Template",
PathPreferences.filePath(),
Path.Preferences.filePath(),
"job_*.json",
)[0]
if foo:

View File

@@ -27,7 +27,6 @@ import FreeCADGui
import Path
import Path.Base.Util as PathUtil
import PathScripts.PathJob as PathJob
import PathScripts.PathPreferences as PathPreferences
import PathScripts.PathStock as PathStock
import glob
import os
@@ -223,7 +222,7 @@ class JobCreate:
def setupTemplate(self):
templateFiles = []
for path in PathPreferences.searchPaths():
for path in Path.Preferences.searchPaths():
cleanPaths = [
f.replace("\\", "/") for f in self.templateFilesIn(path)
] # Standardize slashes used across os platforms
@@ -240,7 +239,7 @@ class JobCreate:
name = basename + " (%s)" % i
Path.Log.track(name, tFile)
template[name] = tFile
selectTemplate = PathPreferences.defaultJobTemplate()
selectTemplate = Path.Preferences.defaultJobTemplate()
index = 0
self.dialog.jobTemplate.addItem("<none>", "")
for name in sorted(template.keys()):

View File

@@ -28,15 +28,14 @@ from pivy import coin
import FreeCAD
import FreeCADGui
import Path
import Path.Base.Gui.SetupSheetGui as PathSetupSheetGui
import Path.Base.Util as PathUtil
import Path.GuiInit as PathGuiInit
import Path.Tool.Gui.Bit as PathToolBitGui
import Path.Tool.Gui.Controller as PathToolControllerGui
import PathScripts.PathGuiInit as PathGuiInit
import PathScripts.PathJob as PathJob
import PathScripts.PathJobCmd as PathJobCmd
import PathScripts.PathJobDlg as PathJobDlg
import PathScripts.PathPreferences as PathPreferences
import PathScripts.PathSetupSheetGui as PathSetupSheetGui
import PathScripts.PathStock as PathStock
import PathScripts.PathUtils as PathUtils
import json
@@ -635,7 +634,7 @@ class TaskPanel:
self.form.toolControllerList.resizeColumnsToContents()
currentPostProcessor = self.obj.PostProcessor
postProcessors = PathPreferences.allEnabledPostProcessors(
postProcessors = Path.Preferences.allEnabledPostProcessors(
["", currentPostProcessor]
)
for post in postProcessors:
@@ -999,7 +998,7 @@ class TaskPanel:
tools = PathToolBitGui.LoadTools()
curLib = PathPreferences.lastFileToolLibrary()
curLib = Path.Preferences.lastFileToolLibrary()
library = None
if curLib is not None:

View File

@@ -23,7 +23,6 @@
import FreeCAD
import Path
import Path.Post.Processor as PostProcessor
import PathScripts.PathPreferences as PathPreferences
import PathScripts.PathStock as PathStock
import json
@@ -52,7 +51,7 @@ class JobPreferencesPage:
jobTemplate = self.form.leDefaultJobTemplate.text()
geometryTolerance = Units.Quantity(self.form.geometryTolerance.text())
curveAccuracy = Units.Quantity(self.form.curveAccuracy.text())
PathPreferences.setJobDefaults(
Path.Preferences.setJobDefaults(
filePath, jobTemplate, geometryTolerance, curveAccuracy
)
@@ -66,11 +65,11 @@ class JobPreferencesPage:
item = self.form.postProcessorList.item(i)
if item.checkState() == QtCore.Qt.CheckState.Unchecked:
blacklist.append(item.text())
PathPreferences.setPostProcessorDefaults(processor, args, blacklist)
Path.Preferences.setPostProcessorDefaults(processor, args, blacklist)
path = str(self.form.leOutputFile.text())
policy = str(self.form.cboOutputPolicy.currentText())
PathPreferences.setOutputFileDefaults(path, policy)
Path.Preferences.setOutputFileDefaults(path, policy)
self.saveStockSettings()
self.saveToolsSettings()
@@ -141,12 +140,12 @@ class JobPreferencesPage:
attrs["posZ"] = FreeCAD.Units.Quantity(
self.form.stockPositionZ.text()
).Value
PathPreferences.setDefaultStockTemplate(json.dumps(attrs))
Path.Preferences.setDefaultStockTemplate(json.dumps(attrs))
else:
PathPreferences.setDefaultStockTemplate("")
Path.Preferences.setDefaultStockTemplate("")
def saveToolsSettings(self):
PathPreferences.setToolsSettings(
Path.Preferences.setToolsSettings(
self.form.toolsAbsolutePaths.isChecked()
)
@@ -181,11 +180,11 @@ class JobPreferencesPage:
)
def loadSettings(self):
self.form.leDefaultFilePath.setText(PathPreferences.defaultFilePath())
self.form.leDefaultJobTemplate.setText(PathPreferences.defaultJobTemplate())
self.form.leDefaultFilePath.setText(Path.Preferences.defaultFilePath())
self.form.leDefaultJobTemplate.setText(Path.Preferences.defaultJobTemplate())
blacklist = PathPreferences.postProcessorBlacklist()
for processor in PathPreferences.allAvailablePostProcessors():
blacklist = Path.Preferences.postProcessorBlacklist()
for processor in Path.Preferences.allAvailablePostProcessors():
item = QtGui.QListWidgetItem(processor)
if processor in blacklist:
item.setCheckState(QtCore.Qt.CheckState.Unchecked)
@@ -198,26 +197,26 @@ class JobPreferencesPage:
)
self.form.postProcessorList.addItem(item)
self.verifyAndUpdateDefaultPostProcessorWith(
PathPreferences.defaultPostProcessor()
Path.Preferences.defaultPostProcessor()
)
self.form.defaultPostProcessorArgs.setText(
PathPreferences.defaultPostProcessorArgs()
Path.Preferences.defaultPostProcessorArgs()
)
geomTol = Units.Quantity(
PathPreferences.defaultGeometryTolerance(), Units.Length
Path.Preferences.defaultGeometryTolerance(), Units.Length
)
self.form.geometryTolerance.setText(geomTol.UserString)
self.form.curveAccuracy.setText(
Units.Quantity(
PathPreferences.defaultLibAreaCurveAccuracy(), Units.Length
Path.Preferences.defaultLibAreaCurveAccuracy(), Units.Length
).UserString
)
self.form.leOutputFile.setText(PathPreferences.defaultOutputFile())
self.form.leOutputFile.setText(Path.Preferences.defaultOutputFile())
self.selectComboEntry(
self.form.cboOutputPolicy, PathPreferences.defaultOutputPolicy()
self.form.cboOutputPolicy, Path.Preferences.defaultOutputPolicy()
)
self.form.tbDefaultFilePath.clicked.connect(self.browseDefaultFilePath)
@@ -235,7 +234,7 @@ class JobPreferencesPage:
self.loadToolSettings()
def loadStockSettings(self):
stock = PathPreferences.defaultStockTemplate()
stock = Path.Preferences.defaultStockTemplate()
index = -1
if stock:
attrs = json.loads(stock)
@@ -328,7 +327,7 @@ class JobPreferencesPage:
def loadToolSettings(self):
self.form.toolsAbsolutePaths.setChecked(
PathPreferences.toolsStoreAbsolutePaths()
Path.Preferences.toolsStoreAbsolutePaths()
)
def getPostProcessor(self, name):
@@ -370,7 +369,7 @@ class JobPreferencesPage:
def bestGuessForFilePath(self):
path = self.form.leDefaultFilePath.text()
if not path:
path = PathPreferences.filePath()
path = Path.Preferences.filePath()
return path
def browseDefaultJobTemplate(self):

View File

@@ -35,7 +35,6 @@ import FreeCADGui
import Path
import Path.Base.Util as PathUtil
import PathScripts
import PathScripts.PathPreferences as PathPreferences
from collections import Counter
from datetime import datetime
import os
@@ -55,10 +54,10 @@ class CommandPathSanity:
def resolveOutputPath(self, job):
if job.PostProcessorOutputFile != "":
filepath = job.PostProcessorOutputFile
elif PathPreferences.defaultOutputFile() != "":
filepath = PathPreferences.defaultOutputFile()
elif Path.Preferences.defaultOutputFile() != "":
filepath = Path.Preferences.defaultOutputFile()
else:
filepath = PathPreferences.macroFilePath()
filepath = Path.Preferences.macroFilePath()
if "%D" in filepath:
D = FreeCAD.ActiveDocument.FileName

View File

@@ -26,7 +26,6 @@
import FreeCAD
import FreeCADGui
import Path
import PathScripts.PathPreferences as PathPreferences
import PathScripts.drillableLib as drillableLib
import math
@@ -255,61 +254,61 @@ class ALLGate(PathBaseGate):
def contourselect():
FreeCADGui.Selection.addSelectionGate(CONTOURGate())
if not PathPreferences.suppressSelectionModeWarning():
if not Path.Preferences.suppressSelectionModeWarning():
FreeCAD.Console.PrintWarning("Contour Select Mode\n")
def eselect():
FreeCADGui.Selection.addSelectionGate(EGate())
if not PathPreferences.suppressSelectionModeWarning():
if not Path.Preferences.suppressSelectionModeWarning():
FreeCAD.Console.PrintWarning("Edge Select Mode\n")
def drillselect():
FreeCADGui.Selection.addSelectionGate(DRILLGate())
if not PathPreferences.suppressSelectionModeWarning():
if not Path.Preferences.suppressSelectionModeWarning():
FreeCAD.Console.PrintWarning("Drilling Select Mode\n")
def engraveselect():
FreeCADGui.Selection.addSelectionGate(ENGRAVEGate())
if not PathPreferences.suppressSelectionModeWarning():
if not Path.Preferences.suppressSelectionModeWarning():
FreeCAD.Console.PrintWarning("Engraving Select Mode\n")
def fselect():
FreeCADGui.Selection.addSelectionGate(FACEGate()) # Was PROFILEGate()
if not PathPreferences.suppressSelectionModeWarning():
if not Path.Preferences.suppressSelectionModeWarning():
FreeCAD.Console.PrintWarning("Profiling Select Mode\n")
def chamferselect():
FreeCADGui.Selection.addSelectionGate(CHAMFERGate())
if not PathPreferences.suppressSelectionModeWarning():
if not Path.Preferences.suppressSelectionModeWarning():
FreeCAD.Console.PrintWarning("Deburr Select Mode\n")
def profileselect():
FreeCADGui.Selection.addSelectionGate(PROFILEGate())
if not PathPreferences.suppressSelectionModeWarning():
if not Path.Preferences.suppressSelectionModeWarning():
FreeCAD.Console.PrintWarning("Profiling Select Mode\n")
def pocketselect():
FreeCADGui.Selection.addSelectionGate(POCKETGate())
if not PathPreferences.suppressSelectionModeWarning():
if not Path.Preferences.suppressSelectionModeWarning():
FreeCAD.Console.PrintWarning("Pocketing Select Mode\n")
def adaptiveselect():
FreeCADGui.Selection.addSelectionGate(ADAPTIVEGate())
if not PathPreferences.suppressSelectionModeWarning():
if not Path.Preferences.suppressSelectionModeWarning():
FreeCAD.Console.PrintWarning("Adaptive Select Mode\n")
def slotselect():
FreeCADGui.Selection.addSelectionGate(ALLGate())
if not PathPreferences.suppressSelectionModeWarning():
if not Path.Preferences.suppressSelectionModeWarning():
FreeCAD.Console.PrintWarning("Slot Cutter Select Mode\n")
@@ -318,30 +317,30 @@ def surfaceselect():
if MESHGate() or FACEGate():
gate = True
FreeCADGui.Selection.addSelectionGate(gate)
if not PathPreferences.suppressSelectionModeWarning():
if not Path.Preferences.suppressSelectionModeWarning():
FreeCAD.Console.PrintWarning("Surfacing Select Mode\n")
def vcarveselect():
FreeCADGui.Selection.addSelectionGate(VCARVEGate())
if not PathPreferences.suppressSelectionModeWarning():
if not Path.Preferences.suppressSelectionModeWarning():
FreeCAD.Console.PrintWarning("Vcarve Select Mode\n")
def probeselect():
FreeCADGui.Selection.addSelectionGate(PROBEGate())
if not PathPreferences.suppressSelectionModeWarning():
if not Path.Preferences.suppressSelectionModeWarning():
FreeCAD.Console.PrintWarning("Probe Select Mode\n")
def customselect():
if not PathPreferences.suppressSelectionModeWarning():
if not Path.Preferences.suppressSelectionModeWarning():
FreeCAD.Console.PrintWarning("Custom Select Mode\n")
def turnselect():
FreeCADGui.Selection.addSelectionGate(TURNGate())
if not PathPreferences.suppressSelectionModeWarning():
if not Path.Preferences.suppressSelectionModeWarning():
FreeCAD.Console.PrintWarning("Turning Select Mode\n")
@@ -377,5 +376,5 @@ def select(op):
def clear():
FreeCADGui.Selection.removeSelectionGate()
if not PathPreferences.suppressSelectionModeWarning():
if not Path.Preferences.suppressSelectionModeWarning():
FreeCAD.Console.PrintWarning("Free Select\n")

View File

@@ -24,7 +24,7 @@ import FreeCAD
import Path
import Path.Base.Util as PathUtil
import Path.Dressup.Utils as PathDressup
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathGui
import PathScripts.PathJob as PathJob
import PathSimulator
import math

View File

@@ -338,9 +338,9 @@ def SetupStockObject(obj, stockType):
obj.StockType = stockType
obj.setEditorMode("StockType", 2) # hide
import PathScripts.PathIconViewProvider
import Path.Base.Gui.IconViewProvider
PathScripts.PathIconViewProvider.ViewProvider(obj.ViewObject, "Stock")
Path.Base.Gui.IconViewProvider.ViewProvider(obj.ViewObject, "Stock")
obj.ViewObject.Transparency = 90
obj.ViewObject.DisplayMode = "Wireframe"

View File

@@ -24,7 +24,7 @@ import FreeCADGui
import FreeCAD
import Path
import Path.Tool.Controller as PathToolController
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathGui
import PathScripts.PathJobCmd as PathJobCmd
import PathScripts.PathUtils as PathUtils
from PySide import QtGui

View File

@@ -29,7 +29,6 @@ import FreeCAD
import Path
import Path.Post.Command as PathPost
from PathScripts import PathPreferences
import Path.Post.Utils as PostUtils
import Path.Post.Processor as PostProcessor
@@ -409,7 +408,7 @@ class TestOutputNameSubstitution(unittest.TestCase):
FreeCAD.setActiveDocument(self.doc.Label)
teststring = ""
self.job.PostProcessorOutputFile = teststring
PathPreferences.setOutputFileDefaults(
Path.Preferences.setOutputFileDefaults(
teststring, "Append Unique ID on conflict"
)
self.job.SplitOutput = False
@@ -425,7 +424,7 @@ class TestOutputNameSubstitution(unittest.TestCase):
# Test basic string substitution without splitting
teststring = "~/Desktop/%j.nc"
self.job.PostProcessorOutputFile = teststring
PathPreferences.setOutputFileDefaults(
Path.Preferences.setOutputFileDefaults(
teststring, "Append Unique ID on conflict"
)
self.job.SplitOutput = False
@@ -443,7 +442,7 @@ class TestOutputNameSubstitution(unittest.TestCase):
# Substitute current file path
teststring = "%D/testfile.nc"
self.job.PostProcessorOutputFile = teststring
PathPreferences.setOutputFileDefaults(
Path.Preferences.setOutputFileDefaults(
teststring, "Append Unique ID on conflict"
)
outlist = PathPost.buildPostList(self.job)
@@ -457,7 +456,7 @@ class TestOutputNameSubstitution(unittest.TestCase):
def test020(self):
teststring = "%d.nc"
self.job.PostProcessorOutputFile = teststring
PathPreferences.setOutputFileDefaults(
Path.Preferences.setOutputFileDefaults(
teststring, "Append Unique ID on conflict"
)
outlist = PathPost.buildPostList(self.job)
@@ -468,7 +467,7 @@ class TestOutputNameSubstitution(unittest.TestCase):
def test030(self):
teststring = "%M/outfile.nc"
self.job.PostProcessorOutputFile = teststring
PathPreferences.setOutputFileDefaults(
Path.Preferences.setOutputFileDefaults(
teststring, "Append Unique ID on conflict"
)
outlist = PathPost.buildPostList(self.job)
@@ -480,7 +479,7 @@ class TestOutputNameSubstitution(unittest.TestCase):
# unused substitution strings should be ignored
teststring = "%d%T%t%W%O/testdoc.nc"
self.job.PostProcessorOutputFile = teststring
PathPreferences.setOutputFileDefaults(
Path.Preferences.setOutputFileDefaults(
teststring, "Append Unique ID on conflict"
)
outlist = PathPost.buildPostList(self.job)
@@ -495,7 +494,7 @@ class TestOutputNameSubstitution(unittest.TestCase):
# explicitly using the sequence number should include it where indicated.
teststring = "%S-%d.nc"
self.job.PostProcessorOutputFile = teststring
PathPreferences.setOutputFileDefaults(
Path.Preferences.setOutputFileDefaults(
teststring, "Append Unique ID on conflict"
)
outlist = PathPost.buildPostList(self.job)
@@ -512,7 +511,7 @@ class TestOutputNameSubstitution(unittest.TestCase):
# substitute jobname and use default sequence numbers
teststring = "%j.nc"
self.job.PostProcessorOutputFile = teststring
PathPreferences.setOutputFileDefaults(
Path.Preferences.setOutputFileDefaults(
teststring, "Append Unique ID on conflict"
)
subpart, objs = outlist[0]
@@ -525,7 +524,7 @@ class TestOutputNameSubstitution(unittest.TestCase):
# Use Toolnumbers and default sequence numbers
teststring = "%T.nc"
self.job.PostProcessorOutputFile = teststring
PathPreferences.setOutputFileDefaults(
Path.Preferences.setOutputFileDefaults(
teststring, "Append Unique ID on conflict"
)
outlist = PathPost.buildPostList(self.job)
@@ -539,7 +538,7 @@ class TestOutputNameSubstitution(unittest.TestCase):
# Use Tooldescriptions and default sequence numbers
teststring = "%t.nc"
self.job.PostProcessorOutputFile = teststring
PathPreferences.setOutputFileDefaults(
Path.Preferences.setOutputFileDefaults(
teststring, "Append Unique ID on conflict"
)
outlist = PathPost.buildPostList(self.job)
@@ -558,7 +557,7 @@ class TestOutputNameSubstitution(unittest.TestCase):
teststring = "%j.nc"
self.job.PostProcessorOutputFile = teststring
PathPreferences.setOutputFileDefaults(
Path.Preferences.setOutputFileDefaults(
teststring, "Append Unique ID on conflict"
)
subpart, objs = outlist[0]
@@ -570,7 +569,7 @@ class TestOutputNameSubstitution(unittest.TestCase):
teststring = "%W-%j.nc"
self.job.PostProcessorOutputFile = teststring
PathPreferences.setOutputFileDefaults(
Path.Preferences.setOutputFileDefaults(
teststring, "Append Unique ID on conflict"
)
subpart, objs = outlist[0]
@@ -588,7 +587,7 @@ class TestOutputNameSubstitution(unittest.TestCase):
teststring = "%j.nc"
self.job.PostProcessorOutputFile = teststring
PathPreferences.setOutputFileDefaults(
Path.Preferences.setOutputFileDefaults(
teststring, "Append Unique ID on conflict"
)
subpart, objs = outlist[0]
@@ -600,7 +599,7 @@ class TestOutputNameSubstitution(unittest.TestCase):
teststring = "%O-%j.nc"
self.job.PostProcessorOutputFile = teststring
PathPreferences.setOutputFileDefaults(
Path.Preferences.setOutputFileDefaults(
teststring, "Append Unique ID on conflict"
)
subpart, objs = outlist[0]

View File

@@ -20,7 +20,7 @@
# * *
# ***************************************************************************
import PathScripts.PathPreferences as PathPreferences
import Path
import PathTests.PathTestUtils as PathTestUtils
@@ -28,22 +28,22 @@ class TestPathPreferences(PathTestUtils.PathTestBase):
def test00(self):
"""There is at least one search path."""
paths = PathPreferences.searchPaths()
paths = Path.Preferences.searchPaths()
self.assertGreater(len(paths), 0)
def test01(self):
"""Path/Post is part of the posts search path."""
paths = PathPreferences.searchPathsPost()
paths = Path.Preferences.searchPathsPost()
self.assertEqual(len([p for p in paths if p.endswith("/Path/Post/")]), 1)
def test02(self):
"""Path/Post/scripts is part of the posts search path."""
paths = PathPreferences.searchPathsPost()
paths = Path.Preferences.searchPathsPost()
self.assertEqual(len([p for p in paths if p.endswith("/Path/Post/scripts/")]), 1)
def test03(self):
"""Available post processors include linuxcnc, grbl and opensbp."""
posts = PathPreferences.allAvailablePostProcessors()
posts = Path.Preferences.allAvailablePostProcessors()
self.assertTrue("linuxcnc" in posts)
self.assertTrue("grbl" in posts)
self.assertTrue("opensbp" in posts)
@@ -51,17 +51,17 @@ class TestPathPreferences(PathTestUtils.PathTestBase):
def test10(self):
"""Default paths for tools are resolved correctly"""
self.assertTrue(PathPreferences.pathDefaultToolsPath().endswith("/Path/Tools/"))
self.assertTrue(Path.Preferences.pathDefaultToolsPath().endswith("/Path/Tools/"))
self.assertTrue(
PathPreferences.pathDefaultToolsPath("Bit").endswith("/Path/Tools/Bit")
Path.Preferences.pathDefaultToolsPath("Bit").endswith("/Path/Tools/Bit")
)
self.assertTrue(
PathPreferences.pathDefaultToolsPath("Library").endswith(
Path.Preferences.pathDefaultToolsPath("Library").endswith(
"/Path/Tools/Library"
)
)
self.assertTrue(
PathPreferences.pathDefaultToolsPath("Template").endswith(
Path.Preferences.pathDefaultToolsPath("Template").endswith(
"/Path/Tools/Template"
)
)

View File

@@ -21,13 +21,12 @@
# ***************************************************************************
import FreeCAD
import PathScripts.PathSetupSheet as PathSetupSheet
import PathScripts.PathLog as PathLog
import Path
import Path.Base.SetupSheet as PathSetupSheet
import json
import sys
#PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
#PathLog.trackModule(PathLog.thisModule())
#Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
from PathTests.PathTestUtils import PathTestBase
@@ -37,7 +36,7 @@ def refstring(string):
class SomeOp (object):
def __init__(self, obj):
PathLog.track(obj, type(obj))
Path.Log.track(obj, type(obj))
obj.addProperty('App::PropertyPercent', 'StepOver', 'Base', 'Some help you are')
@classmethod
@@ -46,7 +45,7 @@ class SomeOp (object):
@classmethod
def Create(cls, name, obj=None, parentJob=None):
PathLog.track(name, obj)
Path.Log.track(name, obj)
if obj is None:
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
obj.Proxy = SomeOp(obj)

View File

@@ -24,7 +24,6 @@ import FreeCAD
import Path
import Path.Tool.Bit as PathToolBit
import Path.Tool.Controller as PathToolController
import PathScripts.PathPreferences as PathPreferences
from PathTests.PathTestUtils import PathTestBase