From: pbruno <> Date: Mon, 26 Feb 2007 16:16:40 +0000 (+0000) Subject: add: visu rapport validation + source jdc X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2a1ce1672cdb040eadbdfe2656684ddbe1c82821;p=tools%2Feficas.git add: visu rapport validation + source jdc --- diff --git a/Interface/browser.py b/Interface/browser.py index 4dd9e1e6..a7deb375 100644 --- a/Interface/browser.py +++ b/Interface/browser.py @@ -116,17 +116,17 @@ class JDCNode(QListViewItem): self.tree = self.parent.tree self.editor = self.parent.tree.editor self.bold = bold - - name = item.GetLabelText()[0] - value = item.GetText() + + name = self.tree.trUtf8( str( item.GetLabelText()[0] ) ) + value = self.tree.trUtf8( str( item.GetText() ) ) if after is None: - QListViewItem.__init__(self,parent) - self.setText(0, name) - self.setText(1, value) + QListViewItem.__init__(self,parent) + self.setText(0, name ) + self.setText(1, value ) else: QListViewItem.__init__(self,parent, after) - self.setText(0, name) + self.setText(0, name ) self.setText(1, value) p = icons.getPixmap(item.GetIconName() + ".gif") diff --git a/Interface/editor.py b/Interface/editor.py index 7c5aa4e2..a8a09427 100644 --- a/Interface/editor.py +++ b/Interface/editor.py @@ -17,7 +17,7 @@ import prefs import configuration import panels -import afficheErreur +import qtcommun VERSION_EFICAS = "EFICAS v1.11" VERSION_CODE = session.d_env.cata @@ -34,6 +34,12 @@ class StringVar: #à cause de format_fichier (Tkinter.StringVar) appelé ailleur self.val = str def get(self): return self.val + + + + + + class JDCEditor(QSplitter): @@ -122,14 +128,10 @@ class JDCEditor(QSplitter): self.jdc.analyse() txt_exception = self.jdc.cr.get_mess_exception() if txt_exception: - # PN attention reporter ici les tests pour batch / ou non - # if self.appli.test == 0 : - qApp.restoreOverrideCursor() - monDialog=afficheErreur.afficheErreur(parent=self.parent,fl=Qt.WType_Dialog) - monDialog.texteErreur.setText(QString(txt_exception)) - monDialog.show() self.jdc = None - self.closeIt() + qApp.restoreOverrideCursor() + self.affiche_infos("Erreur fatale au chargement de %s" %fn) + QMessageBox.critical( self, "Erreur fatale au chargement d'un fichier", txt_exception) else: comploader.charger_composants() jdc_item=Objecttreeitem.make_objecttreeitem( self, "nom", self.jdc ) @@ -376,11 +378,25 @@ class JDCEditor(QSplitter): ## self.setModified(0) self.modified = False - qApp.restoreOverrideCursor() - + qApp.restoreOverrideCursor() self.lastModified = self.fileInfo.lastModified() return jdc + def _viewText(self, txt, caption = "FILE_VIEWER"): + w = qtcommun.ViewText( self.parent ) + w.setCaption( caption ) + w.setText(txt) + w.show() + + def viewJdcSource(self): + format = self.format_fichier.get() + strSource = str( self.get_text_JDC(format) ) + self._viewText(strSource, "JDC_SOURCE") + + def viewJdcRapport(self): + strRapport = str( self.jdc.report() ) + self._viewText(strRapport, "JDC_RAPPORT") + def visuCR(self,mode): """ Méthode permettant l'affichage du rapport de validation diff --git a/Interface/myMain.ui b/Interface/myMain.ui index 4ca8b226..0d262037 100644 --- a/Interface/myMain.ui +++ b/Interface/myMain.ui @@ -54,6 +54,8 @@ + + @@ -368,6 +370,34 @@ Close All + + + jdcRapportDeValidationAction + + + Rapport de validation + + + Rapport de validation + + + Ctrl+R + + + + + jdcFichierSourceAction + + + Fichier source + + + Fichier source + + + Ctrl+B + + @@ -501,6 +531,18 @@ Eficas editCopy() + + jdcRapportDeValidationAction + activated() + Eficas + jdcRapport() + + + jdcFichierSourceAction + activated() + Eficas + jdcFichierSource() + fileNew() @@ -511,7 +553,7 @@ fileExit() editUndo() editRedo() - editCut() + jdcFichierSource() fileNewView() editPaste() editFind() @@ -520,6 +562,8 @@ helpAbout() fileClose() fileCloseAll() + jdcRapport() + editCut() editCopy() diff --git a/Interface/myMain_ui.py b/Interface/myMain_ui.py index 2822db7c..6d8984c4 100644 --- a/Interface/myMain_ui.py +++ b/Interface/myMain_ui.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'myMain.ui' # -# Created: Fri Feb 16 10:50:30 2007 +# Created: Fri Feb 23 10:56:07 2007 # by: The PyQt User Interface Compiler (pyuic) 3.13 # # WARNING! All changes made in this file will be lost! @@ -278,6 +278,8 @@ class Eficas(QMainWindow): self.fileCloseAction = QAction(self,"fileCloseAction") self.fileNewViewAction = QAction(self,"fileNewViewAction") self.fileCloseAllAction = QAction(self,"fileCloseAllAction") + self.jdcRapportDeValidationAction = QAction(self,"jdcRapportDeValidationAction") + self.jdcFichierSourceAction = QAction(self,"jdcFichierSourceAction") self.toolBar = QToolBar(QString(""),self,Qt.DockTop) @@ -321,6 +323,8 @@ class Eficas(QMainWindow): self.MenuBar.insertItem(QString(""),self.Edition,3) self.JdC = QPopupMenu(self) + self.jdcRapportDeValidationAction.addTo(self.JdC) + self.jdcFichierSourceAction.addTo(self.JdC) self.MenuBar.insertItem(QString(""),self.JdC,4) self.Options = QPopupMenu(self) @@ -359,6 +363,8 @@ class Eficas(QMainWindow): self.connect(self.fileNewViewAction,SIGNAL("activated()"),self.fileNewView) self.connect(self.fileCloseAllAction,SIGNAL("activated()"),self.fileCloseAll) self.connect(self.editCopyAction,SIGNAL("activated()"),self.editCopy) + self.connect(self.jdcRapportDeValidationAction,SIGNAL("activated()"),self.jdcRapport) + self.connect(self.jdcFichierSourceAction,SIGNAL("activated()"),self.jdcFichierSource) def languageChange(self): @@ -415,6 +421,12 @@ class Eficas(QMainWindow): self.fileNewViewAction.setText(self.__tr("New view")) self.fileCloseAllAction.setText(self.__tr("Close All")) self.fileCloseAllAction.setMenuText(self.__tr("Close All")) + self.jdcRapportDeValidationAction.setText(self.__tr("Rapport de validation")) + self.jdcRapportDeValidationAction.setMenuText(self.__tr("Rapport de validation")) + self.jdcRapportDeValidationAction.setAccel(self.__tr("Ctrl+R")) + self.jdcFichierSourceAction.setText(self.__tr("Fichier source")) + self.jdcFichierSourceAction.setMenuText(self.__tr("Fichier source")) + self.jdcFichierSourceAction.setAccel(self.__tr("Ctrl+B")) self.toolBar.setLabel(self.__tr("Tools")) if self.MenuBar.findItem(2): self.MenuBar.findItem(2).setText(self.__tr("&Fichier")) @@ -456,8 +468,8 @@ class Eficas(QMainWindow): def editRedo(self): print "Eficas.editRedo(): Not implemented yet" - def editCut(self): - print "Eficas.editCut(): Not implemented yet" + def jdcFichierSource(self): + print "Eficas.jdcFichierSource(): Not implemented yet" def fileNewView(self): print "Eficas.fileNewView(): Not implemented yet" @@ -483,6 +495,12 @@ class Eficas(QMainWindow): def fileCloseAll(self): print "Eficas.fileCloseAll(): Not implemented yet" + def jdcRapport(self): + print "Eficas.jdcRapport(): Not implemented yet" + + def editCut(self): + print "Eficas.editCut(): Not implemented yet" + def editCopy(self): print "Eficas.editCopy(): Not implemented yet" diff --git a/Interface/qtEficas.py b/Interface/qtEficas.py index 058bec83..95a3556b 100644 --- a/Interface/qtEficas.py +++ b/Interface/qtEficas.py @@ -131,6 +131,12 @@ class Appli(Eficas): def editPaste(self): self.viewmanager.handleEditPaste() + def jdcFichierSource(self): + self.viewmanager.handleViewJdcFichierSource() + + def jdcRapport(self): + self.viewmanager.handleViewJdcRapport() + diff --git a/Interface/qtcommun.py b/Interface/qtcommun.py index f2a5c3a1..990ea4ca 100644 --- a/Interface/qtcommun.py +++ b/Interface/qtcommun.py @@ -28,10 +28,77 @@ from qt import * class QTPanel: """ - Classe définissant le panel associé aux mots-clés qui demandent - à l'utilisateur de choisir une seule valeur parmi une liste de valeurs - discrètes + Classe définissant le panel associé aux mots-clés qui demandent + à l'utilisateur de choisir une seule valeur parmi une liste de valeurs + discrètes """ def __init__(self,node, parent = None): self.editor = parent self.node = node + + + + +class ViewText(QDialog): + """ + Classe permettant la visualisation de texte + """ + def __init__(self,parent = None,name = None,modal = 0,fl = 0): + QDialog.__init__(self,parent,name,modal,fl) + + l1 = QVBoxLayout(self,11,6,) + self.view = QTextEdit(self) + self.view.setReadOnly(True) + + l2 = QHBoxLayout(None,0,6) + Horizontal_Spacing2 = QSpacerItem(220,20,QSizePolicy.Expanding,QSizePolicy.Minimum) + bclose= QPushButton(self) + bclose.setText(self.trUtf8( "Fermer")) + bsave= QPushButton(self) + bsave.setText(self.trUtf8( "Sauver")) + l2.addItem(Horizontal_Spacing2) + l2.addWidget(bsave) + l2.addWidget(bclose) + + l1.addWidget(self.view) + l1.addLayout(l2) + + self.resize( QSize(600,507).expandedTo(self.minimumSizeHint()) ) + self.connect( bclose,SIGNAL("clicked()"), self, SLOT("close()") ) + self.connect( bsave,SIGNAL("clicked()"), self.saveFile ) + + def setText(self, txt ): + self.view.setText(txt) + + def saveFile(self): + #récupération du nom du fichier + fn = QFileDialog.getSaveFileName(None, + self.trUtf8("All Files (*)"), self, None, + self.trUtf8("Save File"), '', 0) + if not fn.isNull(): + if QFileInfo(fn).exists(): + abort = QMessageBox.warning(self, + self.trUtf8("Save File"), + self.trUtf8("The file %1 already exists.") + .arg(fn), + self.trUtf8("&Overwrite"), + self.trUtf8("&Abort"), None, 1) + if abort: + print 'AAAAAAAAAAA' + return + fn = unicode(QDir.convertSeparators(fn)) + else: + print 'BBBBBBBBBBB' + return + #ecriture du fichier + try: + print 'CCCCCCCCCCCCC' + f = open(fn, 'wb') + f.write(str(self.view.text())) + f.close() + return 1 + except IOError, why: + QMessageBox.critical(self, self.trUtf8('Save File'), + self.trUtf8('The file %1 could not be saved.
Reason: %2') + .arg(unicode(fn)).arg(str(why))) + return diff --git a/Interface/viewManager.py b/Interface/viewManager.py index c068158c..bd82fd07 100644 --- a/Interface/viewManager.py +++ b/Interface/viewManager.py @@ -2457,7 +2457,11 @@ class ViewManager: ## self.recent = QStringList() - + def handleViewJdcFichierSource(self): + self.activeWindow().viewJdcSource() + + def handleViewJdcRapport(self): + self.activeWindow().viewJdcRapport() def handleNewProject(self): """