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")
import configuration
import panels
-import afficheErreur
+import qtcommun
VERSION_EFICAS = "EFICAS v1.11"
VERSION_CODE = session.d_env.cata
self.val = str
def get(self):
return self.val
+
+
+
+
+
+
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 )
## 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
<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"/>
# 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!
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)
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)
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):
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"))
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"
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"
def editPaste(self):
self.viewmanager.handleEditPaste()
+ def jdcFichierSource(self):
+ self.viewmanager.handleViewJdcFichierSource()
+
+ def jdcRapport(self):
+ self.viewmanager.handleViewJdcRapport()
+
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
## self.recent = QStringList()
-
+ def handleViewJdcFichierSource(self):
+ self.activeWindow().viewJdcSource()
+
+ def handleViewJdcRapport(self):
+ self.activeWindow().viewJdcRapport()
def handleNewProject(self):
"""