]> SALOME platform Git repositories - tools/eficas.git/commitdiff
Salome HOME
*** empty log message ***
authorPascale Noyret <pascale.noyret@edf.fr>
Tue, 29 Apr 2008 14:48:34 +0000 (14:48 +0000)
committerPascale Noyret <pascale.noyret@edf.fr>
Tue, 29 Apr 2008 14:48:34 +0000 (14:48 +0000)
InterfaceQT/browser.py
InterfaceQT/monOptionsEditeur.py
InterfaceQT/monUniqueSDCOIntoPanel.py
InterfaceQT/qtEficas.py
InterfaceQT/viewManager.py

index 75618c7299a452153d394e0ece51013befe099ba..d9dcb6fff0cd86162a7d815392e408a7fc96e5dd 100644 (file)
@@ -60,9 +60,12 @@ class JDCTree( QListView ):
             pass
 
     def handleOnItem(self,  item ):
-        fr = item.item.get_fr()
-        if self.editor:
-            self.editor.affiche_infos(fr)
+        try :
+           fr = item.item.get_fr()
+           if self.editor:
+              self.editor.affiche_infos(fr)
+        except:
+            pass
         
     def build_children(self):
         """ Construit la liste des enfants de self """
index 4387494947898ecc6450b8010086e238220f0271..26a3c5faff2b4371551e72435da2bb6d44774955 100644 (file)
@@ -1,5 +1,53 @@
+# -*- coding: utf-8 -*-
+
 from OptionsEditeur import desOptions
+from qt import *
+import re
 
 class Options(desOptions):
-   def __init__(self,parent = None,name = None,modal = 0,fl = 0):
+   def __init__(self,parent = None,name = None,modal = 0,fl = 0,configuration=None):
        desOptions.__init__(self,parent,name,modal,fl)
+       self.configuration=configuration
+       self.viewMan=parent
+       self.dVersion={}
+       self.dRepMat={}
+       self.dRepCat={}
+       self.initAll()
+  
+
+   def initAll(self):
+       for item in self.configuration.catalogues :
+           try :
+              (code,version,cata,format,defaut)=item
+           except :
+              (code,version,cata,format)=item
+           self.dVersion[version]=(item)
+           self.dRepCat[version]=str(cata)
+           self.CBVersions.insertItem(QString(version),0)
+
+           codeSansPoint=re.sub("\.","",version)
+           chaine="rep_mat_"+codeSansPoint
+           if hasattr(self.configuration,chaine):
+              rep_mat=getattr(self.configuration,chaine)
+              self.dRepMat[version]=str(rep_mat)
+           else :
+              self.dRepMat[version]=""
+       self.LERepMat.setText(self.dRepMat[version])
+       self.LERepCata.setText(self.dRepCat[version])
+
+        
+   def VersionChoisie(self):
+       version=str(self.CBVersions.currentText())
+       self.LERepMat.setText(self.dRepMat[version])
+       self.LERepCata.setText(self.dRepCat[version])
+
+   def BokClicked(self):
+       version=str(self.CBVersions.currentText())
+       self.dRepMat[version]=self.LERepMat.text()
+       self.dRepCat[version]=self.LERepCata.text()
+
+       codeSansPoint=re.sub("\.","",version)
+       chaine="rep_mat_"+codeSansPoint
+       setattr(self.configuration,chaine,self.dRepMat[version])
+       self.configuration.save_params()
+
index 32120dd259dde26cad903aba488d3ec2499c6640..0a54315b7b49babdb458c3a845389129a61b3415 100644 (file)
@@ -87,10 +87,7 @@ class MonUniqueSDCOIntoPanel(DUnSDCOInto,QTPanel,SaisieSDCO):
         SaisieSDCO.LESDCOReturnPressed(self)
 
   def BOkPressed(self):
-        if self.rbOui.isChecked():
-           self.LESDCOReturnPressed()
-        else:
-           self.LBSDCOReturnPressed()
+        self.LESDCOReturnPressed()
 
   def BSupPressed(self):
         QTPanel.BSupPressed(self)
