From: Renaud Barate Date: Tue, 24 Jan 2012 10:30:56 +0000 (+0000) Subject: Add possibility to create new specialized file types X-Git-Tag: LOGILAB~239 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7744f27fe329580bd8e68fc522dd2244123bfacf;p=tools%2Feficas.git Add possibility to create new specialized file types --- diff --git a/InterfaceQT4/monUniqueBasePanel.py b/InterfaceQT4/monUniqueBasePanel.py index 3f2e60df..5268ea9e 100644 --- a/InterfaceQT4/monUniqueBasePanel.py +++ b/InterfaceQT4/monUniqueBasePanel.py @@ -86,24 +86,24 @@ class MonUniqueBasePanel(DUnBase,QTPanel,SaisieValeur): icon = QIcon(self.RepIcon+"/image240.png") self.BSalome.setIcon(icon) mc = self.node.item.get_definition() - #if ( (self.node.item.get_nom() != "FileName" ) and ( mc.type[0]!="Fichier")) : - if mc.type[0] == "Fichier" or mc.type[0] == "FichierNoAbs": + mctype = mc.type[0] + if mctype == "Fichier" or mctype == "FichierNoAbs" or \ + (hasattr(mctype, "enable_file_selection") and mctype.enable_file_selection): self.bParametres.close() self.BRepertoire.close() - elif mc.type[0] == "Repertoire": + elif mctype == "Repertoire": self.bParametres.close() self.BFichier.close() else : self.BFichier.close() self.BRepertoire.close() - type = mc.type[0] # TODO: Use type properties instead of hard-coded "grno" and "grma" type check 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)) + (('grma' in repr(mctype)) or ('grno' in repr(mctype)) or + (hasattr(mctype, "enable_salome_selection") and mctype.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) : + if not(('grma' in repr(mctype)) or ('grno' in repr(mctype))) or not(self.editor.salome): self.BView2D.close() def InitLineEditVal(self): @@ -153,12 +153,14 @@ class MonUniqueBasePanel(DUnBase,QTPanel,SaisieValeur): SaisieValeur.BOk2Pressed(self) def BFichierPressed(self): - type = self.node.item.get_definition().type - if len(type) > 1: - filters = type[1] + mctype = self.node.item.get_definition().type + if len(mctype) > 1: + filters = mctype[1] + elif hasattr(mctype[0], "filters"): + filters = mctype[0].filters else: filters = QString() - if len(type) > 2 and type[2] == "Sauvegarde": + if len(mctype) > 2 and mctype[2] == "Sauvegarde": fichier = QFileDialog.getSaveFileName(self.appliEficas, self.appliEficas.trUtf8('Sauvegarder Fichier'), self.appliEficas.CONFIGURATION.savedir, @@ -173,6 +175,7 @@ class MonUniqueBasePanel(DUnBase,QTPanel,SaisieValeur): ulfile = os.path.abspath(unicode(fichier)) self.appliEficas.CONFIGURATION.savedir=os.path.split(ulfile)[0] self.lineEditVal.setText(fichier) + self.Commentaire.setText(u"Fichier sélectionné") if (QFileInfo(fichier).suffix() in listeSuffixe ): self.image=fichier if (not hasattr(self,"BSelectInFile")): @@ -218,7 +221,7 @@ class MonUniqueBasePanel(DUnBase,QTPanel,SaisieValeur): def BSalomePressed(self): self.Commentaire.setText(QString("")) genea=self.node.item.get_genealogie() - kwType = None + kwType = self.node.item.get_definition().type[0] for e in genea: if "GROUP_NO" in e: kwType = "GROUP_NO" if "GROUP_MA" in e: kwType = "GROUP_MA" diff --git a/UiQT4/desUniqueBase.ui b/UiQT4/desUniqueBase.ui index f00fb15c..52468231 100644 --- a/UiQT4/desUniqueBase.ui +++ b/UiQT4/desUniqueBase.ui @@ -6,8 +6,8 @@ 0 0 - 482 - 480 + 782 + 534 @@ -46,8 +46,8 @@ - - + + Qt::Horizontal @@ -60,7 +60,7 @@ - + @@ -77,8 +77,8 @@ - - + + 0 @@ -88,35 +88,16 @@ 140 - 45 + 40 - Paramètres + Visualiser - - - - Qt::Horizontal - - - - 138 - 20 - - - - - - - - - 0 - 0 - - + + 140 @@ -124,11 +105,11 @@ - Visualiser + Paramètres - + @@ -151,8 +132,14 @@ - + + + + 140 + 40 + + Répertoire