Index: pyraw2fits/pyraw2fits.py
===================================================================
--- pyraw2fits/pyraw2fits.py	(revision 5)
+++ pyraw2fits/pyraw2fits.py	(revision 6)
@@ -1,76 +1,147 @@
-#!/bin/env python
-# coding: utf-8
+#!/usr/bin/python
+# -*- coding: iso-8859-1 -*-
 
-VERSION='1.0'
+VERSION='2.0'
+
 
 import pyfits
+import Tkinter
+import numpy
+
 from optparse import OptionParser
 
-import numpy
 
 
-parser = OptionParser()
-##parser.add_option("-i","--input",dest="InputFilename",
-##                  help="Input filename (required)", metavar="RAWIMAGE")
-##parser.add_option("-o","--output",dest="OutputFilename",
-##                  help="Output Filename (required)", metavar="FITSIMAGE")
+
+def raw2fits(InputFilename,headers,comments):
+    OutputFilename = InputFilename.replace('.dat','.fits')
+
+    NX = 2160
+    NY = 2053
 
 
-(options, args) = parser.parse_args ()
+    # Ouverture de l'image en mode lecture binaire (windows)
+    try:
+        f= open(InputFilename,'rb')
+    except IOError :
+        print "Impossible d'ouvrir l'image"
+        exit (1)
 
-InputFilename = args[0]
-OutputFilename = InputFilename.replace('.dat','.fits')
+    # Creation de l'array d'entiers non signés + byteswap
+    a = numpy.fromfile(file=f, dtype=numpy.uint16, count=-1)
+    a.byteswap(True)
+    f.close()
 
-print InputFilename, OutputFilename
-
-#print len(options.keys())
+    # dispatch des parties du binaire + conversion en signed int
+    gauche = numpy.cast[numpy.int16](a[NX*NY/2:NX*NY]-32768)
+    droite = numpy.cast[numpy.int16](a[:NX*NY/2]-32768)
+    observables = numpy.cast[numpy.int16](a[-5:-1]-32768)
 
 
-NX = 2160
-NY = 2053
-
-# Ouverture de l'image en mode lecture binaire (windows)
-try:
-    f= open(InputFilename,'rb')
-except IOError :
-    print "Impossible d'ouvrir l'image"
-    exit (1)
-
-# Creation de l'array d'entiers non signÃ©s + byteswap
-a = numpy.fromfile(file=f, dtype=numpy.uint16, count=-1)
-a.byteswap(True)
-f.close()
-
-# dispatch des parties du binaire + conversion en signed int
-gauche = numpy.cast[numpy.int16](a[NX*NY/2:NX*NY]-32768)
-droite = numpy.cast[numpy.int16](a[:NX*NY/2]-32768)
-observables = numpy.cast[numpy.int16](a[-5:-1]-32768)
-
-# Construction de l'image (flip de la partie droite)
-b=numpy.empty(NX,dtype=numpy.int16)
-gauche.resize(NY,NX/2)
-droite.resize(NY,NX/2)
-b = numpy.hstack((gauche,numpy.fliplr(droite)))
+    # Construction de l'image (flip de la partie droite)
+    b=numpy.empty(NX,dtype=numpy.int16)
+    gauche.resize(NY,NX/2)
+    droite.resize(NY,NX/2)
+    b = numpy.hstack((gauche,numpy.fliplr(droite)))
 
 
-# Creation de l'objet fits
-hdu = pyfits.PrimaryHDU(b)
-hdulist = pyfits.HDUList([hdu])
+    # Creation de l'objet fits
+    hdu = pyfits.PrimaryHDU(b)
+    hdulist = pyfits.HDUList([hdu])
 
-prihdr = hdulist[0].header
+    prihdr = hdulist[0].header
 
-prihdr.update('BSCALE',1,'scale')
-prihdr.update('BZERO',32768,'origin of the scale')
+    prihdr.update('BSCALE',1,'scale')
+    prihdr.update('BZERO',32768,'origin of the scale')
 
 
-prihdr.update('OBS1',observables[0],'Observable 1')
-prihdr.update('OBS2',observables[1],'Observable 2')
-prihdr.update('OBS3',observables[2],'Observable 3')
-prihdr.update('OBS4',observables[3],'Observable 4')
-prihdr.update('Conv','pyraw2fits','Logiciel de conversion utilise')
-prihdr.update('ConvVer',VERSION,'Version de raw2fits')
+    prihdr.update('OBS1',observables[0],'Observable 1')
+    prihdr.update('OBS2',observables[1],'Observable 2')
+    prihdr.update('OBS3',observables[2],'Observable 3')
+    prihdr.update('OBS4',observables[3],'Observable 4')
+    prihdr.update('Conv','pyraw2fits','Logiciel de conversion utilise')
+    prihdr.update('ConvVer',VERSION,'Version de raw2fits')
 
 
-of = OutputFilename
+    of = OutputFilename
 
