Hi,
I've been continuing working on genPicvizParser. It has a graphical user 
interface now, with Qt 3.2 and Python. 
I'm still working on the parser generation, trying to keep all the good ideas 
I have seen in the parsers directory.
With genPicvizParser v0.3, you can browse the available fields for a logtype, 
make your selection, change the order of the axes, then generate the parser. 
After this is done, you can use the parser to generate a picviz file, and then 
you can use the picviz file to generate the graph. The last part allows the 
setup of the main picviz parameters (see man pcv) such as output plugin, 
render plugin, ...

The logtypes can ge generated by dumping (pickle.dump()) a dictionary 
containing fields names, types, ... into a file <logtype>.ltp
For instance, the iptables logtype is generated by :
$ python iptables.py
If a new logtype is to be written, the form1.py should be rewritten :
line 430:
        self.logTypeBox.insertItem(self.__tr("dansGuardian"))
        self.logTypeBox.insertItem(self.__tr("iptables"))
        self.logTypeBox.insertItem(self.__tr("argus"))
-> add here the new logtype :
        self.logTypeBox.insertItem(self.__tr("new logtype"))

Finally, genPicvizParser is launched by :
$ python mygui.py
pcv should be executable, and the files *.ltp should by copied in the directory 
from where genPicvizParser is launched.

Feel free to comment.
Happy new year,
-- 
Julien Miotte
Elève ingénieur en 5e année à l'ESIREM (Dijon)
Section InfoTronique,
Spécialité Sécurité et Qualité des Architectures des Réseaux.

from qt import *
from form1 import *
import sys
import pickle
import os
if __name__ == "__main__":
    app = QApplication(sys.argv)
    f = Form1()
    f.show()
    app.setMainWidget(f)
    app.exec_loop()
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'form1.ui'
#
#      Created: mar déc 30 18:53:29 2008
#           by: The PyQt User Interface Compiler (pyuic) 3.17.4
# Modified by : Julien Miotte
# WARNING! All changes made in this file will be lost!

from qt import *
import pickle, os
global VER
VER="0.3"

image0_data = [
"30 30 2 1",
"# c #000000",
". c #ffffff",
"..............................",
"..............................",
"..............................",
"..............................",
"..............................",
"..............................",
".................#............",
".................##...........",
".................###..........",
".................####.........",
".................#####........",
".................######.......",
".................#######......",
"...######################.....",
"...#######################....",
"...######################.....",
".................#######......",
".................######.......",
".................#####........",
".................####.........",
".................###..........",
".................##...........",
".................#............",
"..............................",
"..............................",
"..............................",
"..............................",
"..............................",
"..............................",
".............................."
]
image1_data = [
"30 30 2 1",
"# c #000000",
". c #ffffff",
"..............................",
"..............................",
"..............................",
"..............................",
"..............................",
"............#.................",
"...........##.................",
"..........###.................",
".........####.................",
"........#####.................",
".......######.................",
"......#######.................",
".....######################...",
"....#######################...",
".....######################...",
"......#######.................",
".......######.................",
"........#####.................",
".........####.................",
"..........###.................",
"...........##.................",
"............#.................",
"..............................",
"..............................",
"..............................",
"..............................",
"..............................",
"..............................",
"..............................",
".............................."
]
image2_data = [
"30 30 2 1",
"# c #000000",
". c #ffffff",
"..............................",
"..............................",
"..............................",
"..............................",
".............###..............",
".............###..............",
".............###..............",
".............###..............",
".............###..............",
".............###..............",
".............###..............",
".............###..............",
".............###..............",
".............###..............",
".............###..............",
".............###..............",
".............###..............",
".............###..............",
"......#################.......",
".......###############........",
"........#############.........",
".........###########..........",
"..........#########...........",
"...........#######............",
"............#####.............",
".............###..............",
"..............#...............",
"..............................",
"..............................",
".............................."
]
image3_data = [
"30 30 2 1",
"# c #000000",
". c #ffffff",
"..............................",
"..............................",
"..............................",
"..............#...............",
".............###..............",
"............#####.............",
"...........#######............",
"..........#########...........",
".........###########..........",
"........#############.........",
".......###############........",
"......#################.......",
".............###..............",
".............###..............",
".............###..............",
".............###..............",
".............###..............",
".............###..............",
".............###..............",
".............###..............",
".............###..............",
".............###..............",
".............###..............",
".............###..............",
".............###..............",
".............###..............",
"..............................",
"..............................",
"..............................",
".............................."
]

