From b437eadaffbfaee9a9cdd053c9bf894fab881b65 Mon Sep 17 00:00:00 2001 From: Renaud Barate Date: Tue, 29 Jun 2010 12:49:03 +0000 Subject: [PATCH] Added more customization possibilities for user defined types --- Ihm/I_MCSIMP.py | 2 +- InterfaceQT4/monUniqueBasePanel.py | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Ihm/I_MCSIMP.py b/Ihm/I_MCSIMP.py index 9ad84e1e..3c4052a3 100644 --- a/Ihm/I_MCSIMP.py +++ b/Ihm/I_MCSIMP.py @@ -57,7 +57,7 @@ class MCSIMP(I_OBJECT.OBJECT): if self.state == 'unchanged': return self.valid for type_permis in self.definition.type: - if type_permis.__class__.__name__ == 'Matrice' : + if hasattr(type_permis, "__class__") and type_permis.__class__.__name__ == 'Matrice': self.monType=type_permis return self.valideMatrice(cr=cr) return Validation.V_MCSIMP.MCSIMP.isvalid(self,cr=cr) diff --git a/InterfaceQT4/monUniqueBasePanel.py b/InterfaceQT4/monUniqueBasePanel.py index 255d8f02..39892c22 100644 --- a/InterfaceQT4/monUniqueBasePanel.py +++ b/InterfaceQT4/monUniqueBasePanel.py @@ -88,8 +88,12 @@ class MonUniqueBasePanel(DUnBase,QTPanel,SaisieValeur): else : self.bParametres.close() type = mc.type[0] - if not(('grma' in repr(type)) or ('grno' in repr(type))) or not(self.editor.salome) : + enable_salome_selection = self.editor.salome and \ + (('grma' in repr(type)) or ('grno' in repr(type)) or + (hasattr(type, "enable_salome_selection") and type.enable_salome_selection)) + if not enable_salome_selection: self.BSalome.close() + if not(('grma' in repr(type)) or ('grno' in repr(type))) or not(self.editor.salome) : self.BView2D.close() def InitLineEditVal(self): @@ -113,8 +117,12 @@ class MonUniqueBasePanel(DUnBase,QTPanel,SaisieValeur): 'I' : "Un entier est attendu", 'Matrice' : 'Une Matrice est attendue', 'Fichier' : 'Un fichier est attendu'} - type = mc.type[0] - commentaire=d_aides.get(type,"Type de base inconnu") + mctype = mc.type[0] + + if type(mctype) == types.ClassType: + commentaire = getattr(mctype, 'help_message', "Type de base inconnu") + else: + commentaire = d_aides.get(mctype, "Type de base inconnu") aideval=self.node.item.aide() commentaire=commentaire +"\n"+ QString.toUtf8(QString(aideval)) self.Commentaire.setText(QString.fromUtf8(QString(commentaire))) -- 2.39.2