Skip to content

Commit

Permalink
Merge pull request #2709 from mlampert/bugfix/boundary-dressup-cleanup
Browse files Browse the repository at this point in the history
Path: Fixed circular dependency for boundary dressup
  • Loading branch information
sliptonic committed Nov 13, 2019
2 parents 1e7628f + a288533 commit 25f34a0
Showing 1 changed file with 28 additions and 11 deletions.
39 changes: 28 additions & 11 deletions src/Mod/Path/PathScripts/PathDressupPathBoundaryGui.py
Expand Up @@ -24,13 +24,12 @@
import FreeCAD
import FreeCADGui
import PathScripts.PathDressupPathBoundary as PathDressupPathBoundary
import PathScripts.PathJobGui as PathJobGui
import PathScripts.PathLog as PathLog

from PySide import QtGui, QtCore

PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
# PathLog.trackModule()
#PathLog.trackModule()


# Qt translation handling
Expand All @@ -49,6 +48,9 @@ def __init__(self, obj, viewProvider):
else:
self.visibilityBoundary = False

self.buttonBox = None
self.isDirty = False

self.stockFromBase = None
self.stockFromExisting = None
self.stockCreateBox = None
Expand All @@ -58,10 +60,22 @@ def __init__(self, obj, viewProvider):
def getStandardButtons(self):
return int(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Apply | QtGui.QDialogButtonBox.Cancel)

def modifyStandardButtons(self, buttonBox):
self.buttonBox = buttonBox

def setDirty(self):
self.isDirty = True
self.buttonBox.button(QtGui.QDialogButtonBox.Apply).setEnabled(True)

def setClean(self):
self.isDirty = False
self.buttonBox.button(QtGui.QDialogButtonBox.Apply).setEnabled(False)

def clicked(self, button):
# callback for standard buttons
if button == QtGui.QDialogButtonBox.Apply:
self.obj.Proxy.execute(self.obj)
self.updateDressup()
FreeCAD.ActiveDocument.recompute()

def abort(self):
FreeCAD.ActiveDocument.abortTransaction()
Expand All @@ -72,11 +86,10 @@ def reject(self):
self.cleanup(True)

def accept(self):
if self.isDirty:
self.updateDressup()
FreeCAD.ActiveDocument.commitTransaction()
self.cleanup(True)
#if self.isDirty:
# self.getFields()
# FreeCAD.ActiveDocument.recompute()

def cleanup(self, gui):
self.viewProvider.clearTaskPanel()
Expand All @@ -87,12 +100,14 @@ def cleanup(self, gui):
if self.obj.Stock:
self.obj.Stock.ViewObject.Visibility = self.visibilityBoundary

def getFields(self):
pass
def setFields(self):
pass
def updateDressup(self):
if self.obj.Inside != self.form.stockInside.isChecked():
self.obj.Inside = self.form.stockInside.isChecked()
self.stockEdit.getFields(self.obj)
self.setClean()

def updateStockEditor(self, index, force=False):
import PathScripts.PathJobGui as PathJobGui
import PathScripts.PathStock as PathStock

def setupFromBaseEdit():
Expand Down Expand Up @@ -150,8 +165,10 @@ def setupFromExisting():

def setupUi(self):
self.updateStockEditor(-1, False)
self.form.stockInside.setChecked(self.obj.Inside)

self.form.stock.currentIndexChanged.connect(self.updateStockEditor)
self.form.stockInside.stateChanged.connect(self.setDirty)


class DressupPathBoundaryViewProvider(object):
Expand All @@ -161,7 +178,7 @@ def __init__(self, vobj):

def __getstate__(self):
return None
def __setstate_(self, state):
def __setstate__(self, state):
return None


Expand Down

0 comments on commit 25f34a0

Please sign in to comment.