class Form1(QDialog):
    def __init__(self,parent = None,name = None,modal = 0,fl = 0):
        QDialog.__init__(self,parent,name,modal,fl)

        if not name:
            self.setName("Form1")

	self.rightArrow = QPixmap(image0_data)
        self.leftArrow = QPixmap(image1_data)
        self.downArrow = QPixmap(image2_data)
        self.upArrow = QPixmap(image3_data)
	
        self.fileDialog1 = QFileDialog(self,"fileDialog1",True)
        self.fileDialog1.setDir(".")



        self.tabWidget2 = QTabWidget(self,"tabWidget2")
        self.tabWidget2.setGeometry(QRect(10,20,540,490))
        self.tab = QWidget(self.tabWidget2,"tab")

        # Parser Edit Tab
        ## Logtype Line
        self.textLabel1_3_2 = QLabel(self.tab,"textLabel1_3_2")
        self.textLabel1_3_2.setGeometry(QRect(18,14,110,20))
        self.logTypeBox = QComboBox(0,self.tab,"logTypeBox")
        self.logTypeBox.setGeometry(QRect(140,10,120,24))

        ## Load Parser Line
        self.textLabel1_3 = QLabel(self.tab,"textLabel1_3")
        self.textLabel1_3.setGeometry(QRect(20,50,90,20))


        ## add/rem/up/down fields
        self.availableFieldsBox = QListBox(self.tab,"availableFieldsBox")
        self.availableFieldsBox.setGeometry(QRect(18,114,200,280))

        self.selectedFieldsBox = QListBox(self.tab,"selectedFieldsBox")
        self.selectedFieldsBox.setGeometry(QRect(310,110,210,280))

        self.textLabel1 = QLabel(self.tab,"textLabel1")
        self.textLabel1.setGeometry(QRect(18,84,140,20))

        self.textLabel1_2 = QLabel(self.tab,"textLabel1_2")
        self.textLabel1_2.setGeometry(QRect(308,84,140,20))
	
        self.addFieldButton = QPushButton(self.tab,"addFieldButton")
        self.addFieldButton.setGeometry(QRect(250,120,30,30))
        self.addFieldButton.setAutoDefault(0)
	self.addFieldButton.setIconSet(QIconSet(self.rightArrow))
	
	self.remFieldButton = QPushButton(self.tab,"remFieldButton")
        self.remFieldButton.setGeometry(QRect(250,160,30,30))
        self.remFieldButton.setAutoDefault(0)
	self.remFieldButton.setIconSet(QIconSet(self.leftArrow))
	
	self.upFieldButton = QPushButton(self.tab,"addFieldButton")
        self.upFieldButton.setGeometry(QRect(250,200,30,30))
        self.upFieldButton.setAutoDefault(0)
	self.upFieldButton.setIconSet(QIconSet(self.upArrow))
	
	self.downFieldButton = QPushButton(self.tab,"remFieldButton")
        self.downFieldButton.setGeometry(QRect(250,240,30,30))
        self.downFieldButton.setAutoDefault(0)
        self.downFieldButton.setIconSet(QIconSet(self.downArrow))

        ## Save Parser Line
        self.textLabel1_3_3 = QLabel(self.tab,"textLabel1_3_3")
        self.textLabel1_3_3.setGeometry(QRect(20,430,90,20))
        
        self.saveParserEdit = QLineEdit(self.tab,"saveParserEdit")
        self.saveParserEdit.setGeometry(QRect(110,430,200,21))
        self.saveParserEdit.setReadOnly(0)

        self.saveParserButton = QPushButton(self.tab,"saveParserButton")
        self.saveParserButton.setGeometry(QRect(320,430,20,20))
        self.saveParserButton.setAutoDefault(0)


        self.loadParserEdit = QLineEdit(self.tab,"loadParserEdit")
        self.loadParserEdit.setGeometry(QRect(110,50,290,21))
        self.loadParserEdit.setReadOnly(0)

        self.loadParserButton = QPushButton(self.tab,"loadParserButton")
        self.loadParserButton.setGeometry(QRect(410,50,20,20))
        self.loadParserButton.setAutoDefault(0)


        self.generateParserButton = QPushButton(self.tab,"generateParserButton")
        self.generateParserButton.setGeometry(QRect(360,420,161,31))
        self.generateParserButton.setAutoDefault(0)

        self.tabWidget2.insertTab(self.tab,QString.fromLatin1(""))

        self.TabPage = QWidget(self.tabWidget2,"TabPage")


        # Log Parse Tab
        ## Parser To Use Line
        self.textLabel10 = QLabel(self.TabPage,"textLabel10")
        self.textLabel10.setGeometry(QRect(100,190,120,20))

        self.parserToUseEdit = QLineEdit(self.TabPage,"parserToUseEdit")
        self.parserToUseEdit.setGeometry(QRect(230,190,170,20))

        self.parserToUseButton = QPushButton(self.TabPage,"parserToUseButton")
        self.parserToUseButton.setGeometry(QRect(410,190,21,20))
        self.parserToUseButton.setAutoDefault(0)

        ## Log To Parse Line
        self.textLabel11 = QLabel(self.TabPage,"textLabel11")
        self.textLabel11.setGeometry(QRect(100,220,120,20))

        self.logToParseEdit = QLineEdit(self.TabPage,"logToParseEdit")
        self.logToParseEdit.setGeometry(QRect(230,220,170,20))

        self.logToParseButton = QPushButton(self.TabPage,"logToParseButton")
        self.logToParseButton.setGeometry(QRect(410,220,20,20))
        self.logToParseButton.setAutoDefault(0)

        ## PCV File Line
        self.textLabel12 = QLabel(self.TabPage,"textLabel12")
        self.textLabel12.setGeometry(QRect(100,250,120,20))

        self.savePCVFileEdit = QLineEdit(self.TabPage,"savePCVFileEdit")
        self.savePCVFileEdit.setGeometry(QRect(230,250,170,20))

        self.savePCVFileButton = QPushButton(self.TabPage,"savePCVFileButton")
        self.savePCVFileButton.setGeometry(QRect(410,250,20,20))
        self.savePCVFileButton.setAutoDefault(0)

        ## ParseIt Button
        self.parseItButton = QPushButton(self.TabPage,"parseItButton")
        self.parseItButton.setGeometry(QRect(401,420,120,31))
        self.parseItButton.setAutoDefault(0)



        self.tabWidget2.insertTab(self.TabPage,QString.fromLatin1(""))
        self.TabPage_2 = QWidget(self.tabWidget2,"TabPage_2")





        # Picviz Tab
        ## PCV File Load Line
        self.textLabel9 = QLabel(self.TabPage_2,"textLabel9")
        self.textLabel9.setGeometry(QRect(100,100,100,20))

        self.loadPCVFileEdit = QLineEdit(self.TabPage_2,"loadPCVFileEdit")
        self.loadPCVFileEdit.setGeometry(QRect(210,100,180,20))

        self.loadPCVFileButton = QPushButton(self.TabPage_2,"loadPCVFileButton")
        self.loadPCVFileButton.setGeometry(QRect(400,100,20,20))
        self.loadPCVFileButton.setAutoDefault(0)


        ## Line Output Plugin
        self.textLabel1_5 = QLabel(self.TabPage_2,"textLabel1_5")
        self.textLabel1_5.setGeometry(QRect(100,150,100,20))

        self.outputPluginBox = QComboBox(0,self.TabPage_2,"outputPluginBox")
        self.outputPluginBox.setGeometry(QRect(210,150,105,20))

        ## Render Plugin Line
        self.textLabel2 = QLabel(self.TabPage_2,"textLabel2")
        self.textLabel2.setGeometry(QRect(100,180,100,20))

        self.renderPluginBox = QComboBox(0,self.TabPage_2,"renderPluginBox")
        self.renderPluginBox.setGeometry(QRect(210,180,105,20))

        ## Print Text Line
        self.textLabel3 = QLabel(self.TabPage_2,"textLabel3")
        self.textLabel3.setGeometry(QRect(100,210,100,20))

        self.printCheckBox = QCheckBox(self.TabPage_2,"printCheckBox")
        self.printCheckBox.setGeometry(QRect(210,210,20,20))

        self.textLabel6 = QLabel(self.TabPage_2,"textLabel6")
        self.textLabel6.setGeometry(QRect(240,210,40,20))

        self.everyLinesEdit = QLineEdit(self.TabPage_2,"everyLinesEdit")
        self.everyLinesEdit.setGeometry(QRect(285,210,30,20))

        self.textLabel7 = QLabel(self.TabPage_2,"textLabel7")
        self.textLabel7.setGeometry(QRect(320,210,60,20))

        ## Resolution Line
        self.textLabel5 = QLabel(self.TabPage_2,"textLabel5")
        self.textLabel5.setGeometry(QRect(130,240,70,20))

	self.resolutionSlider = QSlider(self.TabPage_2,"resolutionSlider")
	self.resolutionSlider.setGeometry(QRect(210,240,80,20))
	self.resolutionSlider.setOrientation(QSlider.Horizontal)
	self.resolutionSlider.setTracking(False)
	self.resolutionSlider.setTickmarks(QSlider.Above)
	self.resolutionSlider.setRange(0,4)
        
        ## Graph Filename Line        
        self.textLabel8 = QLabel(self.TabPage_2,"textLabel8")
        self.textLabel8.setGeometry(QRect(100,290,100,21))

        self.graphFilenameEdit = QLineEdit(self.TabPage_2,"graphFilenameEdit")
        self.graphFilenameEdit.setGeometry(QRect(210,290,110,21))

        self.graphFilenameButton = QPushButton(self.TabPage_2,"graphFilenameButton")
        self.graphFilenameButton.setGeometry(QRect(330,290,21,21))
        self.graphFilenameButton.setAutoDefault(0)    

	## Picviz Button
        self.picvizButton = QPushButton(self.TabPage_2,"picvizButton")
        self.picvizButton.setGeometry(QRect(400,420,121,31))
        self.picvizButton.setAutoDefault(0)


        self.tabWidget2.insertTab(self.TabPage_2,QString.fromLatin1(""))


        # Output Text Label
        self.outputLabel = QLabel(self,"outputLabel")
        self.outputLabel.setGeometry(QRect(10,510,370,21))




        self.languageChange()
        self.resize(QSize(561,537).expandedTo(self.minimumSizeHint()))
        self.clearWState(Qt.WState_Polished)


        # Parser Edit Tab        
        self.connect(self.logTypeBox,SIGNAL("activated(const QString&)"),self.loadLogType)
        
        self.connect(self.addFieldButton,SIGNAL("clicked()"),self.addField)
        self.connect(self.remFieldButton,SIGNAL("clicked()"),self.remField)
        self.connect(self.upFieldButton,SIGNAL("clicked()"),self.upField)
        self.connect(self.downFieldButton,SIGNAL("clicked()"),self.downField)

        self.connect(self.availableFieldsBox,SIGNAL("doubleClicked(QListBoxItem*)"),self.addField)
        self.connect(self.selectedFieldsBox,SIGNAL("doubleClicked(QListBoxItem*)"),self.remField)
        self.connect(self.availableFieldsBox, SIGNAL("onItem(QListBoxItem*)"),self.fieldInfo)
        self.connect(self.selectedFieldsBox, SIGNAL("onItem(QListBoxItem*)"),self.fieldInfo)
        self.connect(self.availableFieldsBox, SIGNAL("onViewport()"),self.outputLabelClear)
        self.connect(self.selectedFieldsBox, SIGNAL("onViewport()"),self.outputLabelClear)

        self.connect(self.loadParserEdit,SIGNAL("returnPressed()"),self.loadParser)
        self.connect(self.loadParserButton,SIGNAL("clicked()"),self.loadParser)
        self.connect(self.saveParserButton,SIGNAL("clicked()"),self.saveParser)
    
	self.connect(self.generateParserButton,SIGNAL("clicked()"),self.generateParser)

        # Log Parse Tab
        self.connect(self.parserToUseButton,SIGNAL("clicked()"),self.parserToUse)
        self.connect(self.logToParseButton,SIGNAL("clicked()"),self.logToParse)
        self.connect(self.parseItButton,SIGNAL("clicked()"),self.parseIt)
        self.connect(self.savePCVFileButton,SIGNAL("clicked()"),self.savePCVFile)

        # Picviz Tab
	self.connect(self.loadPCVFileButton,SIGNAL("clicked()"),self.loadPCVFile)
        self.connect(self.outputPluginBox,SIGNAL("activated (const QString&)"),self.outputPluginChange)
        self.connect(self.graphFilenameButton,SIGNAL("clicked()"),self.graphFilename)
        
        self.connect(self.picvizButton,SIGNAL("clicked()"),self.picviz)


    def languageChange(self):
        self.setCaption(self.__tr("Form1"))

        self.textLabel1_3_2.setText(self.__tr("Choose logtype :"))

        self.logTypeBox.clear()
        self.logTypeBox.insertItem(QString.null)
        self.logTypeBox.insertItem(self.__tr("dansGuardian"))
        self.logTypeBox.insertItem(self.__tr("iptables"))
        self.logTypeBox.insertItem(self.__tr("argus"))
    
        self.textLabel1_3.setText(self.__tr("Load parser :"))
        self.loadParserButton.setText(self.__tr("..."))

        self.textLabel1.setText(self.__tr("Available fields"))
        self.textLabel1_2.setText(self.__tr("Selected fields"))
        self.textLabel1_3_3.setText(self.__tr("Save parser :"))
        self.saveParserButton.setText(self.__tr("..."))

        self.generateParserButton.setText(self.__tr("Generate parser"))

        self.tabWidget2.changeTab(self.tab,self.__tr("Parser Edit"))
        self.parseItButton.setText(self.__tr("Parse it"))
        self.parserToUseButton.setText(self.__tr("..."))
        self.logToParseButton.setText(self.__tr("..."))
        self.savePCVFileButton.setText(self.__tr("..."))
        self.textLabel12.setText(self.__tr("<p align=\"right\">PCV file :</p>"))
        self.textLabel11.setText(self.__tr("<p align=\"right\">Log to parse :</p>"))
        self.textLabel10.setText(self.__tr("<p align=\"right\">Parser to use :</p>"))
        self.tabWidget2.changeTab(self.TabPage,self.__tr("Log Parse"))
        self.picvizButton.setText(self.__tr("Picviz !"))
        self.textLabel9.setText(self.__tr("<p align=\"right\">PCV file to use :</p>"))

        self.outputPluginBox.clear()
        self.outputPluginBox.insertItem(self.__tr("pngcairo"))
        self.outputPluginBox.insertItem(self.__tr("svg"))
        self.outputPluginBox.insertItem(self.__tr("plplot"))
        self.outputPluginBox.insertItem(self.__tr("csv"))
        self.outputPluginBox.insertItem(self.__tr("sdl"))
        self.outputPluginBox.insertItem(self.__tr("debug"))

        self.textLabel2.setText(self.__tr("<p align=\"right\">Render plugin :</p>"))
        self.loadPCVFileButton.setText(self.__tr("..."))
        self.textLabel3.setText(self.__tr("<p align=\"right\">Print text :</p>"))
        self.textLabel8.setText(self.__tr("<p align=\"right\">Save graph as :</p>"))
        self.textLabel1_5.setText(self.__tr("<p align=\"right\">Output plugin :</p>"))
        self.textLabel7.setText(self.__tr("<p align=\"left\">lines</p>"))
        self.textLabel6.setText(self.__tr("<p align=\"right\">Every</p>"))
        self.renderPluginBox.clear()
        self.renderPluginBox.insertItem(QString.null)
        self.renderPluginBox.insertItem(self.__tr("heatline"))
        self.renderPluginBox.insertItem(self.__tr("debug"))
        self.textLabel5.setText(self.__tr("<p align=\"right\">Resolution :</p>"))
        self.graphFilenameButton.setText(self.__tr("..."))
        self.printCheckBox.setText(QString.null)
        self.tabWidget2.changeTab(self.TabPage_2,self.__tr("Picviz"))
        self.outputLabel.setText(QString.null)


    # Fields functions
    def addField(self):
        e=''+self.availableFieldsBox.currentText()
        if e != '':
            self.selectedFieldsBox.insertItem(e)
        

    def remField(self):
        self.selectedFieldsBox.removeItem(self.selectedFieldsBox.currentItem())

    def upField(self):
        i=self.selectedFieldsBox.item(self.selectedFieldsBox.currentItem())
        if i!=None and i.prev()!=None:
            pos=self.selectedFieldsBox.index(i)
            self.selectedFieldsBox.takeItem(i)
            self.selectedFieldsBox.insertItem(i,pos-1)
            self.selectedFieldsBox.setCurrentItem(i)

    def downField(self):
	i=self.selectedFieldsBox.item(self.selectedFieldsBox.currentItem())
	if i!=None and i.next()!=None:
            pre=i.next()
	    self.selectedFieldsBox.takeItem(i)
	    self.selectedFieldsBox.insertItem(i,pre)
	    self.selectedFieldsBox.setCurrentItem(i)

    def fieldInfo(self,i):
        self.outputLabel.setText(logdic['fields'][i.text().ascii()][1])

    # Output function
    def outputLabelClear(self):
        self.outputLabel.clear()


    # Loading functions
    def loadLogType(self,logtype):
        if logtype!='' and logtype!=None:
            if os.path.exists(str(logtype)+".ltp") :
                file=open(logtype+".ltp","r")
                global logdic
                logdic=pickle.load(file)   
                self.availableFieldsBox.clear()
                for i in logdic['fields']:
        	    self.availableFieldsBox.insertItem(i,int(logdic['fields'][i][0]))
            else:
                self.outputLabel.setText("Unavailable data")        

    def loadParserProcess(self):
        filename=self.loadParserEdit.text().ascii()
        if os.path.exists(filename):
            file=open(filename,'r')
            try:
                # Read the second line and strip '#' an '\n'
                # Lire la deuxieme ligne et enlever les '#' et les '\n'
                parser=file.readlines()
                logtype=parser[1].split('# ')[1].split('\n')[0]
                choice=parser[2].split('# ')[1].split('\n')[0]
                
                availableLogtype=False
                for i in range (1,self.logTypeBox.count()):
                    if logtype==self.logTypeBox.text(i).ascii():
                        availableLogtype=True
                        item=i
                if availableLogtype:
                    self.logTypeBox.setCurrentItem(item)
                    self.loadLogType(self.logTypeBox.currentText())
                    for i in choice.split("/"):
                        self.selectedFieldsBox.insertItem(i)
                else:
                    self.outputLabel.setText("Unavailable logtype")
            except:
                self.outputLabel.setText("Wrong parser")
            file.close()
    
    def outputPluginChange(self,outputPlugin):
        graphFilename=self.graphFilenameEdit.text().ascii()
        if graphFilename!=None and graphFilename!="":
            graphDir=graphFilename.split("/")
           
            if outputPlugin=="pngcairo":
                ext=".png"
            if outputPlugin=="svg":
                ext=".svg"
            
            graphFilename=".".join(graphFilename.split(".")[:-1])
            self.graphFilenameEdit.clear()
            self.graphFilenameEdit.insert(graphFilename+ext)
            
