From: Pascale Noyret Date: Tue, 29 Apr 2008 14:48:34 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: V1_14a3~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3911cc1edc8895096101fee9c6b187fe2d49a344;p=tools%2Feficas.git *** empty log message *** --- diff --git a/InterfaceQT/browser.py b/InterfaceQT/browser.py index 75618c72..d9dcb6ff 100644 --- a/InterfaceQT/browser.py +++ b/InterfaceQT/browser.py @@ -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 """ diff --git a/InterfaceQT/monOptionsEditeur.py b/InterfaceQT/monOptionsEditeur.py index 43874949..26a3c5fa 100644 --- a/InterfaceQT/monOptionsEditeur.py +++ b/InterfaceQT/monOptionsEditeur.py @@ -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() + diff --git a/InterfaceQT/monUniqueSDCOIntoPanel.py b/InterfaceQT/monUniqueSDCOIntoPanel.py index 32120dd2..0a54315b 100644 --- a/InterfaceQT/monUniqueSDCOIntoPanel.py +++ b/InterfaceQT/monUniqueSDCOIntoPanel.py @@ -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) diff --git a/InterfaceQT/qtEficas.py b/InterfaceQT/qtEficas.py index a2ee3fa1..f27ad84e 100644 --- a/InterfaceQT/qtEficas.py +++ b/InterfaceQT/qtEficas.py @@ -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) : diff --git a/InterfaceQT/viewManager.py b/InterfaceQT/viewManager.py index a6a4f5de..a0bc448a 100644 --- a/InterfaceQT/viewManager.py +++ b/InterfaceQT/viewManager.py @@ -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 %1 est deja ouvert.") - .arg(fn), + self.trUtf8("Le fichier %1 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()