FEM: Python object VP, add a pop up if a task panel is open while another one will be opened

This commit is contained in:
Bernd Hahnebach
2018-05-21 14:32:39 +02:00
committed by wmayer
parent bb162d34a7
commit f14eaa217f
13 changed files with 94 additions and 47 deletions

View File

@@ -54,12 +54,15 @@ class _ViewProviderFemConstraintSelfWeight:
return False
def doubleClicked(self, vobj):
doc = FreeCADGui.getDocument(vobj.Object.Document)
guidoc = 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)
if not guidoc.getInEdit():
guidoc.setEdit(vobj.Object.Name)
else:
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
from PySide.QtGui import QMessageBox
message = 'Active Task Dialog found! Please close this one before open a new one!'
QMessageBox.critical(None, "Error in tree view", message)
FreeCAD.Console.PrintError(message + '\n')
return True
def __getstate__(self):

View File

@@ -82,11 +82,15 @@ class _ViewProviderFemElementFluid1D:
return
def doubleClicked(self, vobj):
doc = FreeCADGui.getDocument(vobj.Object.Document)
if not doc.getInEdit():
doc.setEdit(vobj.Object.Name)
guidoc = FreeCADGui.getDocument(vobj.Object.Document)
# check if another VP is in edit mode, https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
if not guidoc.getInEdit():
guidoc.setEdit(vobj.Object.Name)
else:
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
from PySide.QtGui import QMessageBox
message = 'Active Task Dialog found! Please close this one before open a new one!'
QMessageBox.critical(None, "Error in tree view", message)
FreeCAD.Console.PrintError(message + '\n')
return True
def __getstate__(self):

View File

@@ -81,11 +81,15 @@ class _ViewProviderFemElementGeometry1D:
return
def doubleClicked(self, vobj):
doc = FreeCADGui.getDocument(vobj.Object.Document)
if not doc.getInEdit():
doc.setEdit(vobj.Object.Name)
guidoc = FreeCADGui.getDocument(vobj.Object.Document)
# check if another VP is in edit mode, https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
if not guidoc.getInEdit():
guidoc.setEdit(vobj.Object.Name)
else:
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
from PySide.QtGui import QMessageBox
message = 'Active Task Dialog found! Please close this one before open a new one!'
QMessageBox.critical(None, "Error in tree view", message)
FreeCAD.Console.PrintError(message + '\n')
return True
def __getstate__(self):

View File

@@ -80,11 +80,15 @@ class _ViewProviderFemElementGeometry2D:
return
def doubleClicked(self, vobj):
doc = FreeCADGui.getDocument(vobj.Object.Document)
if not doc.getInEdit():
doc.setEdit(vobj.Object.Name)
guidoc = FreeCADGui.getDocument(vobj.Object.Document)
# check if another VP is in edit mode, https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
if not guidoc.getInEdit():
guidoc.setEdit(vobj.Object.Name)
else:
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
from PySide.QtGui import QMessageBox
message = 'Active Task Dialog found! Please close this one before open a new one!'
QMessageBox.critical(None, "Error in tree view", message)
FreeCAD.Console.PrintError(message + '\n')
return True
def __getstate__(self):

View File

@@ -85,12 +85,15 @@ class _ViewProviderFemElementRotation1D:
return False
def doubleClicked(self, vobj):
doc = FreeCADGui.getDocument(vobj.Object.Document)
guidoc = 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)
if not guidoc.getInEdit():
guidoc.setEdit(vobj.Object.Name)
else:
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
from PySide.QtGui import QMessageBox
message = 'Active Task Dialog found! Please close this one before open a new one!'
QMessageBox.critical(None, "Error in tree view", message)
FreeCAD.Console.PrintError(message + '\n')
return True
def __getstate__(self):

View File

@@ -77,13 +77,17 @@ class _ViewProviderFemMaterial:
FreeCADGui.Control.closeDialog()
return
# overwrite the doubleClicked to make sure no other Material taskd (and thus no selection observer) is still active
# overwrite the doubleClicked of material object python to make sure no other Material taskd (and thus no selection observer) is still active
def doubleClicked(self, vobj):
doc = FreeCADGui.getDocument(vobj.Object.Document)
if not doc.getInEdit():
doc.setEdit(vobj.Object.Name)
guidoc = FreeCADGui.getDocument(vobj.Object.Document)
# check if another VP is in edit mode, https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
if not guidoc.getInEdit():
guidoc.setEdit(vobj.Object.Name)
else:
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
from PySide.QtGui import QMessageBox
message = 'Active Task Dialog found! Please close this one before open a new one!'
QMessageBox.critical(None, "Error in tree view", message)
FreeCAD.Console.PrintError(message + '\n')
return True
def __getstate__(self):