#        self.outputPluginBox.insertItem(self.__tr("plplot"))
#        self.outputPluginBox.insertItem(self.__tr("csv"))
#        self.outputPluginBox.insertItem(self.__tr("sdl"))
#        self.outputPluginBox.insertItem(self.__tr("debug"))


    # Generate and exec functions
    def generateParser(self):
        if not(self.selectedFieldsBox.numRows()>2):
            self.outputLabel.setText("Not enough fields (2+ needed)")
        else:
            filename=self.saveParserEdit.text().ascii()
            if not(filename!=""):
                self.outputLabel.setText("No parser name set")
            else:
                title="title"

                choice=""
                for i in range(0,self.selectedFieldsBox.numRows()):
                    choice=choice+self.selectedFieldsBox.item(i).text().ascii()+"/"
                choice=choice[:-1]
            
                file=open(filename,'w')
                # Ecriture du fichier
                # Write the parser
                file.write("#!/usr/bin/perl\n")
                file.write("# "+logdic['name']+"\n")
                file.write("# "+choice+"\n")
                file.write("# Parser generated using genPicvizParser v"+VER+"\n")
                file.write("print \"header {\\n\";\n")
                file.write("print \"    title = \\\""+title+"\\\";\\n\";\n")
                file.write("print \"}\\n\";\n\n")
                file.write("print \"axes {\\n\";\n")
                
                # Declaration des champs choisis
                # Declare each field
                for i in choice.split("/"):
                    file.write("print \"     "+logdic["fields"][i][2]+" "+logdic["fields"][i][3]+" [label=\\\""+i+"\\\", relative=\\\""+logdic["fields"][i][6]+"\\\"];\\n\";\n")
            
                file.write("print \"}\\n\";\n\n")
                
                file.write("print \"data {\\n\";\n")
                file.write("while ($line = <>) {\n")
                # Extraire les donnees de la ligne de log
                # Match each log line for important data
                file.write("    $line =~ s/\\\"//g;\n")
                file.write("    if ($line =~ m/"+logdic["mapping"]+"/) {\n")
                
                # Map the matching
                for i in choice.split("/"):
                    file.write("        "+logdic["fields"][i][4]+"="+"$"+str(logdic["fields"][i][0])+";\n")
                file.write("\n")
                
                # Process post mapping
                for i in choice.split("/"):
                    if  logdic["fields"][i][5]!="":
                        file.write(logdic["fields"][i][5])
                        file.write("\n")
                file.write("\n")
                
                
                # Assignation des sous-chaine aux champs
                # Assign each string match to a field
                line=8*" "+"print \"    "
                for i in choice.split("/"):
                    line+=logdic["fields"][i][3]+"=\\\""+logdic["fields"][i][4]+"\\\", "
            
                # Replace the last comma by ";"
                line=line[:-2]+";\\n\";\n"
                
                file.write(line)
                file.write("    }\n")
                file.write("}\n")
                file.write("print \"}\\n\";\n")
                file.close()
                
                self.outputLabel.setText("Parser generated")
                self.parserToUseEdit.insert(filename)

    def parseIt(self):
        filename=self.parserToUseEdit.text().ascii()
        logname=self.logToParseEdit.text().ascii()
        pcvname=self.savePCVFileEdit.text().ascii()
        
        if not(filename!=None and filename!='' and os.path.exists(filename)):
            self.outputLabel.setText("No parser set")
        else:
            if not(logname!=None and logname!='' and os.path.exists(logname)):
                self.outputLabel.setText("No log set")
            else:
                if not(pcvname!=None and pcvname!='' and pcvname!='.pcv'):
                    self.outputLabel.setText("No pcv file set")
                else:
                    os.chmod(filename,0744)
                    os.system(filename+" "+logname+" > "+pcvname)
                    self.outputLabel.setText("PCV file created")
                    self.loadPCVFileEdit.insert(pcvname)
                    self.graphFilenameEdit.insert(pcvname)
                    self.outputPluginChange(self.outputPluginBox.currentText())

    def picviz(self):
        loadPCVFile=self.loadPCVFileEdit.text().ascii()
        if not(loadPCVFile!=None and loadPCVFile!='' and os.path.exists(loadPCVFile)):
            self.outputLabel.setText("No PCV file set")
        else:
            graphFilename=self.graphFilenameEdit.text().ascii()
            if not(graphFilename!=None and graphFilename!=''):
                self.outputLabel.setText("No graph file set")
            else:
                outputPlugin=self.outputPluginBox.currentText()
                renderPlugin=self.renderPluginBox.currentText()
                printText=self.printCheckBox.isChecked()
                nLines=self.everyLinesEdit.text().ascii()
                resolution=self.resolutionSlider.value()
                cmd="pcv -T"+outputPlugin

                if renderPlugin!="":
                    cmd+=" -R"+renderPlugin
                if printText:
                    cmd+=" -a"
                    if nLines!="":
                        cmd+=" -L"+nLines
                if resolution!=0:
                    cmd+=" -"+resolution*'r'
                
                cmd+=" "+loadPCVFile+" > "+graphFilename
        
                print cmd