-hdu.writeto(of,clobber=True)
+    hdu.writeto(of,clobber=True)
+
+
+class simpleapp_tk(Tkinter.Tk):
+    def __init__(self,parent):
+        Tkinter.Tk.__init__(self,parent)
+        self.parent = parent
+        self.initialize()
+
+    def initialize(self):
+        self.grid()
+
+        self.entryVariable = Tkinter.StringVar()
+        self.entry = Tkinter.Entry(self,textvariable=self.entryVariable)
+        self.entry.grid(column=1,row=0,sticky='EW')
+        self.entry.bind("<Return>", self.OnPressEnter)
+        self.entryVariable.set(u"")
+        
+        button = Tkinter.Button(self,text=u"Convertir en fits",
+                                command=self.OnButtonClick)
+        button.grid(column=0,row=2)
+
+        self.labelVariable = Tkinter.StringVar()
+        label = Tkinter.Label(self,textvariable=self.labelVariable,
+                              anchor="w",fg="white",bg="blue")
+        label.grid(column=0,row=1,columnspan=2,sticky='EW')
+        self.labelVariable.set(u"Hello !")
+
+        self.grid_columnconfigure(0,weight=1)
+        self.resizable(True,False)
+        self.update()
+        self.geometry(self.geometry())
+        self.entry.focus_set()
+        self.entry.selection_range(0, Tkinter.END)
+        
+
+    def CommonAction(self):
+        InputFilename = self.entryVariable.get()
+        print InputFilename
+        OutputFilename = InputFilename.replace(".dat",".fits")
+        self.labelVariable.set("Ecriture de " + OutputFilename)
+        headers=[]
+        comments=[]
+        raw2fits(InputFilename,headers,comments)
+        
+        
+    def OnButtonClick(self):
+        self.CommonAction()
+        self.entry.focus_set()
+        self.entry.selection_range(0, Tkinter.END)
+
+    def OnPressEnter(self,event):
+        self.CommonAction()
+        self.entry.focus_set()
+        self.entry.selection_range(0, Tkinter.END)
+
+
+        
+
+if __name__ == "__main__":
+
+    parser = OptionParser()
+    parser.add_option("-n","--nogui",action="store_true",
+                      dest="nogui", default=False,
+                      help="command line only, no gui")
+                      
+    (options, args) = parser.parse_args ()
+
+    if options.nogui:
+        InputFilename=args[0]
+        headers=[]
+        comments=[]
+        raw2fits(InputFilename,headers,comments)
+
+    else:
+        app = simpleapp_tk(None)
+        app.title('raw2fits')
+        app.mainloop()
+
+
Index: pyraw2fits/pyraw2fits_old.py
===================================================================
--- pyraw2fits/pyraw2fits_old.py	(revision 6)
+++ pyraw2fits/pyraw2fits_old.py	(revision 6)
@@ -0,0 +1,76 @@
+#!/bin/env python
+# coding: utf-8
+
+VERSION='1.0'
+
+import pyfits
+from optparse import OptionParser
+
+import numpy
+
+
+parser = OptionParser()
+##parser.add_option("-i","--input",dest="InputFilename",
+##                  help="Input filename (required)", metavar="RAWIMAGE")
+##parser.add_option("-o","--output",dest="OutputFilename",
+##                  help="Output Filename (required)", metavar="FITSIMAGE")
+
+
+(options, args) = parser.parse_args ()
+
+InputFilename = args[0]
+OutputFilename = InputFilename.replace('.dat','.fits')
+
+print InputFilename, OutputFilename
+
+#print len(options.keys())
+
+
+NX = 2160
+NY = 2053
+
+# Ouverture de l'image en mode lecture binaire (windows)
+try:
+    f= open(InputFilename,'rb')
+except IOError :
+    print "Impossible d'ouvrir l'image"
+    exit (1)
+
+# Creation de l'array d'entiers non signÃ©s + byteswap
+a = numpy.fromfile(file=f, dtype=numpy.uint16, count=-1)
+a.byteswap(True)
+f.close()
+
+# dispatch des parties du binaire + conversion en signed int
+gauche = numpy.cast[numpy.int16](a[NX*NY/2:NX*NY]-32768)
+droite = numpy.cast[numpy.int16](a[:NX*NY/2]-32768)
+observables = numpy.cast[numpy.int16](a[-5:-1]-32768)
+
+# Construction de l'image (flip de la partie droite)
+b=numpy.empty(NX,dtype=numpy.int16)
+gauche.resize(NY,NX/2)
+droite.resize(NY,NX/2)
+b = numpy.hstack((gauche,numpy.fliplr(droite)))
+
+
+# Creation de l'objet fits
+hdu = pyfits.PrimaryHDU(b)
+hdulist = pyfits.HDUList([hdu])
+
+prihdr = hdulist[0].header
+
+prihdr.update('BSCALE',1,'scale')
+prihdr.update('BZERO',32768,'origin of the scale')
+
+
+prihdr.update('OBS1',observables[0],'Observable 1')
+prihdr.update('OBS2',observables[1],'Observable 2')
+prihdr.update('OBS3',observables[2],'Observable 3')
+prihdr.update('OBS4',observables[3],'Observable 4')
+prihdr.update('Conv','pyraw2fits','Logiciel de conversion utilise')
+prihdr.update('ConvVer',VERSION,'Version de raw2fits')
+
+
+of = OutputFilename
+
+hdu.writeto(of,clobber=True)
