diff --git a/src/Mod/Path/Gui/Resources/panels/PropertyCreate.ui b/src/Mod/Path/Gui/Resources/panels/PropertyCreate.ui
index c65c02ea82..38a4b3057f 100644
--- a/src/Mod/Path/Gui/Resources/panels/PropertyCreate.ui
+++ b/src/Mod/Path/Gui/Resources/panels/PropertyCreate.ui
@@ -24,7 +24,7 @@
-
- <html><head/><body><p>Name of property.</p></body></html>
+ <html><head/><body><p>Name of property. Can only contain letters, numbers, and underscores. MixedCase names will display with spaces "Mixed Case"</p></body></html>
diff --git a/src/Mod/Path/Gui/Resources/preferences/PathJob.ui b/src/Mod/Path/Gui/Resources/preferences/PathJob.ui
index 15c9cfcb30..a97cc76815 100644
--- a/src/Mod/Path/Gui/Resources/preferences/PathJob.ui
+++ b/src/Mod/Path/Gui/Resources/preferences/PathJob.ui
@@ -142,8 +142,8 @@
0
0
- 366
- 330
+ 424
+ 537
@@ -348,8 +348,8 @@
0
0
- 319
- 528
+ 424
+ 537
@@ -653,16 +653,6 @@
- -
-
-
- <html><head/><body><p>Causes the toollibrary manager to remember last directory. This ONLY affects legacy tools. </p><p>This control is deprecated and will be removed in a future version</p></body></html>
-
-
- Remember last library (legacy)
-
-
-
-
diff --git a/src/Mod/Path/PathScripts/PathDressupTag.py b/src/Mod/Path/PathScripts/PathDressupTag.py
index bbfc349358..30e2243a52 100644
--- a/src/Mod/Path/PathScripts/PathDressupTag.py
+++ b/src/Mod/Path/PathScripts/PathDressupTag.py
@@ -224,7 +224,7 @@ class ObjectDressup:
def toolRadius(self):
return float(PathDressup.toolController(self.obj.Base).Tool.Diameter) / 2.0
- def addTagsToDocuemnt(self):
+ def addTagsToDocument(self):
for i, solid in enumerate(self.solids):
obj = FreeCAD.ActiveDocument.addObject('Part::Compound', "tag_%02d" % i)
obj.Shape = solid
@@ -256,7 +256,7 @@ def Create(baseObject, name='DressupTag'):
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
dbo = ObjectDressup(obj, baseObject)
job = PathUtils.findParentJob(baseObject)
- job.adddOperation(obj)
+ job.addOperation(obj)
dbo.assignDefaultValues()
return obj
diff --git a/src/Mod/Path/PathScripts/PathPreferences.py b/src/Mod/Path/PathScripts/PathPreferences.py
index ff07fc1cbb..caf86212cd 100644
--- a/src/Mod/Path/PathScripts/PathPreferences.py
+++ b/src/Mod/Path/PathScripts/PathPreferences.py
@@ -51,7 +51,7 @@ LastFileToolShape = "LastFileToolShape"
UseLegacyTools = "UseLegacyTools"
UseAbsoluteToolPaths = "UseAbsoluteToolPaths"
-OpenLastLibrary = "OpenLastLibrary"
+# OpenLastLibrary = "OpenLastLibrary"
# Linear tolerance to use when generating Paths, eg when tessellating geometry
GeometryTolerance = "GeometryTolerance"
@@ -166,15 +166,15 @@ def toolsStoreAbsolutePaths():
return preferences().GetBool(UseAbsoluteToolPaths, False)
-def toolsOpenLastLibrary():
- return preferences().GetBool(OpenLastLibrary, False)
+# def toolsOpenLastLibrary():
+# return preferences().GetBool(OpenLastLibrary, False)
-def setToolsSettings(legacy, relative, lastlibrary):
+def setToolsSettings(legacy, relative):
pref = preferences()
pref.SetBool(UseLegacyTools, legacy)
pref.SetBool(UseAbsoluteToolPaths, relative)
- pref.SetBool(OpenLastLibrary, lastlibrary)
+ # pref.SetBool(OpenLastLibrary, lastlibrary)
def defaultJobTemplate():
diff --git a/src/Mod/Path/PathScripts/PathPreferencesPathJob.py b/src/Mod/Path/PathScripts/PathPreferencesPathJob.py
index e684415288..eba1549363 100644
--- a/src/Mod/Path/PathScripts/PathPreferencesPathJob.py
+++ b/src/Mod/Path/PathScripts/PathPreferencesPathJob.py
@@ -108,8 +108,7 @@ class JobPreferencesPage:
def saveToolsSettings(self):
PathPreferences.setToolsSettings(self.form.toolsUseLegacy.isChecked(),
- self.form.toolsAbsolutePaths.isChecked(),
- self.form.toolsOpenLastLibrary.isChecked())
+ self.form.toolsAbsolutePaths.isChecked())
def selectComboEntry(self, widget, text):
index = widget.findText(text, QtCore.Qt.MatchFixedString)
diff --git a/src/Mod/Path/PathScripts/PathPropertyBag.py b/src/Mod/Path/PathScripts/PathPropertyBag.py
index 2b21be2c6b..2142457ed1 100644
--- a/src/Mod/Path/PathScripts/PathPropertyBag.py
+++ b/src/Mod/Path/PathScripts/PathPropertyBag.py
@@ -22,6 +22,7 @@
import FreeCAD
import PySide
+import re
__title__ = 'Generic property container to store some values.'
__author__ = 'sliptonic (Brad Collette)'
@@ -67,6 +68,18 @@ class PropertyBag(object):
def __setstate__(self, state):
return None
+ def __sanitizePropertyName(self, name):
+ if(len(name) == 0):
+ return
+ clean = name[0]
+ for i in range(1, len(name)):
+ if (name[i] == ' '):
+ clean += name[i + 1].upper()
+ i += 1
+ elif(name[i - 1] != ' '):
+ clean += name[i]
+ return clean
+
def onDocumentRestored(self, obj):
self.obj = obj
obj.setEditorMode(self.CustomPropertyGroups, 2) # hide
@@ -82,10 +95,16 @@ class PropertyBag(object):
if group is None:
group = self.CustomPropertyGroupDefault
groups = self.obj.CustomPropertyGroups
+
+ name = self.__sanitizePropertyName(name)
+ if not re.match("^[A-Za-z0-9_]*$", name):
+ raise ValueError('Property Name can only contain letters and numbers')
+
if not group in groups:
groups.append(group)
self.obj.CustomPropertyGroups = groups
self.obj.addProperty(propertyType, name, group, desc)
+ return name
def refreshCustomPropertyGroups(self):
'''refreshCustomPropertyGroups() ... removes empty property groups, should be called after deleting properties.'''
diff --git a/src/Mod/Path/PathScripts/PathPropertyBagGui.py b/src/Mod/Path/PathScripts/PathPropertyBagGui.py
index 6140e3540f..7446379b53 100644
--- a/src/Mod/Path/PathScripts/PathPropertyBagGui.py
+++ b/src/Mod/Path/PathScripts/PathPropertyBagGui.py
@@ -22,12 +22,13 @@
import FreeCAD
import FreeCADGui
-import PathGui
+#import PathGui
import PathScripts.PathIconViewProvider as PathIconViewProvider
import PathScripts.PathLog as PathLog
import PathScripts.PathPropertyBag as PathPropertyBag
import PathScripts.PathPropertyEditor as PathPropertyEditor
import PathScripts.PathUtil as PathUtil
+import re
from PySide import QtCore, QtGui
@@ -153,6 +154,7 @@ class PropertyCreate(object):
self.form.propertyEnum.textChanged.connect(self.updateUI)
def updateUI(self):
+
typeSet = True
if self.propertyIsEnumeration():
self.form.labelEnum.setEnabled(True)
@@ -166,7 +168,10 @@ class PropertyCreate(object):
ok = self.form.buttonBox.button(QtGui.QDialogButtonBox.Ok)
- if typeSet and self.propertyName() and self.propertyGroup():
+ if not re.match("^[A-Za-z0-9_]*$", self.form.propertyName.text()):
+ typeSet = False
+
+ if typeSet and self.propertyGroup():
ok.setEnabled(True)
else:
ok.setEnabled(False)
@@ -299,10 +304,10 @@ class TaskPanel(object):
typ = dialog.propertyType()
grp = dialog.propertyGroup()
info = dialog.propertyInfo()
- self.obj.Proxy.addCustomProperty(typ, name, grp, info)
+ propname = self.obj.Proxy.addCustomProperty(typ, name, grp, info)
if dialog.propertyIsEnumeration():
setattr(self.obj, name, dialog.propertyEnumerations())
- return (name, info)
+ return (propname, info)
def propertyAdd(self):
PathLog.track()
diff --git a/src/Mod/Path/PathScripts/PathToolBitLibraryCmd.py b/src/Mod/Path/PathScripts/PathToolBitLibraryCmd.py
index 6c3d82b834..5d03f72fe0 100644
--- a/src/Mod/Path/PathScripts/PathToolBitLibraryCmd.py
+++ b/src/Mod/Path/PathScripts/PathToolBitLibraryCmd.py
@@ -47,13 +47,7 @@ class CommandToolBitSelectorOpen:
def Activated(self):
import PathScripts.PathToolBitLibraryGui as PathToolBitLibraryGui
dock = PathToolBitLibraryGui.ToolBitSelector()
-
- lastlib = PathPreferences.lastPathToolLibrary()
-
- if PathPreferences.toolsOpenLastLibrary():
- dock.open(lastlib)
- else:
- dock.open()
+ dock.open()
class CommandToolBitLibraryOpen:
@@ -77,57 +71,7 @@ class CommandToolBitLibraryOpen:
import PathScripts.PathToolBitLibraryGui as PathToolBitLibraryGui
library = PathToolBitLibraryGui.ToolBitLibrary()
- lastlib = PathPreferences.lastPathToolLibrary()
-
- if PathPreferences.toolsOpenLastLibrary():
- library.open(lastlib)
- else:
- library.open()
-
-# class CommandToolBitLibraryLoad:
-# '''
-# Command used to load an entire ToolBitLibrary (or part of it) from a file into a job.
-# '''
-
-# def __init__(self):
-# pass
-
-# def GetResources(self):
-# return {'Pixmap': 'Path_ToolTable',
-# 'MenuText': QtCore.QT_TRANSLATE_NOOP("PathToolBitLibrary", "Load ToolBit Library"),
-# 'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathToolBitLibrary", "Load an entire ToolBit library or part of it into a job")}
-
-# def selectedJob(self):
-# if FreeCAD.ActiveDocument:
-# sel = FreeCADGui.Selection.getSelectionEx()
-# if sel and sel[0].Object.Name[:3] == 'Job':
-# return sel[0].Object
-# jobs = [o for o in FreeCAD.ActiveDocument.Objects if o.Name[:3] == 'Job']
-# if 1 == len(jobs):
-# return jobs[0]
-# return None
-
-# def IsActive(self):
-# return not self.selectedJob() is None
-
-# def Activated(self):
-# job = self.selectedJob()
-# self.Execute(job)
-
-# @classmethod
-# def Execute(cls, job):
-# import PathScripts.PathToolBitLibraryGui as PathToolBitLibraryGui
-# import PathScripts.PathToolControllerGui as PathToolControllerGui
-
-# library = PathToolBitLibraryGui.ToolBitLibrary()
-
-# if 1 == library.open() and job:
-# for nr, tool in library.selectedOrAllTools():
-# tc = PathToolControllerGui.Create("TC: {}".format(tool.Label), tool, nr)
-# job.Proxy.addToolController(tc)
-# FreeCAD.ActiveDocument.recompute()
-# return True
-# return False
+ library.open()
if FreeCAD.GuiUp:
diff --git a/src/Mod/Path/PathScripts/post/gcode_pre.py b/src/Mod/Path/PathScripts/post/gcode_pre.py
index f6707fd3cd..e3e2303b3f 100644
--- a/src/Mod/Path/PathScripts/post/gcode_pre.py
+++ b/src/Mod/Path/PathScripts/post/gcode_pre.py
@@ -50,6 +50,7 @@ import re
import PathScripts.PathCustom as PathCustom
import PathScripts.PathCustomGui as PathCustomGui
import PathScripts.PathOpGui as PathOpGui
+from PySide import QtCore
# LEVEL = PathLog.Level.DEBUG
LEVEL = PathLog.Level.INFO
@@ -112,11 +113,10 @@ def insert(filename, docname):
# Create a custom and viewobject
obj = PathCustom.Create("Custom")
- res = PathOpGui.CommandResources('Custom',
- PathCustom.Create, PathCustomGui.TaskPanelOpPage,
- 'Path_Custom',
- QtCore.QT_TRANSLATE_NOOP('Path_Custom', 'Custom'), '', ''
- )
+ res = PathOpGui.CommandResources('Custom', PathCustom.Create,
+ PathCustomGui.TaskPanelOpPage,
+ 'Path_Custom',
+ QtCore.QT_TRANSLATE_NOOP('Path_Custom', 'Custom'), '', '')
obj.ViewObject.Proxy = PathOpGui.ViewProvider(obj.ViewObject, res)
obj.ViewObject.Proxy.setDeleteObjectsOnReject(False)
@@ -127,6 +127,7 @@ def insert(filename, docname):
FreeCAD.ActiveDocument.recompute()
+
def parse(inputstring):
"parse(inputstring): returns a parsed output string"