#                os.system(cmd)
                self.outputLabel.setText("Graph generated")
        

    # File dialog functions
    def loadParser(self):
        self.fileDialog1.show() 
        self.connect(self.fileDialog1,SIGNAL("fileSelected(const QString &)"),self.foundParser)
    
    def foundParser(self,file):
        self.disconnect(self.fileDialog1,SIGNAL("fileSelected(const QString &)"),self.foundParser)
        self.loadParserEdit.clear()
        self.loadParserEdit.insert(file)
        self.saveParserEdit.insert(file)
        self.loadParserProcess()


    def saveParser(self):
        self.fileDialog1.show()
        self.connect(self.fileDialog1,SIGNAL("fileSelected(const QString &)"),self.foundSaveParser)

    def foundSaveParser(self,file):
        self.disconnect(self.fileDialog1,SIGNAL("fileSelected(const QString &)"),self.foundSaveParser)
	if file!=None and file != '':
            self.saveParserEdit.clear()
	    self.saveParserEdit.insert(file)


    def parserToUse(self):
        self.fileDialog1.show()
        self.connect(self.fileDialog1,SIGNAL("fileSelected(const QString &)"),self.foundParserToUse)

    def foundParserToUse(self,file):
        self.disconnect(self.fileDialog1,SIGNAL("fileSelected(const QString &)"),self.foundParserToUse)
        if file!=None and file != '':
            self.parserToUseEdit.clear()
            self.parserToUseEdit.insert(file)

    def logToParse(self):
        self.fileDialog1.show()
        self.connect(self.fileDialog1,SIGNAL("fileSelected(const QString &)"),self.foundLogToParse)

    def foundLogToParse(self,file):
        self.disconnect(self.fileDialog1,SIGNAL("fileSelected(const QString &)"),self.foundLogToParse)
	if file!=None and file != '':
	    self.logToParseEdit.clear()
	    self.logToParseEdit.insert(file)
	    self.savePCVFileEdit.insert(file+".pcv")


    def savePCVFile(self):
	self.fileDialog1.show()
	self.connect(self.fileDialog1,SIGNAL("fileSelected(const QString &)"),self.foundsavePCVFile)

    def foundsavePCVFile(self,file):
	self.disconnect(self.fileDialog1,SIGNAL("fileSelected(const QString &)"),self.foundsavePCVFile)
	if file!=None and file != '':
	    self.savePCVFileEdit.clear()
	    self.savePCVFileEdit.insert(file)
	    self.loadPCVFileEdit.clear()
	    self.loadPCVFileEdit.insert(file)

    def loadPCVFile(self):
	self.fileDialog1.show()
	self.connect(self.fileDialog1,SIGNAL("fileSelected(const QString &)"),self.foundloadPCVFile)

    def foundloadPCVFile(self,file):
	self.disconnect(self.fileDialog1,SIGNAL("fileSelected(const QString &)"),self.foundloadPCVFile)
	if file!=None and file != '':
	    self.loadPCVFileEdit.clear()
	    self.loadPCVFileEdit.insert(file)
            self.graphFilenameEdit.insert(file)
            self.outputPluginChange(self.outputPluginBox.currentText())
   
    def graphFilename(self):
        self.fileDialog1.show()
        self.connect(self.fileDialog1,SIGNAL("fileSelected(const QString &)"),self.foundGraphFilename)

    def foundGraphFilename(self,file):
        self.disconnect(self.fileDialog1,SIGNAL("fileSelected(const QString &)"),self.foundGraphFilename)
	if file!=None and file != '':
	    self.graphFilenameEdit.clear()
	    self.graphFilenameEdit.insert(file)


    def __tr(self,s,c = None):
        return qApp.translate("Form1",s,c)
_______________________________________________
Picviz mailing list
Picviz@wallinfire.net
http://www.wallinfire.net/cgi-bin/mailman/listinfo/picviz

Reply via email to