switch of 'lastRscript'
[iramuteq] / dialog.py
index 29aa825..6eec615 100755 (executable)
--- a/dialog.py
+++ b/dialog.py
@@ -15,6 +15,7 @@ from PrintRScript import barplot
 import tempfile
 import sys
 from KeyFrame import AlcOptFrame
+import wx.lib.hyperlink as hl
 #---------------------------------------------------------------------------
 provider = wx.SimpleHelpProvider()
 wx.HelpProvider_Set(provider)
@@ -543,9 +544,9 @@ class PrefGraph(wx.Dialog):
         self.paramgraph=paramgraph
         self.labeltype = wx.StaticText(self, -1, _(u"Graphic type").decode('utf8'))
         if self.paramgraph['clnb'] <= 3 :
-            choix = [u'2D']#, 'web 2D']
+            choix = [u'2D', 'web 2D']
         else :
-            choix=[u'2D' ,u'3D']#, 'web 2D', 'web 3D']
+            choix=[u'2D' ,u'3D', 'web 2D', 'web 3D']
         self.choicetype = wx.Choice(self, -1, (100,50), choices=choix)
         self.label_format = wx.StaticText(self, -1, _(u"Picture format").decode('utf8'))
         self.choix_format =  wx.Choice(self, -1, (100,50), choices = ['png', 'svg'])        
@@ -1576,7 +1577,7 @@ class SearchDial ( wx.Frame ):
         self.search = wx.SearchCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_PROCESS_ENTER )
         self.search.ShowSearchButton( True )
         self.search.ShowCancelButton( True )
-        bSizer1.Add( self.search, 0, wx.ALL, 5 )
+        bSizer1.Add( self.search, 0, wx.ALL|wx.EXPAND, 5 )
         sizer2 = wx.BoxSizer(wx.HORIZONTAL)
         self.backward = wx.Button(self, wx.ID_BACKWARD, _(u"Previous").decode('utf8'))
         self.forward = wx.Button(self, wx.ID_FORWARD, _(u"Next").decode('utf8'))
@@ -1706,6 +1707,49 @@ def UnSelectList(liste) :
             last = liste.GetNextSelected(last)
             liste.Select(liste.GetFirstSelected(),False)
 
+class SearchCorpus(SearchDial):
+    def OnSearch(self, evt):
+        search_word = self.search.GetValue()
+        if search_word.strip() != '' :
+            self.corpus_ok = self.listctrl.GetCorpusByName(search_word)
+            if self.corpus_ok != [] :
+                if len(self.corpus_ok) == 1 :
+                    self.listctrl.GiveFocus(None, self.corpus_ok[0]['uuid'])
+                    self.Destroy()
+                else :
+                    self.listctrl.GiveFocus(None, self.corpus_ok[-1]['uuid'])
+                    self.forward.Enable(True)
+                    self.backward.Enable(False)                        
+                    self.forwitem = 1
+                    self.backitem = -1
+                    #for corpus in corpus_ok :
+                    #    self.listctrl.SetContentBackground(uuid = corpus['uuid'])
+            else :
+                print 'no results'
+        else :
+            self.Destroy()
+            
+    def onforward(self, evt) :
+        self.forwitem += 1
+        self.listctrl.GiveFocus(uuid=self.corpus_ok[-self.forwitem]['uuid'])
+        if self.forwitem == len(self.corpus_ok) :
+            self.forward.Enable(False)
+            self.backward.Enable(True)
+            self.backitem = self.forwitem - 1
+        else :
+            self.backitem = self.forwitem - 1
+            self.backward.Enable(True)
+
+    def onbackward(self, evt) :
+        self.listctrl.GiveFocus(uuid=self.corpus_ok[-self.backitem]['uuid'])
+        self.backitem -= 1
+        if self.backitem == 0 :
+            self.forwitem -= 1
+            self.forward.Enable(True)
+            self.backward.Enable(False)
+        else :
+            self.forwitem -= 1
+            self.forward.Enable(True)
 
 class OptLexi(wx.Dialog):
     def __init__(self, parent, force_chi = False):
@@ -1880,38 +1924,38 @@ class PrefDendro ( wx.Dialog ):
         self.m_staticline41 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
         fgSizer1.Add( self.m_staticline41, 0, wx.EXPAND |wx.ALL, 5 )        
         