View File

@@ -63,12 +63,15 @@ class _ViewProviderFemMaterialMechanicalNonlinear:
return False
def doubleClicked(self, vobj):
doc = FreeCADGui.getDocument(vobj.Object.Document)
guidoc = 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)
if not guidoc.getInEdit():
guidoc.setEdit(vobj.Object.Name)
else:
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
from PySide.QtGui import QMessageBox
message = 'Active Task Dialog found! Please close this one before open a new one!'
QMessageBox.critical(None, "Error in tree view", message)
FreeCAD.Console.PrintError(message + '\n')
return True
def __getstate__(self):

View File

@@ -80,11 +80,15 @@ class _ViewProviderFemMeshBoundaryLayer:
return
def doubleClicked(self, vobj):
doc = FreeCADGui.getDocument(vobj.Object.Document)
if not doc.getInEdit():
doc.setEdit(vobj.Object.Name)
guidoc = FreeCADGui.getDocument(vobj.Object.Document)
# check if another VP is in edit mode, https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
if not guidoc.getInEdit():
guidoc.setEdit(vobj.Object.Name)
else:
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
from PySide.QtGui import QMessageBox
message = 'Active Task Dialog found! Please close this one before open a new one!'
QMessageBox.critical(None, "Error in tree view", message)
FreeCAD.Console.PrintError(message + '\n')
return True
def __getstate__(self):

View File

@@ -135,7 +135,10 @@ class _ViewProviderFemMeshGmsh:
print('No analysis in the active document.')
gui_doc.setEdit(vobj.Object.Name)
else:
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
from PySide.QtGui import QMessageBox
message = 'Active Task Dialog found! Please close this one before open a new one!'
QMessageBox.critical(None, "Error in tree view", message)
FreeCAD.Console.PrintError(message + '\n')
return True
def __getstate__(self):

View File

@@ -80,11 +80,15 @@ class _ViewProviderFemMeshGroup:
return
def doubleClicked(self, vobj):
doc = FreeCADGui.getDocument(vobj.Object.Document)
if not doc.getInEdit():
doc.setEdit(vobj.Object.Name)
guidoc = FreeCADGui.getDocument(vobj.Object.Document)
# check if another VP is in edit mode, https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
if not guidoc.getInEdit():
guidoc.setEdit(vobj.Object.Name)
else:
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
from PySide.QtGui import QMessageBox
message = 'Active Task Dialog found! Please close this one before open a new one!'
QMessageBox.critical(None, "Error in tree view", message)
FreeCAD.Console.PrintError(message + '\n')
return True
def __getstate__(self):

View File

@@ -81,11 +81,15 @@ class _ViewProviderFemMeshRegion:
return
def doubleClicked(self, vobj):
doc = FreeCADGui.getDocument(vobj.Object.Document)
if not doc.getInEdit():
doc.setEdit(vobj.Object.Name)
guidoc = FreeCADGui.getDocument(vobj.Object.Document)
# check if another VP is in edit mode, https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
if not guidoc.getInEdit():
guidoc.setEdit(vobj.Object.Name)
else:
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
from PySide.QtGui import QMessageBox
message = 'Active Task Dialog found! Please close this one before open a new one!'
QMessageBox.critical(None, "Error in tree view", message)
FreeCAD.Console.PrintError(message + '\n')
return True
def __getstate__(self):

View File

@@ -65,11 +65,15 @@ class _ViewProviderFemResultMechanical:
def doubleClicked(self, vobj):
if FreeCADGui.activeWorkbench().name() != 'FemWorkbench':
FreeCADGui.activateWorkbench("FemWorkbench")
doc = FreeCADGui.getDocument(vobj.Object.Document)
if not doc.getInEdit():
doc.setEdit(vobj.Object.Name)
guidoc = FreeCADGui.getDocument(vobj.Object.Document)
# check if another VP is in edit mode, https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
if not guidoc.getInEdit():
guidoc.setEdit(vobj.Object.Name)
else:
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
from PySide.QtGui import QMessageBox
message = 'Active Task Dialog found! Please close this one before open a new one!'
QMessageBox.critical(None, "Error in tree view", message)
FreeCAD.Console.PrintError(message + '\n')
return True
def setEdit(self, vobj, mode=0):

View File

@@ -89,7 +89,10 @@ class _ViewProviderFemSolverCalculix:
else:
FreeCAD.Console.PrintError('No active Analysis found!\n')
else:
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
from PySide.QtGui import QMessageBox
message = 'Active Task Dialog found! Please close this one before open a new one!'
QMessageBox.critical(None, "Error in tree view", message)
FreeCAD.Console.PrintError(message + '\n')
return True
def __getstate__(self):