From 8184cfff2b572f4ecc7d9a87d738f1c871d85f4b Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Fri, 8 Nov 2019 16:54:51 +0100 Subject: [PATCH] TODO: fix better a strange bug with sobj==None when right clic on 3Dview in HYDROSOLVER used after HYDRO (generate AssignStrickler) --- src/HYDROGUI/HYDROSOLVERGUI.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/HYDROGUI/HYDROSOLVERGUI.py b/src/HYDROGUI/HYDROSOLVERGUI.py index 6521a77..6facd59 100755 --- a/src/HYDROGUI/HYDROSOLVERGUI.py +++ b/src/HYDROGUI/HYDROSOLVERGUI.py @@ -320,17 +320,19 @@ def createPopupMenu(popup, context): if salome.sg.SelectedCount() == 1: # one object is selected sobj = ed.study.FindObjectID(salome.sg.getSelected(0)) - selectedType = ed.getTypeId(sobj) - if selectedType == hydro_study.TELMA_TYPE_ID: - popup.addAction(sgPyQt.action(GUIcontext.EDIT_TELMA_CAS_ID)) - elif selectedType == hydro_study.PARAM_STUDY_TYPE_ID: - popup.addAction(sgPyQt.action(GUIcontext.EDIT_PARAM_STUDY_ID)) - popup.addAction(sgPyQt.action(GUIcontext.GEN_PARAM_STUDY_PYTHON_ID)) - popup.addAction(sgPyQt.action(GUIcontext.GEN_PARAM_STUDY_YACS_ID)) - elif selectedType == hydro_study.STUDY_TYPE_ID: - popup.addAction(sgPyQt.action(GUIcontext.EDIT_STUDY_ID)) - popup.addAction(sgPyQt.action(GUIcontext.RUN_STUDY_ID)) - popup.addAction(sgPyQt.action(GUIcontext.GEN_STUDY_BATCH_ID)) + print("sobj: %s"%sobj) # strange bug with sobj is None when right clic on 3Dview in HYDROSOLVER used after HYDRO (generate AssignStrickler) + if sobj: + selectedType = ed.getTypeId(sobj) + if selectedType == hydro_study.TELMA_TYPE_ID: + popup.addAction(sgPyQt.action(GUIcontext.EDIT_TELMA_CAS_ID)) + elif selectedType == hydro_study.PARAM_STUDY_TYPE_ID: + popup.addAction(sgPyQt.action(GUIcontext.EDIT_PARAM_STUDY_ID)) + popup.addAction(sgPyQt.action(GUIcontext.GEN_PARAM_STUDY_PYTHON_ID)) + popup.addAction(sgPyQt.action(GUIcontext.GEN_PARAM_STUDY_YACS_ID)) + elif selectedType == hydro_study.STUDY_TYPE_ID: + popup.addAction(sgPyQt.action(GUIcontext.EDIT_STUDY_ID)) + popup.addAction(sgPyQt.action(GUIcontext.RUN_STUDY_ID)) + popup.addAction(sgPyQt.action(GUIcontext.GEN_STUDY_BATCH_ID)) # called when GUI action is activated # action ID is passed as parameter -- 2.39.2