+        if self.param['typedendro'] == 'classique' :
+            self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Color or black and white").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+            self.m_staticText5.Wrap( -1 )
+            fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
         
-        self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Color or black and white").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
-        self.m_staticText5.Wrap( -1 )
-        fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+            m_radioBox1Choices = [ _(u"color").decode('utf8'), _(u"black and white").decode('utf8') ]
+            self.m_radioBox1 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox1Choices, 1, wx.RA_SPECIFY_COLS )
+            self.m_radioBox1.SetSelection( 0 )
+            fgSizer1.Add( self.m_radioBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
         
-        m_radioBox1Choices = [ _(u"color").decode('utf8'), _(u"black and white").decode('utf8') ]
-        self.m_radioBox1 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox1Choices, 1, wx.RA_SPECIFY_COLS )
-        self.m_radioBox1.SetSelection( 0 )
-        fgSizer1.Add( self.m_radioBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
+            self.m_staticline5 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
+            fgSizer1.Add( self.m_staticline5, 0, wx.EXPAND |wx.ALL, 5 )
         
-        self.m_staticline5 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
-        fgSizer1.Add( self.m_staticline5, 0, wx.EXPAND |wx.ALL, 5 )
+            self.m_staticline6 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
+            fgSizer1.Add( self.m_staticline6, 0, wx.EXPAND |wx.ALL, 5 )
         
-        self.m_staticline6 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
-        fgSizer1.Add( self.m_staticline6, 0, wx.EXPAND |wx.ALL, 5 )
-        
-        bSizer4 = wx.BoxSizer( wx.HORIZONTAL )
+            bSizer4 = wx.BoxSizer( wx.HORIZONTAL )
         
-        self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, _(u"Add cluster size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
-        self.m_staticText6.Wrap( -1 )
-        bSizer4.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+            self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, _(u"Add cluster size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+            self.m_staticText6.Wrap( -1 )
+            bSizer4.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
         
-        self.m_checkBox1 = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
-        self.m_checkBox1.SetValue(True) 
-        bSizer4.Add( self.m_checkBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+            self.m_checkBox1 = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
+            self.m_checkBox1.SetValue(True) 
+            bSizer4.Add( self.m_checkBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
         
-        fgSizer1.Add( bSizer4, 1, wx.EXPAND, 5 )
+            fgSizer1.Add( bSizer4, 1, wx.EXPAND, 5 )
         
-        m_radioBox2Choices = [ _(u"circular diagram").decode('utf8'), _(u"bar").decode('utf8') ]
-        self.m_radioBox2 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox2Choices, 1, wx.RA_SPECIFY_COLS )
-        self.m_radioBox2.SetSelection( 0 )
-        fgSizer1.Add( self.m_radioBox2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
+            m_radioBox2Choices = [ _(u"circular diagram").decode('utf8'), _(u"bar").decode('utf8') ]
+            self.m_radioBox2 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox2Choices, 1, wx.RA_SPECIFY_COLS )
+            self.m_radioBox2.SetSelection( 0 )
+            fgSizer1.Add( self.m_radioBox2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
         
         self.m_staticline7 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
         fgSizer1.Add( self.m_staticline7, 0, wx.EXPAND |wx.ALL, 5 )
@@ -1941,10 +1985,11 @@ class PrefDendro ( wx.Dialog ):
         self.m_spinCtrl2.SetValue(self.param['width'])
         self.m_spinCtrl1.SetValue(self.param['height'])
         self.m_choice1.SetSelection(self.param['type_dendro'])
-        self.m_radioBox1.SetSelection(self.param['color_nb'])
-        self.m_checkBox1.SetValue(self.param['taille_classe'])
-        self.m_radioBox2.SetSelection(self.param['type_tclasse'])
         self.choice_format.SetSelection(self.param['svg'])
+        if self.param['typedendro'] == 'classique' :
+            self.m_radioBox1.SetSelection(self.param['color_nb'])
+            self.m_checkBox1.SetValue(self.param['taille_classe'])
+            self.m_radioBox2.SetSelection(self.param['type_tclasse'])
     
     def __del__( self ):
         pass
@@ -2283,7 +2328,7 @@ class CorpusPref ( wx.Dialog ):
     def __init__( self, parent, parametres ):
         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Settings").decode('utf8'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE | wx.STAY_ON_TOP )
         self.parent = parent 
-        langues_n = [u'français', u'english', u'german (expérimentale)', u'italian', u'swedish (expérimentale)', u'portuguese', u'spanish (expérimentale)', u'greek (expériementale)', u'galician (expérimentale)', u'autre...']
+        langues_n = [u'français', u'english', u'german (expérimentale)', u'italian', u'swedish (expérimentale)', u'portuguese', u'spanish', u'greek (expériementale)', u'galician (expérimentale)', u'autre...']
         self.langues = [u'french', u'english', u'german', u'italian', u'swedish', u'portuguese', u'spanish', u'greek', u'galician', u'other']
         self.encodages = [enc[0].lower() for enc in encodages]
 
@@ -2525,9 +2570,10 @@ class CorpusPref ( wx.Dialog ):
         self.Centre( wx.BOTH )
 
     def OnChangeDir(self, evt) :
-        dlg = wx.DirDialog(self.parent, _(u"Choose a folder").decode('utf8'), style = wx.DD_DEFAULT_STYLE)
-        if dlg.ShowModal() == wx.ID_OK :
+        sdlg = wx.DirDialog(self.parent, _(u"Choose a folder").decode('utf8'), style = wx.DD_DEFAULT_STYLE)
+        if sdlg.ShowModal() == wx.ID_OK :
             self.repout_choices.SetValue(dlg.GetPath())
+        sdlg.Destroy()
     
     def __del__( self ):
         pass
@@ -2623,24 +2669,25 @@ class message(wx.Frame):
         self.uceids = uceids
         self.ira = wx.GetApp().GetTopWindow()
         self.SetIcon(self.ira._icon)
-        self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
+        #self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
         self.items = items
         self.html = ""
         #self.HtmlPage=wx.html.HtmlWindow(self, -1)
-        self.HtmlPage = ConcordList(self, items)
+        self.panel = wx.Panel(self, wx.ID_ANY)
+        self.HtmlPage = ConcordList(self.panel, items)
         #self.HtmlPage.SetMinSize( size )
         #if "gtk2" in wx.PlatformInfo:
         #    self.HtmlPage.SetStandardFonts()
         #self.HtmlPage.SetFonts('Courier','Courier')
 
-        self.button_1 = wx.Button(self, wx.ID_CANCEL)
+        self.button_1 = wx.Button(self.panel, wx.ID_CANCEL)
 
         self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.button_1)
         if self.save :
-            self.button_2 = wx.Button(self, wx.ID_SAVE)
+            self.button_2 = wx.Button(self.panel, wx.ID_SAVE)
             self.Bind(wx.EVT_BUTTON, self.OnSavePage, self.button_2)
         if self.uceids is not None :
-            self.butsub = wx.Button(self, -1, _(u"Build sub corpus").decode('utf8'))
+            self.butsub = wx.Button(self.panel, -1, _(u"Build sub corpus").decode('utf8'))
             self.Bind(wx.EVT_BUTTON, self.OnSub, self.butsub)
         self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
         self.__do_layout()
@@ -2650,15 +2697,16 @@ class message(wx.Frame):
         sizer_2.Add(self.HtmlPage, 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         #m_sdbSizer1 = wx.StdDialogButtonSizer()
         m_sdbSizer1 = wx.BoxSizer(wx.HORIZONTAL)
-        m_sdbSizer1.Add(  self.button_1 , 0, wx.RIGHT | wx.EXPAND)
+        m_sdbSizer1.Add(  self.button_1 , 0, wx.ALIGN_RIGHT | wx.EXPAND)
         if self.save :
-            m_sdbSizer1.Add(  self.button_2 , 0, wx.RIGHT | wx.EXPAND)
+            m_sdbSizer1.Add(  self.button_2 , 0, wx.ALIGN_RIGHT | wx.EXPAND)
         if self.uceids is not None :
-            m_sdbSizer1.Add(  self.butsub , 0, wx.RIGHT | wx.EXPAND)
+            m_sdbSizer1.Add(  self.butsub , 0, wx.ALIGN_RIGHT | wx.EXPAND)
         #m_sdbSizer1.Realize()
-        sizer_2.Add(m_sdbSizer1, 0, wx.RIGHT | wx.EXPAND, 5)
-        self.SetSizer(sizer_2)
-        self.Layout()
+        #self.panel.SetSizer( m_sdbSizer1 )
+        sizer_2.Add( m_sdbSizer1, 0, wx.ALIGN_RIGHT, 5)
+        self.panel.SetSizer(sizer_2)
+        self.panel.Layout()
         sizer_2.Fit( self )
 
     def OnSavePage(self, evt) :
@@ -2666,7 +2714,7 @@ class message(wx.Frame):
             self, message=_(u"Save as ...").decode('utf8'), defaultDir=os.getcwd(),
             defaultFile="concordancier.html", wildcard="html|*.html", style=wx.SAVE | wx.OVERWRITE_PROMPT
             )
-        dlg.SetFilterIndex(2)
+        #dlg.SetFilterIndex(2)
         dlg.CenterOnParent()
         self.html = '<br>'.join([self.items[i] for i in range(0,len(self.items))])
         if dlg.ShowModal() == wx.ID_OK:
@@ -3205,53 +3253,84 @@ class BarGraphDialog ( wx.Dialog ):
             self.heightsp.Enable(True)         
         event.Skip()
 
-class MessageImage(wx.Frame):
-    def __init__(self, parent, parametres, title, size):
-        wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = size, style = wx.CLOSE_BOX|wx.DEFAULT_FRAME_STYLE|wx.FRAME_FLOAT_ON_PARENT|wx.TAB_TRAVERSAL )
+class ImageViewer ( wx.Frame ):
+    
+    def __init__( self, parent, parametres, title, size ):
+        wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = size, style = wx.DEFAULT_FRAME_STYLE|wx.MAXIMIZE_BOX|wx.MINIMIZE_BOX|wx.STAY_ON_TOP|wx.TAB_TRAVERSAL )
+        
         self.ira = wx.GetApp().GetTopWindow()
         self.SetIcon(self.ira._icon)
-        self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
         self.parametres = parametres
         self.imageFile = self.parametres['tmpgraph']
         if parametres['svg'] == 'TRUE' :
             self.imagename = u"image.svg"
         else :
             self.imagename = u"image.png"
-        self.HtmlPage = wx.html.HtmlWindow(self, -1)
-        self.HtmlPage.SetMinSize(size)
-        if "gtk2" in wx.PlatformInfo:
-            self.HtmlPage.SetStandardFonts()
-        self.HtmlPage.SetFonts('Courier', 'Courier')
-        
-        self.button_1 = wx.Button(self, wx.ID_CANCEL)
-        self.button_2 = wx.Button(self, wx.ID_SAVE)
-        self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.button_1)
-        self.Bind(wx.EVT_BUTTON, self.OnSaveImage, self.button_2)
-        self.do_layout()
-
-    def do_layout(self):
-        self.sizer_1 = wx.BoxSizer(wx.VERTICAL)
-        self.sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
-        self.sizer_1.Add(self.HtmlPage, 2, wx.EXPAND, 0)
-
-        self.m_sdbSizer1 = wx.StdDialogButtonSizer()
-        self.m_sdbSizer1.AddButton(  self.button_2 )
-        self.m_sdbSizer1.AddButton(  self.button_1 )
-        self.m_sdbSizer1.Realize()
-        self.sizer_1.Add(self.m_sdbSizer1, 0, wx.EXPAND, 5)
-        self.SetSizer(self.sizer_1)
+        
+        self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
+        
+        bSizer1 = wx.BoxSizer( wx.VERTICAL )
+        
+        self.m_panel1 = wx.ScrolledWindow(self, -1)# wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.HSCROLL|wx.TAB_TRAVERSAL|wx.VSCROLL )
+        self.m_panel1.SetScrollbars(1, 1, 200, 300)
+        bSizer2 = wx.BoxSizer( wx.VERTICAL )
+        
+        if parametres['svg'] == 'FALSE' :
+            image = wx.Image(self.imageFile, wx.BITMAP_TYPE_PNG)
+            W = image.GetWidth()
+            H = image.GetHeight()
+            if W > 1000 :
+                W = 1000
+            if H > 800 :
+                H = 800
+            image = image.ConvertToBitmap()
+            self.m_bitmap1 = wx.StaticBitmap( self.m_panel1, wx.ID_ANY, image, wx.DefaultPosition, wx.DefaultSize, 0 )
+            bSizer2.Add( self.m_bitmap1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+        else :
+            link = hl.HyperLinkCtrl(self.m_panel1, wx.ID_ANY, u"Click on this link", URL=self.imageFile )
+            bSizer2.Add( link, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+        
+        self.m_panel1.SetSizer( bSizer2 )
+        self.m_panel1.Layout()
+        bSizer2.Fit( self.m_panel1 )
+        bSizer1.Add( self.m_panel1, 1, wx.EXPAND |wx.ALL, 5 )
+        
+        panel = wx.Panel(self, -1)
+        m_sdbSizer1 = wx.StdDialogButtonSizer()
+        self.m_sdbSizer1Save = wx.Button( panel, wx.ID_SAVE )
+        m_sdbSizer1.AddButton( self.m_sdbSizer1Save )
+        self.m_sdbSizer1Cancel = wx.Button( panel, wx.ID_CANCEL )
+        m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
+        m_sdbSizer1.Realize();
+        
+        panel.SetSizer( m_sdbSizer1 )
+        
+        bSizer1.Add( panel, 0, wx.EXPAND, 5 )
+        
+        
+        self.SetSizer( bSizer1 )
         self.Layout()
-        self.sizer_1.Fit( self )
-
+        
+        self.Centre( wx.BOTH )
+        
+        if parametres['svg'] == 'FALSE' :
+            self.SetSize((W + 30,H + 30))
+        
+        self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.m_sdbSizer1Cancel)
+        self.Bind(wx.EVT_BUTTON, self.OnSaveImage, self.m_sdbSizer1Save)
+    
+    def __del__( self ):
+        pass
+    
     def OnCloseMe(self, event):
-        self.Destroy()
+        self.Destroy()    
 
     def OnSaveImage(self, event) :
         dlg = wx.FileDialog(
             self, message=_(u"Save as...").decode('utf8'), defaultDir=os.getcwd(),
             defaultFile= self.imagename, wildcard=self.parametres['wildcard'], style=wx.SAVE | wx.OVERWRITE_PROMPT
             )
-        dlg.SetFilterIndex(2)
+        dlg.SetFilterIndex(0)
         dlg.CenterOnParent()
         if dlg.ShowModal() == wx.ID_OK:
             path = dlg.GetPath()
@@ -3292,12 +3371,107 @@ class BarFrame :
             with open(tmpscript,'w') as f :
                 f.write(txt)
             exec_rcode(ira.RPath, tmpscript, wait = True)
-            win = MessageImage(ira, parametres, _(u"Graphic").decode('utf8'), size=(700, 500))
-            if svg == 'FALSE' :
-                txt = "<img src='%s'>" % tmpgraph
-            else :
-                txt = """Copiez ce lien dans votre navigateur : <br>
-                        <a href="%s">%s</a>""" % (tmpgraph, tmpgraph)
-            win.HtmlPage.SetPage(txt)
+            win = ImageViewer(ira, parametres, _(u"Graphic").decode('utf8'), size=(700, 500))
             win.Show(True)
-        dial.Destroy()           
\ No newline at end of file
+        dial.Destroy()           
+
+class MergeDialog ( wx.Dialog ):
+    
+    def __init__( self, parent ):
+        wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE|wx.MINIMIZE_BOX )
+        
+        self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
+        
+        bSizer1 = wx.BoxSizer( wx.VERTICAL )
+        
+        self.m_scrolledWindow1 = wx.ScrolledWindow( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( 600,200 ), wx.HSCROLL|wx.VSCROLL )
+        self.m_scrolledWindow1.SetScrollRate( 5, 5 )
+        #self.m_scrolledWindow1.SetMinSize( wx.Size( 500,200 ) )
+        
+        fgSizer2 = wx.FlexGridSizer( 0, 2, 0, 0 )
+        fgSizer2.AddGrowableCol( 1 )
+        fgSizer2.SetFlexibleDirection( wx.BOTH )
+        fgSizer2.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_ALL )
+        
+        self.m_staticText3 = wx.StaticText( self.m_scrolledWindow1, wx.ID_ANY, u"graphe 1", wx.DefaultPosition, wx.DefaultSize, 0 )
+        self.m_staticText3.Wrap( -1 )
+        fgSizer2.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+        
+        self.m_filePicker3 = wx.FilePickerCtrl( self.m_scrolledWindow1, wx.ID_ANY, wx.EmptyString, u"Select a file", u"*.*", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE|wx.FLP_FILE_MUST_EXIST|wx.FLP_USE_TEXTCTRL )
+        self.m_filePicker3.SetMinSize( wx.Size( 400,-1 ) )
+        
+        fgSizer2.Add( self.m_filePicker3, 1, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
+        
+        self.m_staticText4 = wx.StaticText( self.m_scrolledWindow1, wx.ID_ANY, u"graphe 2", wx.DefaultPosition, wx.DefaultSize, 0 )
+        self.m_staticText4.Wrap( -1 )
+        fgSizer2.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+        
+        self.m_filePicker4 = wx.FilePickerCtrl( self.m_scrolledWindow1, wx.ID_ANY, wx.EmptyString, u"Select a file", u"*.*", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE|wx.FLP_FILE_MUST_EXIST|wx.FLP_USE_TEXTCTRL )
+        self.m_filePicker4.SetMinSize( wx.Size( 400,-1 ) )
+        
+        fgSizer2.Add( self.m_filePicker4, 1, wx.ALL|wx.EXPAND, 5 )
+        
+        
+        self.m_scrolledWindow1.SetSizer( fgSizer2 )
+        self.m_scrolledWindow1.Layout()
+        bSizer1.Add( self.m_scrolledWindow1, 0, wx.ALL, 5 )
+        
+        self.button_add = wx.Button( self, wx.ID_ANY, u"Add graphe", wx.DefaultPosition, wx.DefaultSize, 0 )
+        bSizer1.Add( self.button_add, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+        
+        m_sdbSizer1 = wx.StdDialogButtonSizer()
+        self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
+        m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
+        self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
+        m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
+        m_sdbSizer1.Realize();
+        
+        bSizer1.Add( m_sdbSizer1, 1, wx.EXPAND, 5 )
+        
+        
+        self.SetSizer( bSizer1 )
+        self.Layout()
+        bSizer1.Fit( self )
+        
+        self.Centre( wx.BOTH )
+        
+        # Connect Events
+        self.button_add.Bind( wx.EVT_BUTTON, self.OnAddGraphe )
+        self.m_filePicker3.Bind(wx.EVT_FILEPICKER_CHANGED, self.OnFileChange)
+        self.m_filePicker4.Bind(wx.EVT_FILEPICKER_CHANGED, self.OnFileChange)
+        self.finish(fgSizer2, bSizer1)
+    
+    def __del__( self ):
+        pass
+    
+    def finish(self, fgSizer2, bSizer1):
+        self.graphs = [self.m_filePicker3, self.m_filePicker4]
+        self.fgSizer2 = fgSizer2
+        self.bSizer1 = bSizer1
+    
+    def OnFileChange(self, evt):
+        obj = evt.GetEventObject()
+        if obj.GetPath() != '' :
+            for graph in self.graphs :
+                graph.SetInitialDirectory(os.path.dirname(obj.GetPath()))
+    
+    # Virtual event handlers, overide them in your derived class
+    def OnAddGraphe( self, event ):
+        lab =  wx.StaticText( self.m_scrolledWindow1, wx.ID_ANY, ' '.join(['graphe', `len(self.graphs) + 1`]), wx.DefaultPosition, wx.DefaultSize, 0 )
+        lab.Wrap(-1)
+        self.graphs.append( wx.FilePickerCtrl( self.m_scrolledWindow1, wx.ID_ANY, wx.EmptyString, u"Select a file", u"*.*", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE|wx.FLP_FILE_MUST_EXIST|wx.FLP_USE_TEXTCTRL ) )
+        self.graphs[-1].SetMinSize( wx.Size( 400, -1))
+        if self.graphs[-2].GetPath() != '' :
+            self.graphs[-1].SetInitialDirectory(os.path.dirname(self.graphs[-2].GetPath()))
+        self.graphs[-1].Bind(wx.EVT_FILEPICKER_CHANGED, self.OnFileChange)
+        self.fgSizer2.Add( lab, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+        self.fgSizer2.Add( self.graphs[-1], 1, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
+        self.m_scrolledWindow1.Layout()
+        self.m_scrolledWindow1.SetSizer( self.fgSizer2 )
+        #self.fgSizer2.Fit( self.m_scrolledWindow1 )
+        self.Layout()
+        #self.bSizer1.Fit(self)
+        event.Skip()
+    
+    def RemoveGraphe(self, evt ):
+        pass
\ No newline at end of file