From: Paul RASCLE Date: Fri, 8 Nov 2019 15:54:51 +0000 (+0100) Subject: TODO: fix better a strange bug with sobj==None when right clic on 3Dview in HYDROSOLV... X-Git-Tag: SH_V2_2_0~27^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8184cfff2b572f4ecc7d9a87d738f1c871d85f4b;p=modules%2Fhydrosolver.git TODO: fix better a strange bug with sobj==None when right clic on 3Dview in HYDROSOLVER used after HYDRO (generate AssignStrickler) --- 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