index a2ee3fa16df4e230eaa65c6d200079850027518b..f27ad84ed964afe0575ce44918091abed9dcf864 100644 (file)
@@ -139,7 +139,7 @@ class Appli(Eficas):
 
     def optionEditeur(self) :
         from monOptionsEditeur import Options
-        monOption=Options(parent=self.viewmanager,fl=Qt.WType_Dialog)
+        monOption=Options(parent=self.viewmanager,fl=Qt.WType_Dialog,configuration=self.CONFIGURATION)
         monOption.show()
         
     def optionPdf(self) :
index a6a4f5de059ab04e6fffd0879f443e83f9a4b8b8..a0bc448a862965fca63ba9b21271f3b890b63297 100644 (file)
@@ -92,6 +92,7 @@ class ViewManager:
         self.ui = ui
         self.appliEficas = ui
         self.editors = []
+        self.doubles = {}
         self.currentEditor = None
         self.untitledCount = 0
         self.srHistory = {"search" : QStringList(), "replace" : QStringList()}
@@ -630,6 +631,16 @@ class ViewManager:
         @param editor editor window to check
         @return flag indicating successful reset of the dirty flag (boolean)
         """        
+     
+        if (editor.modified) and (editor in self.doubles.keys()) :
+            res = QMessageBox.warning(
+                     None,
+                     self.trUtf8("Fichier Duplique"),
+                     self.trUtf8("Le fichier ne sera pas sauvegarde."),
+                     self.trUtf8("&Quitter"), 
+                     self.trUtf8("&Abandonner"))
+            if res == 0 : return 1
+            return 0
         if editor.modified:
             fn = editor.getFileName()
             if fn is None:
@@ -691,7 +702,6 @@ class ViewManager:
             return 0
             
         res = self.closeEditor(aw)
-        print "________________", res
         if res and aw == self.currentEditor:
             self.currentEditor = None
             
@@ -928,20 +938,23 @@ class ViewManager:
             a reference to the editor displaying this file
         """
         newWin = 0
+        double=None
         for editor in self.editors:
             if samepath(fn, editor.getFileName()):
                abort = QMessageBox.warning(self,
                         self.trUtf8("Fichier"),
-                        self.trUtf8("Le fichier <b>%1</b> est deja ouvert.")
-                            .arg(fn),
+                        self.trUtf8("Le fichier <b>%1</b> est deja ouvert.Voulez-vous l ouvrir tel qu'il etait lors du dernier enregistrement") .arg(fn),
                         self.trUtf8("&Duplication"),
                         self.trUtf8("&Abort"), None, 1)
                if abort:
                         break
+               double=editor
         else:
             from editor import JDCEditor
             editor = JDCEditor(fn, jdc, self,units=units)
-            
+            if double != None :
+               self.doubles[editor]=double
+               #self.doubles[double]=editor
             if editor.jdc: # le fichier est bien un jdc            
                 self.editors.append(editor)
                 self.connect(editor, PYSIGNAL('modificationStatusChanged'),
@@ -1017,6 +1030,13 @@ class ViewManager:
         Public slot to save the contents of the current editor.
         """
         aw = self.activeWindow()
+        if aw in self.doubles.keys() :
+           QMessageBox.warning(
+                     None,
+                     self.trUtf8("Fichier Duplique"),
+                     self.trUtf8("Le fichier ne sera pas sauvegarde."),
+                     self.trUtf8("&Abandonner"))
+           return
         if aw:
             ok, newName = aw.saveFile()
             if ok:
@@ -2149,6 +2169,7 @@ class Tabview(QSplitter, ViewManager):
             if not QFileInfo(fn).isWritable():
                 txt = '%s (ro)' % txt
             self.currentTabWidget.addTab(win, txt)
+            print win
             self.currentTabWidget.setTabToolTip(win, os.path.dirname(fn))
         self.currentTabWidget.showPage(win)
         win.setFocus()