FEM: Python constraints, do not open a new constraint if another task panel is open
This commit is contained in:
@@ -27,11 +27,12 @@ __url__ = "http://www.freecadweb.org"
|
||||
|
||||
|
||||
import FreeCAD
|
||||
import femtools.femutils as FemUtils
|
||||
import FreeCADGui
|
||||
from . import ViewProviderFemConstraint
|
||||
from FreeCAD import Units
|
||||
|
||||
import FreeCADGui as Gui
|
||||
# for the panel
|
||||
import femtools.femutils as FemUtils
|
||||
from FreeCAD import Units
|
||||
|
||||
|
||||
class ViewProxy(ViewProviderFemConstraint.ViewProxy):
|
||||
@@ -46,23 +47,19 @@ class ViewProxy(ViewProviderFemConstraint.ViewProxy):
|
||||
o.ViewObject.hide()
|
||||
# show task panel
|
||||
task = _TaskPanel(vobj.Object)
|
||||
Gui.Control.showDialog(task)
|
||||
FreeCADGui.Control.showDialog(task)
|
||||
return True
|
||||
|
||||
def unsetEdit(self, vobj, mode=0):
|
||||
Gui.Control.closeDialog()
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
if Gui.Control.activeDialog():
|
||||
Gui.Control.closeDialog()
|
||||
Gui.ActiveDocument.setEdit(vobj.Object.Name)
|
||||
return True
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return
|
||||
|
||||
|
||||
class _TaskPanel(object):
|
||||
|
||||
def __init__(self, obj):
|
||||
self._obj = obj
|
||||
self._paramWidget = Gui.PySideUic.loadUi(
|
||||
self._paramWidget = FreeCADGui.PySideUic.loadUi(
|
||||
FreeCAD.getHomePath() + "Mod/Fem/Resources/ui/InitialFlowVelocity.ui")
|
||||
self._initParamWidget()
|
||||
self.form = [self._paramWidget]
|
||||
@@ -80,12 +77,14 @@ class _TaskPanel(object):
|
||||
self._part.ViewObject.show()
|
||||
|
||||
def reject(self):
|
||||
FreeCADGui.ActiveDocument.resetEdit()
|
||||
self._restoreVisibility()
|
||||
return True
|
||||
|
||||
def accept(self):
|
||||
self._applyWidgetChanges()
|
||||
self._obj.Document.recompute()
|
||||
FreeCADGui.ActiveDocument.resetEdit()
|
||||
self._restoreVisibility()
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user