X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=InterfaceQT4%2Feditor.py;h=346d877913147e5adaeef30f04e3a4702ca9b376;hb=39b7b166eb606b80c9ac427811651b20db79bde2;hp=076c60a25cfb5ed91c1a846138ea32d514e1fde4;hpb=42895950e564e837c445896b5bac263370bdf37b;p=tools%2Feficas.git
diff --git a/InterfaceQT4/editor.py b/InterfaceQT4/editor.py
index 076c60a2..346d8779 100755
--- a/InterfaceQT4/editor.py
+++ b/InterfaceQT4/editor.py
@@ -23,9 +23,9 @@ import traceback
from determine import monEnvQT5
if monEnvQT5:
- from PyQt5.QtWidgets import QWidget, QMessageBox, QFileDialog, QApplication
+ from PyQt5.QtWidgets import QWidget, QMessageBox, QFileDialog, QApplication, QSplitter
from PyQt5.QtGui import QPalette
- from PyQt5.QtCore import QProcess, QFileInfo, QTimer, Qt
+ from PyQt5.QtCore import QProcess, QFileInfo, QTimer, Qt, QDir, QSize
else :
from PyQt4.QtGui import *
from PyQt4.QtCore import *
@@ -49,6 +49,7 @@ import readercata
DictExtensions= {"MAP" : ".map"}
+
class JDCEditor(Ui_baseWidget,QWidget):
@@ -61,7 +62,9 @@ class JDCEditor(Ui_baseWidget,QWidget):
#----------------------------------------------------------------------------------------------------------#
QWidget.__init__(self,None)
+ self.i=0
self.setupUi(self)
+ self.inhibeSplitter=0
self.widgetOptionnel=None
self.fenetreCentraleAffichee=None
self.dejaDansPlieTout=False
@@ -98,7 +101,7 @@ class JDCEditor(Ui_baseWidget,QWidget):
self.widgetTree=None
self.appliEficas.resize(1440,self.appliEficas.height())
else :
- self.appliEficas.resize(2000,self.appliEficas.height())
+ self.appliEficas.resize(1800,self.appliEficas.height())
self.version_code = session.d_env.cata
@@ -115,6 +118,8 @@ class JDCEditor(Ui_baseWidget,QWidget):
self.format = self.appliEficas.format_fichier
self.dict_reels={}
+ self.splitterSizes = [320,1320,320]
+ self.oldSizeWidgetOptionnel = 320
self.liste_simp_reel=[]
self.ihm="QT"
@@ -210,11 +215,13 @@ class JDCEditor(Ui_baseWidget,QWidget):
- if jdc_item:
+ if jdc_item and self.appliEficas.ssIhm==False:
self.tree = browser.JDCTree( jdc_item, self )
self.appliEficas.construitMenu()
- self.splitterSizes = []
-
+ self.saveSplitterSizes()
+ #if monEnvQT5:
+ # self.splitter./s
+ #else :
#-------------------# Pour execution avec output et error dans le bash
@@ -631,10 +638,8 @@ class JDCEditor(Ui_baseWidget,QWidget):
if (self.QWParent.edit != "couper"):
try:
if noeudOuColler == self.tree.racine :
- print 1
child=noeudOuColler.doPastePremier(noeudACopier)
else :
- print 2
child=noeudACopier.doPaste(noeudOuColler,pos)
if child==None or child==0:
QMessageBox.critical( self,tr( "Copie refusee"),tr('Eficas n a pas reussi a copier l objet'))
@@ -953,15 +958,23 @@ class JDCEditor(Ui_baseWidget,QWidget):
tr("sauvegarde"), path,
extensions,None,
QFileDialog.DontConfirmOverwrite)
- if fn.isNull(): return (0, None)
if fn == None : return (0, None)
if monEnvQT5 : fn=fn[0]
+ if fn=='': return (0, None)
ext = QFileInfo(fn).suffix()
- if ext.isEmpty(): fn.append(extension)
+ if ext == '': fn+=extension
if QFileInfo(fn).exists():
- abort = QMessageBox.warning(self,
+ if monEnvQT5 :
+ msgBox = QMessageBox(self)
+ msgBox.setWindowTitle(tr("Sauvegarde du Fichier"))
+ msgBox.setText(tr("Le fichier %s existe deja.", unicode(fn)))
+ msgBox.addButton(tr("&Ecraser"),0)
+ msgBox.addButton(tr("&Abandonner"),1)
+ abort=msgBox.exec_()
+ else :
+ abort = QMessageBox.warning(self,
tr("Sauvegarde du Fichier"),
tr("Le fichier %s existe deja.",str(fn)),
tr("&Ecraser"),
@@ -1126,16 +1139,15 @@ class JDCEditor(Ui_baseWidget,QWidget):
newName = None
fn = self.fichier
if self.fichier is None or saveas:
- if path is None:
- path=self.CONFIGURATION.savedir
+ if path is None: path=self.CONFIGURATION.savedir
bOK, fn=self.determineNomFichier(path,extension)
if bOK == 0 : return (0, None)
if fn == None : return (0, None)
- if fn.isNull(): return (0, None)
+ if fn== '' : return (0, None)
ulfile = os.path.abspath(unicode(fn))
self.appliEficas.CONFIGURATION.savedir=os.path.split(ulfile)[0]
- fn = unicode(QDir.convertSeparators(fn))
+ fn = unicode(QDir.toNativeSeparators(fn))
newName = fn
@@ -1153,6 +1165,8 @@ class JDCEditor(Ui_baseWidget,QWidget):
if self.jdc.isvalid() != 0 and hasattr(self.generator, "writeDefault"):
self.generator.writeDefault(fn)
+ if self.code=="TELEMAC" and hasattr(self.generator, "writeDefault"):
+ self.generator.writeDefault(fn)
if self.salome :
self.appliEficas.addJdcInSalome( self.fichier)
@@ -1212,7 +1226,7 @@ class JDCEditor(Ui_baseWidget,QWidget):
self.appliEficas.CONFIGURATION.savedir)
# ce retour est impose par le get_file d'I_JDC
- if fn.isNull(): return None," "
+ if fn== '' : return None," "
if not fn : return (0, " ")
if monEnvQT5 : fn=fn[0]
@@ -1385,24 +1399,59 @@ class JDCEditor(Ui_baseWidget,QWidget):
self.nomMaillage="A_partir_de_SMESH"
self.openfile.close()
- #-----------------------------
- def saveSplitterSizes(self):
- #----------------------------
- if self.splitter != None :
- self.splitterSizes = self.splitter.sizes()
-
+ #-------------------------------------
+ def saveSplitterSizes(self,event=None):
+ #------------------------------------
+ if self.inhibeSplitter : return
+ if not hasattr(self,'splitter') : return
+ if self.splitterSizes[2] != 0 : self.oldSizeWidgetOptionnel = self.splitterSizes[2]
+ # print self.splitterSizes
+ #print self.splitter.sizes()
+ # PNPNPNPN parfoir self.splitter.sizes() a une longueur de 4...
+ nbAGarder=len(self.splitter.sizes())
+ if nbAGarder > 3 : nbAGarder=3
+ for i in range(nbAGarder):
+ self.splitterSizes[i] = self.splitter.sizes()[i]
+ self.splitter.widget(i).resizeEvent=self.saveSplitterSizes
+
+
+ #-----------------------------------------
+ def restoreSplitterSizes(self,nbWigdet=3):
+ #----------------------------------------
+ self.inhibeSplitter = 1
+ self.i+=1
+ if not(hasattr(self,'splitter')) : return
+ newSizes=self.splitterSizes[:nbWigdet]
+ self.splitter.setSizes(newSizes)
+ self.inhibeSplitter = 0
+
+ #------------------------
+ def fermeOptionnel(self):
+ #------------------------
+ if self.widgetOptionnel == None : return
+
+ self.inhibeSplitter=1
+ self.splitterSizes[1] = self.splitterSizes[1] + self.splitterSizes[2]
+ if self.splitterSizes[2]!=0 : self.oldSizeWidgetOptionnel = self.splitterSizes[2]
+ self.splitterSizes[2]=0
+
+ self.widgetOptionnel.setParent(None)
+ self.widgetOptionnel.close()
+ self.widgetOptionnel.deleteLater()
+ self.widgetOptionnel=None
+ self.inhibeSplitter=0
+ self.restoreSplitterSizes(2)
+
+ #------------------------
+ def ajoutOptionnel(self):
+ #------------------------
+ #print "ajoutOptionnel"
+ #print self.splitterSizes
+ self.splitterSizes[2] = self.oldSizeWidgetOptionnel
+ self.splitterSizes[1] = self.splitterSizes[1] - self.splitterSizes[2]
+ self.inhibeSplitter=0
+ self.restoreSplitterSizes(3)
- #-----------------------------
- def restoreSplitterSizes(self):
- #----------------------------
- if hasattr(self,'splitterSizes') :
- lenSizes = len(self.splitterSizes)
- if lenSizes > 0 :
- if self.splitter != None and self.splitter.count() >= lenSizes :
- newSizes = self.splitter.sizes()
- newSizes[:len(self.splitterSizes)-1] = self.splitterSizes[:len(self.splitterSizes)-1]
- newSizes[len(newSizes)-1] = self.splitterSizes[len(self.splitterSizes)-1]
- self.splitter.setSizes(newSizes)
#-----------------------------
def getTreeIndex(self,noeud):