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 """
+# -*- 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()
+
SaisieSDCO.LESDCOReturnPressed(self)
def BOkPressed(self):
- if self.rbOui.isChecked():
- self.LESDCOReturnPressed()
- else:
- self.LBSDCOReturnPressed()
+ self.LESDCOReturnPressed()
def BSupPressed(self):
QTPanel.BSupPressed(self)
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) :
self.ui = ui
self.appliEficas = ui
self.editors = []
+ self.doubles = {}
self.currentEditor = None
self.untitledCount = 0
self.srHistory = {"search" : QStringList(), "replace" : QStringList()}
@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:
return 0
res = self.closeEditor(aw)
- print "________________", res
if res and aw == self.currentEditor:
self.currentEditor = None
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'),
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:
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()