FEM: Python VP objects without task panel, proper prevent edit mode
This commit is contained in:
@@ -27,8 +27,8 @@ __url__ = "http://www.freecadweb.org"
|
||||
|
||||
|
||||
import FreeCAD
|
||||
if FreeCAD.GuiUp:
|
||||
from pivy import coin
|
||||
import FreeCADGui
|
||||
from pivy import coin
|
||||
|
||||
|
||||
class ViewProxy(object):
|
||||
@@ -51,3 +51,17 @@ class ViewProxy(object):
|
||||
|
||||
def setDisplayMode(self, mode):
|
||||
return mode
|
||||
|
||||
def setEdit(self, vobj, mode=0):
|
||||
# needs to be overwritten if task panel exists
|
||||
# avoid edit mode by return False, https://forum.freecadweb.org/viewtopic.php?t=12139&start=10#p161062
|
||||
return False
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
doc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
# check if another VP is in edit mode, https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
|
||||
if not doc.getInEdit():
|
||||
doc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
|
||||
return True
|
||||
|
||||
@@ -27,6 +27,9 @@ __url__ = "http://www.freecadweb.org"
|
||||
## @package ViewProviderFemConstraintSelfWeight
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
|
||||
|
||||
class _ViewProviderFemConstraintSelfWeight:
|
||||
"A View Provider for the FemConstraintSelfWeight object"
|
||||
@@ -46,6 +49,19 @@ class _ViewProviderFemConstraintSelfWeight:
|
||||
def onChanged(self, vobj, prop):
|
||||
return
|
||||
|
||||
def setEdit(self, vobj, mode=0):
|
||||
# avoid edit mode by return False, https://forum.freecadweb.org/viewtopic.php?t=12139&start=10#p161062
|
||||
return False
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
doc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
# check if another VP is in edit mode, https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
|
||||
if not doc.getInEdit():
|
||||
doc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
|
||||
return True
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ __url__ = "http://www.freecadweb.org"
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
|
||||
|
||||
# for the panel
|
||||
from PySide import QtCore
|
||||
from PySide import QtGui
|
||||
@@ -79,15 +78,20 @@ class _ViewProviderFemElementRotation1D:
|
||||
def unsetEdit(self, vobj, mode=0):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return
|
||||
'''
|
||||
|
||||
def setEdit(self, vobj, mode=0):
|
||||
# avoid edit mode by return False, https://forum.freecadweb.org/viewtopic.php?t=12139&start=10#p161062
|
||||
return False
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
doc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
# check if another VP is in edit mode, https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
|
||||
if not doc.getInEdit():
|
||||
doc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
|
||||
return True
|
||||
'''
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
@@ -27,6 +27,8 @@ __url__ = "http://www.freecadweb.org"
|
||||
## @package ViewProviderFemMaterialMechanicalNonLinear
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
from pivy import coin
|
||||
|
||||
|
||||
@@ -56,6 +58,19 @@ class _ViewProviderFemMaterialMechanicalNonlinear:
|
||||
def onChanged(self, vobj, prop):
|
||||
return
|
||||
|
||||
def setEdit(self, vobj, mode=0):
|
||||
# avoid edit mode by return False, https://forum.freecadweb.org/viewtopic.php?t=12139&start=10#p161062
|
||||
return False
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
doc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
# check if another VP is in edit mode, https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
|
||||
if not doc.getInEdit():
|
||||
doc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
|
||||
return True
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user