]> SALOME platform Git repositories - tools/eficas.git/commitdiff
Salome HOME
add: visu rapport validation + source jdc
authorpbruno <>
Mon, 26 Feb 2007 16:16:40 +0000 (16:16 +0000)
committerpbruno <>
Mon, 26 Feb 2007 16:16:40 +0000 (16:16 +0000)
Interface/browser.py
Interface/editor.py
Interface/myMain.ui
Interface/myMain_ui.py
Interface/qtEficas.py
Interface/qtcommun.py
Interface/viewManager.py

index 4dd9e1e64197f496aefc76e924f9fe135ec9ad6e..a7deb37579919d0f7a3c5327e5c9e56a1ad6461e 100644 (file)
@@ -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")
index 7c5aa4e2f05f732691b00a7db67ddb3b6fb92dd1..a8a09427f79587e3c7a9bd0e7372e1560ccf0355 100644 (file)
@@ -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
index 4ca8b226fc4793ea6bcfd99b4069290605996374..0d262037f3ff173523b2d9551353b3576477b8a9 100644 (file)
@@ -54,6 +54,8 @@
         <action name="editFindAction"/>
     </item>
     <item text="JdC" name="JdC">
+        <action name="jdcRapportDeValidationAction"/>
+        <action name="jdcFichierSourceAction"/>
     </item>
     <item text="Options" name="Options">
     </item>
             <string>Close All</string>
         </property>
     </action>
+    <action>
+        <property name="name">
+            <cstring>jdcRapportDeValidationAction</cstring>
+        </property>
+        <property name="text">
+            <string>Rapport de validation</string>
+        </property>
+        <property name="menuText">
+            <string>Rapport de validation</string>
+        </property>
+        <property name="accel">
+            <string>Ctrl+R</string>
+        </property>
+    </action>
+    <action>
+        <property name="name">
+            <cstring>jdcFichierSourceAction</cstring>
+        </property>
+        <property name="text">
+            <string>Fichier source</string>
+        </property>
+        <property name="menuText">
+            <string>Fichier source</string>
+        </property>
+        <property name="accel">
+            <string>Ctrl+B</string>
+        </property>
+    </action>
 </actions>
 <images>
     <image name="image0">
         <receiver>Eficas</receiver>
         <slot>editCopy()</slot>
     </connection>
+    <connection>
+        <sender>jdcRapportDeValidationAction</sender>
+        <signal>activated()</signal>
+        <receiver>Eficas</receiver>
+        <slot>jdcRapport()</slot>
+    </connection>
+    <connection>
+        <sender>jdcFichierSourceAction</sender>
+        <signal>activated()</signal>
+        <receiver>Eficas</receiver>
+        <slot>jdcFichierSource()</slot>
+    </connection>
 </connections>
 <slots>
     <slot>fileNew()</slot>
     <slot>fileExit()</slot>
     <slot>editUndo()</slot>
     <slot>editRedo()</slot>
-    <slot>editCut()</slot>
+    <slot>jdcFichierSource()</slot>
     <slot>fileNewView()</slot>
     <slot>editPaste()</slot>
     <slot>editFind()</slot>
     <slot>helpAbout()</slot>
     <slot>fileClose()</slot>
     <slot>fileCloseAll()</slot>
+    <slot>jdcRapport()</slot>
+    <slot>editCut()</slot>
     <slot>editCopy()</slot>
 </slots>
 <layoutdefaults spacing="2" margin="2"/>
index 2822db7ccbb588860d17f020a32079c1e90326c6..6d8984c4fec222143070b7763a428ef7168ea039 100644 (file)
@@ -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"
 
index 058bec83b24f33c96f1be22dcd49aae266e7725c..95a3556bd87c0109af8305186507c23fcfbb5d0a 100644 (file)
@@ -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()
+        
 
   
         
index f2a5c3a1e064f4b0554140699f0b2966f0fe8c35..990ea4ca2c5e75b2df8ef08a4ac59661faa3328c 100644 (file)
@@ -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 <b>%1</b> 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 <b>%1</b> could not be saved.<br>Reason: %2')
+                    .arg(unicode(fn)).arg(str(why)))
+            return
index c068158c2c5bfcedc06d6e34363b1eac54794e12..bd82fd07892de2a8137f736e97f00dfc23cb9460 100644 (file)
@@ -2457,7 +2457,11 @@ class ViewManager:
 ##        self.recent = QStringList()
         
         
-    
+    def handleViewJdcFichierSource(self):
+        self.activeWindow().viewJdcSource()
+                
+    def handleViewJdcRapport(self):
+        self.activeWindow().viewJdcRapport()
         
     def handleNewProject(self):
         """