Skip to content

Commit

Permalink
Path: ToolLibraryManager copy button is smarter.
Browse files Browse the repository at this point in the history
  • Loading branch information
sliptonic authored and yorikvanhavre committed Mar 21, 2017
1 parent 57da9b7 commit 7d4ae8a
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/Mod/Path/PathScripts/PathToolLibraryManager.py
Expand Up @@ -35,8 +35,8 @@
import PathScripts.PathLog as PathLog

LOG_MODULE = 'PathToolLibraryManager'
PathLog.setLevel(PathLog.Level.DEBUG, LOG_MODULE)
PathLog.trackModule('PathToolLibraryManager')
PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE)
#PathLog.trackModule('PathToolLibraryManager')

try:
_encoding = QtGui.QApplication.UnicodeUTF8
Expand Down Expand Up @@ -392,7 +392,6 @@ def getMaterial(self, material):

def addTool(self):
t = Path.Tool()
print("adding a new tool")
editform = FreeCADGui.PySideUic.loadUi(":/panels/ToolEdit.ui")

r = editform.exec_()
Expand Down Expand Up @@ -509,6 +508,17 @@ def exportFile(self):
listname = self.form.listView.selectedIndexes()[0].data()
self.TLM.write(filename, listname)

def checkCopy(self):
self.form.btnCopyTools.setEnabled(False)
model = self.form.ToolsList.model()
for i in range(model.rowCount()):
item = model.item(i, 0)
if item.checkState():
self.form.btnCopyTools.setEnabled(True)

if len(PathUtils.GetJobs()) == 0:
self.form.btnCopyTools.setEnabled(False)

def copyTools(self):
tools = []
model = self.form.ToolsList.model()
Expand Down Expand Up @@ -571,8 +581,11 @@ def setupUi(self):
self.form.ButtonUp.clicked.connect(self.moveUp)
self.form.ButtonDelete.clicked.connect(self.delete)
self.form.ToolsList.doubleClicked.connect(self.editTool)
self.form.ToolsList.clicked.connect(self.checkCopy)
self.form.btnCopyTools.clicked.connect(self.copyTools)

self.form.btnCopyTools.setEnabled(False)

self.setFields()

class CommandToolLibraryEdit():
Expand Down

0 comments on commit 7d4ae8a

Please sign in to comment.