import wx.lib.sized_controls as sc
import wx.lib.filebrowsebutton as filebrowse
import locale
-from functions import DoConf
+from functions import DoConf, exec_rcode
import os
+from shutil import copyfile
+from PrintRScript import barplot
+import tempfile
import sys
from KeyFrame import AlcOptFrame
#---------------------------------------------------------------------------
grid_sizer.Add(self.choice4, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
self.choice3.SetSelection(0)
self.choice4.SetSelection(0)
- self.text = wx.StaticText(self, -1, _(u"Character set").decode('utf8'))
+ self.text = wx.StaticText(self, -1, _(u"Characters set").decode('utf8'))
grid_sizer.Add(self.text, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
self.le = [enc[0].lower() for enc in encodages]
self.list_encodages = wx.Choice(self, -1, (25, 30), choices=[' - '.join(encodage) for encodage in encodages])
self.spin_f2 = wx.SpinCtrl(self, -1, '',size = (100,30), min=1, max=self.paramgraph['clnb']-1)
self.label_f3 = wx.StaticText(self, -1, _(u"Factor z : ").decode('utf8'))
self.spin_f3 = wx.SpinCtrl(self, -1, '',size = (100,30), min=1, max=self.paramgraph['clnb']-1)
- self.label_sphere = wx.StaticText(self, -1, _(u"Sphere transparency").decode('utf8'))
+ self.label_sphere = wx.StaticText(self, -1, _(u"Spheres transparency").decode('utf8'))
self.slider_sphere = wx.Slider(self, -1, 10, 1, 100, size = (255,-1), style = wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS)
self.label_film = wx.StaticText(self, -1, _(u"Make a movie").decode('utf8'))
sizer = wx.BoxSizer(wx.VERTICAL)
box = wx.BoxSizer(wx.HORIZONTAL)
box3 = wx.BoxSizer(wx.HORIZONTAL)
- self.label_lem = wx.StaticText(self, -1, _(u"Lemmatised corpora").decode('utf8'))
+ self.label_lem = wx.StaticText(self, -1, _(u"Lemmatised corpus").decode('utf8'))
box3.Add(self.label_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
self.radio_lem = wx.RadioBox(self, -1, u"", choices= [ _(u"yes").decode('utf8'), _(u"no").decode('utf8') ], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
box3.Add(self.radio_lem, 0, wx.ALIGN_RIGHT, 5)
else :
self.EndModal(wx.ID_CANCEL)
-
-class StatDialog(wx.Dialog):
- def __init__(self, parent, *args, **kwds):
- kwds['style'] = wx.DEFAULT_DIALOG_STYLE
- wx.Dialog.__init__(self, *args, **kwds)
+class StatDialog ( wx.Dialog ):
+
+ def __init__( self, parent, keys ):
+ wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Settings", pos = wx.DefaultPosition, size = wx.Size( -1,-1 ), style = wx.DEFAULT_DIALOG_STYLE )
+
self.fileout = ""
self.parent = parent
- self.label_lem = wx.StaticText(self, -1, _(u"Lemmatization").decode('utf8'))
- self.radio_lem = wx.RadioBox(self, -1, u"", choices=['oui', 'non'], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
- #txt = u"""Fréquence minimum d'une forme
-#analysée (0 = non utilisé)"""
- #self.label_8 = wx.StaticText(self, -1, txt)
- #self.spin_ctrl_5 = wx.SpinCtrl(self, -1, "",size = (100,30), min=0, max=1000, initial=0)
- #self.label_max_actives = wx.StaticText(self, -1, u"Nombre maximum de formes analysées")
- #self.spin_max_actives = wx.SpinCtrl(self, -1, "",size = (100,30), min=20, max=10000, initial=1500)
- self.label_4 = wx.StaticText(self, -1, _(u"Keys settings").decode('utf8'))
- self.button_5 = wx.Button(self, wx.ID_PREFERENCES, "")
-
- #self.Bind(wx.EVT_CHECKBOX, self.OnCheckUce, self.check_uce)
- #self.Bind(wx.EVT_SPINCTRL, self.OnSpin, self.spin_ctrl_5)
- self.Bind(wx.EVT_BUTTON, self.OnKeys, self.button_5)
- self.__do_layout()
- self.__set_properties()
-
- def __do_layout(self) :
- first = wx.BoxSizer(wx.VERTICAL)
- sizer = wx.FlexGridSizer(0,2,0,0)
- sizer.Add(self.label_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
- sizer.Add(self.radio_lem, 0, wx.ALIGN_LEFT, 5)
- sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
- sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
- #sizer.Add(self.txt_exp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
- #sizer.Add(self.exp, 0, wx.ALIGN_RIGHT, 5)
- #sizer.Add(self.label_uce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
- #sizer.Add(self.check_uce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
- #sizer.Add(self.label_occuce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
- #sizer.Add(self.spin_ctrl_4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
- #sizer.Add(self.label_8, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
- #sizer.Add(self.spin_ctrl_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
- #sizer.Add(self.label_max_actives, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
- #sizer.Add(self.spin_max_actives, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
- sizer.Add(self.label_4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
- sizer.Add(self.button_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
- sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
- sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
- #sizer.Add(box2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
- first.Add(sizer, 0, wx.ALL, 5)
- btnsizer = wx.StdDialogButtonSizer()
- btn = wx.Button(self, wx.ID_CANCEL)
- btnsizer.AddButton(btn)
- btn_ok = wx.Button(self, wx.ID_OK)
- btn_ok.SetDefault()
- btnsizer.AddButton(btn_ok)
- btnsizer.Realize()
- first.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
- self.SetSizer(first)
- first.Fit(self)
-
- def __set_properties(self) :
- self.SetTitle(_(u"Settings").decode('utf8'))
+ self.keys = keys
+ self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
+
+ bSizer1 = wx.BoxSizer( wx.VERTICAL )
+
+ gSizer1 = wx.GridSizer( 0, 2, 0, 0 )
+
+ self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Lemmatization", wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText1.Wrap( -1 )
+ gSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ radio_lemChoices = [ u"yes", u"no" ]
+ self.radio_lem = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, radio_lemChoices, 1, wx.RA_SPECIFY_COLS )
+ self.radio_lem.SetSelection( 0 )
+ gSizer1.Add( self.radio_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
+
+ self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"Keys properties", wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText2.Wrap( -1 )
+ gSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.button_5 = wx.Button( self, wx.ID_PREFERENCES, u"properties", wx.DefaultPosition, wx.DefaultSize, 0 )
+ gSizer1.Add( self.button_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
+
+ self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"Dictionary", wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText3.Wrap( -1 )
+ gSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ radio_dictchoiceChoices = [ u"indexation", u"other" ]
+ self.radio_dictchoice = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, radio_dictchoiceChoices, 1, wx.RA_SPECIFY_COLS )
+ self.radio_dictchoice.SetSelection( 0 )
+ gSizer1.Add( self.radio_dictchoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
+
+
+ bSizer1.Add( gSizer1, 1, wx.EXPAND, 5 )
+
+ self.dictpath = filebrowse.FileBrowseButton(self, -1, size=(350, -1), labelText = _(u"Path").decode('utf8'), fileMode = 2, fileMask = '*')
+ bSizer1.Add( self.dictpath, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+ self.dictpath.Enable(False)
- def OnKeys(self, evt):
- dial = AlcOptFrame(self, self.parent.parent)
+ 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, 0, wx.EXPAND, 5 )
+
+
+ self.SetSizer( bSizer1 )
+ self.Layout()
+ bSizer1.Fit( self )
+
+ self.Centre( wx.BOTH )
+
+ # Connect Events
+ self.button_5.Bind( wx.EVT_BUTTON, self.OnKeys )
+ self.radio_dictchoice.Bind( wx.EVT_RADIOBOX, self.OnOther )
+
+ def __del__( self ):
+ pass
+
+
+ # Virtual event handlers, overide them in your derived class
+ def OnKeys( self, event ):
+ dial = AlcOptFrame(self, self.parent)
dial.CenterOnParent()
dial.ShowModal()
for i in range(0,len(dial.listlabel)):
dial.keys[dial.listcle[i]] = dial.listspin[i].GetValue()
- DoConf().makeoptions(['KEY'], [dial.keys], outfile = self.parent.parent.ConfigPath['key'])
+ DoConf().makeoptions(['KEY'], [dial.keys], outfile = self.parent.ConfigPath['key'])
dial.Destroy()
+
+ def OnOther( self, event ):
+ if self.radio_dictchoice.GetSelection() :
+ self.dictpath.Enable(True)
+ else :
+ self.dictpath.Enable(False)
+
+# class StatDialog(wx.Dialog):
+# def __init__(self, parent, *args, **kwds):
+# kwds['style'] = wx.DEFAULT_DIALOG_STYLE
+# wx.Dialog.__init__(self, *args, **kwds)
+# self.fileout = ""
+# self.parent = parent
+# self.label_lem = wx.StaticText(self, -1, _(u"Lemmatization").decode('utf8'))
+# self.radio_lem = wx.RadioBox(self, -1, u"", choices=[_(u'oui').decode('utf8'), _(u'non').decode('utf8')], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
+# #txt = u"""Fréquence minimum d'une forme
+# #analysée (0 = non utilisé)"""
+# #self.label_8 = wx.StaticText(self, -1, txt)
+# #self.spin_ctrl_5 = wx.SpinCtrl(self, -1, "",size = (100,30), min=0, max=1000, initial=0)
+# #self.label_max_actives = wx.StaticText(self, -1, u"Nombre maximum de formes analysées")
+# #self.spin_max_actives = wx.SpinCtrl(self, -1, "",size = (100,30), min=20, max=10000, initial=1500)
+# self.label_4 = wx.StaticText(self, -1, _(u"Keys settings").decode('utf8'))
+# self.button_5 = wx.Button(self, wx.ID_PREFERENCES, "")
+# self.labeldictchoice = wx.StaticText(self, -1, _(u"Dictionary").decode('utf8'))
+# self.radio_dictchoice = wx.RadioBox(self, -1, u"", choices=[_(u'indexation').decode('utf8'), _(u'other').decode('utf8')], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
+# #self.labeldictpath = wx.StaticText(self, -1, _(u"Path").decode('utf8'))
+# self.dictpath = filebrowse.FileBrowseButton(self, -1, size=(350, -1), labelText = _(u"Path").decode('utf8'), fileMode = 2, fileMask = '*')
+# self.dictpath.Enable(False)
+# #self.Bind(wx.EVT_CHECKBOX, self.OnCheckUce, self.check_uce)
+# #self.Bind(wx.EVT_SPINCTRL, self.OnSpin, self.spin_ctrl_5)
+# self.Bind(wx.EVT_BUTTON, self.OnKeys, self.button_5)
+# self.Bind(wx.EVT_RADIOBOX, self.OnOther, self.radio_dictchoice)
+# self.__do_layout()
+# self.__set_properties()
+#
+# def __do_layout(self) :
+# first = wx.BoxSizer(wx.VERTICAL)
+# sizer = wx.FlexGridSizer(0,2,0,0)
+# sizer.Add(self.label_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# sizer.Add(self.radio_lem, 0, wx.ALIGN_LEFT, 5)
+# sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
+# sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
+# #sizer.Add(self.txt_exp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# #sizer.Add(self.exp, 0, wx.ALIGN_RIGHT, 5)
+# #sizer.Add(self.label_uce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# #sizer.Add(self.check_uce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# #sizer.Add(self.label_occuce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# #sizer.Add(self.spin_ctrl_4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# #sizer.Add(self.label_8, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# #sizer.Add(self.spin_ctrl_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# #sizer.Add(self.label_max_actives, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# #sizer.Add(self.spin_max_actives, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# sizer.Add(self.label_4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# sizer.Add(self.button_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
+# sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
+# sizer.Add(self.labeldictchoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# sizer.Add(self.radio_dictchoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
+# sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
+# #sizer.Add(self.labeldictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# sizer.Add(self.dictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
+# sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
+# #sizer.Add(box2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
+# first.Add(sizer, 0, wx.ALL, 5)
+# btnsizer = wx.StdDialogButtonSizer()
+# btn = wx.Button(self, wx.ID_CANCEL)
+# btnsizer.AddButton(btn)
+# btn_ok = wx.Button(self, wx.ID_OK)
+# btn_ok.SetDefault()
+# btnsizer.AddButton(btn_ok)
+# btnsizer.Realize()
+# first.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
+# self.SetSizer(first)
+# first.Fit(self)
+#
+# def __set_properties(self) :
+# self.SetTitle(_(u"Settings").decode('utf8'))
+#
+# def OnKeys(self, evt):
+# dial = AlcOptFrame(self, self.parent.parent)
+# dial.CenterOnParent()
+# dial.ShowModal()
+# for i in range(0,len(dial.listlabel)):
+# dial.keys[dial.listcle[i]] = dial.listspin[i].GetValue()
+# DoConf().makeoptions(['KEY'], [dial.keys], outfile = self.parent.parent.ConfigPath['key'])
+# dial.Destroy()
+#
+# def OnOther(self, evt):
+# if self.radio_dictchoice.GetSelection() :
+# self.dictpath.Enable(True)
+# else :
+# self.dictpath.Enable(False)
class PrefUCECarac(wx.Dialog):
def __init__(self, parent, *args, **kwds):
self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
bSizer1 = wx.BoxSizer( wx.VERTICAL )
- txt = _(u"Be carefull : computation of repeated segments profiles can be very long on large corpora").decode('utf8')
+ txt = _(u"Be carefull : computation of repeated segments profiles can be very long on large corpus").decode('utf8')
self.label = wx.StaticText( self, wx.ID_ANY, txt, wx.DefaultPosition, wx.DefaultSize, 0 )
bSizer1.Add( self.label, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5 )
fgSizer1.SetFlexibleDirection( wx.BOTH )
fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
- self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Lemmatised corpora").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Lemmatised corpus").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText1.Wrap( -1 )
fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
self.spin_min.SetValue(2)
fgSizer1.Add( self.spin_min, 0, wx.ALL, 5 )
- self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"Minimum size of segments").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"Maxmum size of segments").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText4.Wrap( -1 )
fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
class PrefQuestAlc ( wx.Dialog ):
- def __init__( self, parent, sim = False):
+ def __init__( self, parent, tableau, sim = False):
wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Clustering").decode('utf8'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
#---------------------------------------------------------------
#self.content = parent.content[:]
- self.header = parent.tableau.get_colnames()
+ self.header = tableau.get_colnames()
labels = [val for val in self.header]
self.labels_tot = labels
self.varsup = []
fgSizer1.Add( self.but_prec, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
if not sim :
- self.lab_nbcl = wx.StaticText( self, wx.ID_ANY, _(u"Number of terminal clusters in phase 1").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.lab_nbcl = wx.StaticText( self, wx.ID_ANY, _(u"Number of terminal clusters on phase 1").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
self.lab_nbcl.Wrap( -1 )
fgSizer1.Add( self.lab_nbcl, 0, wx.ALL, 5 )
self.m_staticline4 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
fgSizer1.Add( self.m_staticline4, 0, wx.EXPAND |wx.ALL, 5 )
+
+ self.text_format_image = wx.StaticText( self, wx.ID_ANY, _(u"Image format").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.text_format_image.Wrap( -1 )
+ fgSizer1.Add( self.text_format_image, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.choice_format = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, ['png', 'svg'], 0 )
+ self.choice_format.SetSelection( 0 )
+ fgSizer1.Add( self.choice_format, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
+
+ self.m_staticline31 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
+ fgSizer1.Add( self.m_staticline31, 0, wx.EXPAND |wx.ALL, 5 )
+
+ 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 )
+
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 )
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'])
def __del__( self ):
pass
class ChiDialog(wx.Dialog):
def __init__(
- self, parent, ID, title, optionchi, size=wx.DefaultSize, pos=wx.DefaultPosition,
+ self, parent, ID, title, optionchi, tableau, size=wx.DefaultSize, pos=wx.DefaultPosition,
style=wx.DEFAULT_DIALOG_STYLE
):
self.parent = parent
self.optionchi = optionchi
self.chiopt = False
+ self.tableau = tableau
#self.Filename=parent.filename
#self.content=parent.content[:]
- self.headers=parent.tableau.get_colnames()
+ self.headers=self.tableau.get_colnames()
LABELLIST=[]
for i in self.headers:
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 )
self.parent = parent
- langues_n = [u'français', u'english', u'german (expérimentale)', u'italian', u'swedish (expérimentale)', u'portuguese (expérimentale)', u'spanish (expérimentale)', u'greek (expériementale)', u'autre...']
- self.langues = [u'french', u'english', u'german', u'italian', u'swedish', u'portuguese', u'spanish', u'greek', u'other']
+ langues_n = [u'français', u'english', u'german (expérimentale)', u'italian', u'swedish (expérimentale)', u'portuguese (expérimentale)', u'spanish (expérimentale)', 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]
ucimark = [u'****', u'0000']
fgSizer1.SetFlexibleDirection( wx.BOTH )
fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
- self.m_staticText7 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Corpora").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText7 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"corpus").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText7.Wrap( -1 )
fgSizer1.Add( self.m_staticText7, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
self.txtpath = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Path").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
self.txtpath.Wrap( -1 )
fgSizer1.Add( self.txtpath, 0, wx.ALL, 5 )
+
+ self.m_staticText18 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Corpus' name").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText18.Wrap( -1 )
+ fgSizer1.Add( self.m_staticText18, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
+ self.corpusname = wx.TextCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 200,-1 ), 0 )
+ fgSizer1.Add( self.corpusname, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
+
self.m_staticText1 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Characters set").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText1.Wrap( -1 )
fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
self.lang_choices.SetSelection( 0 )
fgSizer1.Add( self.lang_choices, 0, wx.ALL, 5 )
+ self.m_staticText19 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Dictionary").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText19.Wrap( -1 )
+ fgSizer1.Add( self.m_staticText19, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
+
+ bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
+
+ fgSizer5 = wx.FlexGridSizer( 2, 2, 0, 0 )
+ fgSizer5.SetFlexibleDirection( wx.BOTH )
+ fgSizer5.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
+
+ self.radio_default_dict = wx.RadioButton( self.m_panel1, wx.ID_ANY, _(u"Default").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ fgSizer5.Add( self.radio_default_dict, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.defaultdictpath = wx.TextCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 300,-1 ), wx.TE_READONLY )
+ self.defaultdictpath.Enable( False )
+
+ fgSizer5.Add( self.defaultdictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.radio_other_dict = wx.RadioButton( self.m_panel1, wx.ID_ANY, _(u"Other").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ fgSizer5.Add( self.radio_other_dict, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.otherdictpath = wx.FilePickerCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, _(u"Select a file").decode('utf8'), u"*.*", wx.DefaultPosition, wx.Size( 300,-1 ), wx.FLP_DEFAULT_STYLE )
+ self.otherdictpath.SetMinSize(wx.Size(300, -1))
+ fgSizer5.Add( self.otherdictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+ self.otherdictpath.Enable( False )
+
+
+ bSizer2.Add( fgSizer5, 1, wx.EXPAND, 5 )
+
+
+ fgSizer1.Add( bSizer2, 1, wx.EXPAND, 5 )
+
self.m_staticText3 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Output folder").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText3.Wrap( -1 )
fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
+ # Connect Events
self.Bind(wx.EVT_BUTTON, self.OnChangeDir, self.m_button1)
+ self.lang_choices.Bind( wx.EVT_CHOICE, self.OnChangeLangage )
+ self.radio_other_dict.Bind( wx.EVT_RADIOBUTTON, self.changedictchoice )
+ self.radio_default_dict.Bind( wx.EVT_RADIOBUTTON, self.changedictchoice )
+ self.otherdictpath.Bind( wx.EVT_FILEPICKER_CHANGED, self.selectdict)
+
self.setparametres(parametres)
self.SetSizer( bSizer1 )
self.Layout()
self.encodage_choices.SetSelection(enc)
self.lang_choices.SetSelection(0)
self.repout_choices.SetValue(parametres['pathout'])
+ self.corpusname.SetValue(parametres['corpus_name'])
self.ucimark_choices.SetSelection(parametres['ucimark'])
self.check_expressions.SetValue(parametres['expressions'])
self.check_makeuce.SetValue(parametres['douce'])
self.check_tirets.SetValue(parametres['tiret'])
self.check_tolist.SetValue(parametres['tolist'])
self.check_ponct.SetValue(parametres['keep_ponct'])
+ self.defaultdictpath.SetValue(self.langues[0])
def doparametres(self) :
parametres = {}
parametres['encoding'] = encodages[self.encodage_choices.GetSelection()][0]
parametres['lang'] = self.langues[self.lang_choices.GetSelection()]
parametres['pathout'] = self.repout_choices.GetValue()
+ parametres['corpus_name'] = self.corpusname.GetValue()
parametres['ucimark'] = self.ucimark_choices.GetSelection()
parametres['expressions'] = self.check_expressions.GetValue()
parametres['douce'] = self.check_makeuce.GetValue()
parametres['tiret'] = self.check_tirets.GetValue()
parametres['tolist'] = self.check_tolist.GetValue()
parametres['keep_ponct'] = self.check_ponct.GetValue()
+ if self.radio_other_dict.GetValue() :
+ parametres['dictionary'] = self.otherdictpath.GetPath()
for val in parametres :
if isinstance(parametres[val], bool) :
if parametres[val] :
else :
parametres[val] = 0
return parametres
+
+ def OnChangeLangage(self, evt):
+ self.defaultdictpath.SetValue(self.langues[self.lang_choices.GetSelection()])
+
+ def changedictchoice(self, evt):
+ if self.radio_default_dict.GetValue() :
+ self.otherdictpath.Enable( False )
+ self.m_sdbSizer1OK.Enable( True )
+ else :
+ self.otherdictpath.Enable( True )
+ if self.otherdictpath.GetPath() == '' :
+ self.m_sdbSizer1OK.Enable( False )
+
+ def selectdict(self, evt):
+ if self.otherdictpath.GetPath() != '' :
+ self.m_sdbSizer1OK.Enable( True )
+
-class message(wx.Dialog):
- def __init__(self, parent, title, size, save = True):
- wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = size, style = wx.DEFAULT_DIALOG_STYLE )
- self.save = save
- self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
+class ConcordList(wx.HtmlListBox):
+ def __init__(self, parent, concord):
+ self.concord = concord
+ #self.script_status = dict()
+ wx.HtmlListBox.__init__(self, parent, -1, size = (900, 600))
+ self.SetItemCount(len(concord))
+ #self.Bind(wx.EVT_LISTBOX, self.RefreshMe)
+ #self.Bind(wx.EVT_LISTBOX_DCLICK, self.Download)
+
+ def OnGetItem(self, index):
+ return self.concord[index] #+ '<br>'
+
+class message(wx.Frame):
+ def __init__(self, parent, items, title, size, save = True, uceids = None):
+ wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = size, style = wx.DEFAULT_FRAME_STYLE )
+ self.save = save
+ self.uceids = uceids
+ self.ira = wx.GetApp().GetTopWindow()
+ self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
+ self.items = items
self.html = ""
- 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.HtmlPage=wx.html.HtmlWindow(self, -1)
+ self.HtmlPage = ConcordList(self, 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)
if self.save :
self.button_2 = wx.Button(self, 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.Bind(wx.EVT_BUTTON, self.OnSub, self.butsub)
self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
self.__do_layout()
def __do_layout(self):
sizer_2 = wx.BoxSizer(wx.VERTICAL)
- sizer_2.Add(self.HtmlPage, 0, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
- m_sdbSizer1 = wx.StdDialogButtonSizer()
- m_sdbSizer1.AddButton( self.button_1 )
+ 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)
if self.save :
- m_sdbSizer1.AddButton( self.button_2 )
- m_sdbSizer1.Realize()
- sizer_2.Add(m_sdbSizer1, 1, wx.EXPAND, 5)
+ m_sdbSizer1.Add( self.button_2 , 0, wx.RIGHT | wx.EXPAND)
+ if self.uceids is not None :
+ m_sdbSizer1.Add( self.butsub , 0, wx.RIGHT | wx.EXPAND)
+ #m_sdbSizer1.Realize()
+ sizer_2.Add(m_sdbSizer1, 0, wx.RIGHT | wx.EXPAND, 5)
self.SetSizer(sizer_2)
self.Layout()
sizer_2.Fit( self )
)
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:
path = dlg.GetPath()
with open(path, 'w') as f :
def OnCloseWindow(self, event):
self.Destroy()
+
+ def OnSub(self ,evt):
+ parametres = {'fromuceids' : True, 'uceids' : self.uceids}
+ self.ira.OnSubText(None, parametres)
+
+
class ExtractDialog ( wx.Dialog ):
fgSizer1.SetFlexibleDirection( wx.BOTH )
fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
- self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Corpora").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"corpus").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText1.Wrap( -1 )
fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
self.extractformat = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, extractformatChoices, 1, wx.RA_SPECIFY_COLS )
self.extractformat.SetSelection( 0 )
fgSizer1.Add( self.extractformat, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ if option == 'them' :
+ self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"thematics (one by line, with the -*)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText4.Wrap( -1 )
+ fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.txtmods = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE )
+ self.txtmods.SetMinSize( wx.Size( 200,150 ) )
+
+ fgSizer1.Add( self.txtmods, 0, wx.ALL|wx.EXPAND, 5 )
+
+ #self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Extraction type").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 )
+
+ #extractformatChoices = [ _(u"Only one file").decode('utf8'), _(u"One file by thematic").decode('utf8') ]
+ #self.extractformat = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, extractformatChoices, 1, wx.RA_SPECIFY_COLS )
+ #self.extractformat.SetSelection( 0 )
+ #fgSizer1.Add( self.extractformat, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
fgSizer1.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
- m_sdbSizer1.Realize();
+ m_sdbSizer1.Realize()
fgSizer1.Add( m_sdbSizer1, 1, wx.EXPAND, 5 )
parametres['onefile'] = True
else :
parametres['onefile'] = False
- parametres['encodeout'] = locale.getpreferredencoding()
+ if self.option == 'them' :
+ parametres['them'] = self.txtmods.GetValue().splitlines()
+ # if self.extractformat.GetSelection() == 0 :
+ # parametres['onefile'] = True
+ # else :
+ # parametres['onefile'] = False
+ parametres['encodeout'] = le[self.encodage.GetSelection()]
return parametres
def __del__( self ):
pass
-class FreqDialog(wx.Dialog):
- def __init__(self, parent, ID, listcol, title, size) :
- wx.Dialog.__init__(self, parent, ID, title, size=size, pos=wx.DefaultPosition,style=wx.DEFAULT_DIALOG_STYLE | wx.CANCEL | wx.OK )
- pre = wx.PreDialog()
- pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
- pre.Create(parent, ID, title, wx.DefaultPosition, size, wx.DEFAULT_DIALOG_STYLE | wx.CANCEL | wx.OK)
- self.PostCreate(pre)
- self.parent = parent
- sizer = wx.BoxSizer(wx.VERTICAL)
- #self.content = parent.content
+# class FreqDialog(wx.Dialog):
+# def __init__(self, parent, ID, listcol, title, size) :
+# wx.Dialog.__init__(self, parent, ID, title, size=size, pos=wx.DefaultPosition,style=wx.DEFAULT_DIALOG_STYLE | wx.CANCEL | wx.OK )
+# pre = wx.PreDialog()
+# pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
+# pre.Create(parent, ID, title, wx.DefaultPosition, size, wx.DEFAULT_DIALOG_STYLE | wx.CANCEL | wx.OK)
+# self.PostCreate(pre)
+# self.parent = parent
+# sizer = wx.BoxSizer(wx.VERTICAL)
+# #self.content = parent.content
+# self.header = listcol
+# #LABELLIST = []
+# #for i in self.header:
+# # forme = i
+# # if len(forme) > 60 :
+# # LABELLIST.append(i[0:60])
+# # else:
+# # LABELLIST.append(i)
+# self.list_box_1 = wx.ListBox(self, -1, choices=self.header, style=wx.LB_EXTENDED | wx.LB_HSCROLL)
+# sizer.Add(self.list_box_1, 0, 5)
+#
+# btnsizer = wx.BoxSizer(wx.HORIZONTAL)
+#
+# btn = wx.Button(self, wx.ID_CANCEL)
+# btnsizer.Add(btn)
+#
+# btn = wx.Button(self, wx.ID_OK)
+# btn.SetDefault()
+# btnsizer.Add(btn)
+#
+# sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5)
+# self.SetSizer(sizer)
+# sizer.Fit(self)
+# self.SetTitle(_(u"Selection").decode('utf8'))
+#
+ # end wxGlade
+
+
+class FreqDialog ( wx.Dialog ):
+
+ def __init__( self, parent, listcol, title, size = wx.Size( -1,-1 ), showNA = True):
+ wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( -1,-1 ), style = wx.DEFAULT_DIALOG_STYLE )
+
self.header = listcol
- #LABELLIST = []
- #for i in self.header:
- # forme = i
- # if len(forme) > 60 :
- # LABELLIST.append(i[0:60])
- # else:
- # LABELLIST.append(i)
- self.list_box_1 = wx.ListBox(self, -1, choices=self.header, style=wx.LB_EXTENDED | wx.LB_HSCROLL)
- sizer.Add(self.list_box_1, 0, 5)
-
- btnsizer = wx.BoxSizer(wx.HORIZONTAL)
- btn = wx.Button(self, wx.ID_CANCEL)
- btnsizer.Add(btn)
+ self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
- btn = wx.Button(self, wx.ID_OK)
- btn.SetDefault()
- btnsizer.Add(btn)
+ bSizer1 = wx.BoxSizer( wx.VERTICAL )
- sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5)
- self.SetSizer(sizer)
- sizer.Fit(self)
- self.SetTitle(_(u"Selection").decode('utf8'))
-
- # end wxGlade
+ m_listBox1Choices = self.header
+ self.m_listBox1 = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_listBox1Choices, wx.LB_EXTENDED|wx.LB_HSCROLL )
+ self.m_listBox1.SetMinSize( wx.Size( 500,-1 ) )
+ bSizer1.Add( self.m_listBox1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ if showNA :
+ fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
+ fgSizer1.SetFlexibleDirection( wx.BOTH )
+ fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
+
+ self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Include empty cells (NA)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText1.Wrap( -1 )
+ fgSizer1.Add( self.m_staticText1, 0, wx.ALL, 5 )
+
+ self.includeNA = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
+ fgSizer1.Add( self.includeNA, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ bSizer1.Add( fgSizer1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 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, 0, wx.EXPAND, 5 )
+
+
+ self.SetSizer( bSizer1 )
+ self.Layout()
+ bSizer1.Fit( self )
+
+ self.Centre( wx.BOTH )
+
+ def __del__( self ):
+ pass
+
+
class ProtoDial ( wx.Dialog ):
def __init__( self, parent, headers ):
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 )
- self.SetSizeHintsSz( wx.Size( 200,300 ), wx.DefaultSize )
+ self.SetSizeHintsSz( wx.Size( -1,-1 ), wx.DefaultSize )
bSizer1 = wx.BoxSizer( wx.VERTICAL )
fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
variablesChoices = headers
- self.variables = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, variablesChoices, wx.LB_MULTIPLE )
- self.variables.SetMinSize( wx.Size( 150,-1 ) )
+ self.variables = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, variablesChoices, wx.LB_HSCROLL|wx.LB_MULTIPLE )
+ self.variables.SetMinSize( wx.Size( 350,-1 ) )
- fgSizer1.Add( self.variables, 0, wx.ALL|wx.EXPAND, 5 )
+ fgSizer1.Add( self.variables, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
rangsChoices = headers
- self.rangs = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, rangsChoices, wx.LB_MULTIPLE )
- self.rangs.SetMinSize( wx.Size( 150,-1 ) )
+ self.rangs = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, rangsChoices, wx.LB_HSCROLL|wx.LB_MULTIPLE )
+ self.rangs.SetMinSize( wx.Size( 350,-1 ) )
- fgSizer1.Add( self.rangs, 0, wx.ALL|wx.EXPAND, 5 )
+ fgSizer1.Add( self.rangs, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
- bSizer1.Add( fgSizer1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5 )
+ bSizer1.Add( fgSizer1, 1, wx.ALIGN_CENTER_HORIZONTAL, 5 )
fgSizer3 = wx.FlexGridSizer( 0, 2, 0, 0 )
fgSizer3.SetFlexibleDirection( wx.BOTH )
self.m_textCtrl4 = wx.TextCtrl( self, wx.ID_ANY, u"2", wx.DefaultPosition, wx.DefaultSize, wx.TE_CENTRE )
fgSizer3.Add( self.m_textCtrl4, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
+ self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, u"Type de représentation", wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText6.Wrap( -1 )
+ fgSizer3.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ m_choice3Choices = [ u"Classical - List", u"Classical - Cloud", u"Plan" ]
+ self.typegraph = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_choice3Choices, 0 )
+ self.typegraph.SetSelection( 0 )
+ fgSizer3.Add( self.typegraph, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
- bSizer1.Add( fgSizer3, 1, wx.EXPAND, 5 )
+ bSizer1.Add( fgSizer3, 0, wx.ALIGN_CENTER_HORIZONTAL, 5 )
m_sdbSizer1 = wx.StdDialogButtonSizer()
self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
def __del__( self ):
pass
+
+
+class SubTextFromMetaDial ( wx.Dialog ):
+
+ def __init__( self, parent, parametres ):
+ wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Subcorpus from metadata", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
+
+ self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
+
+ bSizer1 = wx.BoxSizer( wx.VERTICAL )
+
+ fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
+ fgSizer1.SetFlexibleDirection( wx.BOTH )
+ fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
+
+ self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"SubCorpus Name", wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText1.Wrap( -1 )
+ fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.subcorpusname = wx.TextCtrl( self, wx.ID_ANY, parametres['corpus_name'], wx.DefaultPosition, wx.Size( 300,-1 ), 0 )
+ fgSizer1.Add( self.subcorpusname, 0, wx.ALL, 5 )
+
+ self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"Select one or more metadata", wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText2.Wrap( -1 )
+ fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ m_listBox1Choices = parametres['meta']
+ self.m_listBox1 = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( -1,-1 ), m_listBox1Choices, wx.LB_HSCROLL|wx.LB_MULTIPLE )
+ self.m_listBox1.SetMinSize( wx.Size( -1,200 ) )
+ self.m_listBox1.SetMaxSize( wx.Size( -1,500 ) )
+
+ fgSizer1.Add( self.m_listBox1, 0, wx.ALL|wx.EXPAND, 5 )
+
+
+ bSizer1.Add( fgSizer1, 1, wx.EXPAND, 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, 0, wx.EXPAND, 5 )
+
+
+ self.SetSizer( bSizer1 )
+ self.Layout()
+ bSizer1.Fit( self )
+
+ self.Centre( wx.BOTH )
+
+ def __del__( self ):
+ pass
+
+class BarGraphDialog ( wx.Dialog ):
+
+ def __init__( self, parent, width, height ):
+ wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Preferences", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
+
+ self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
+
+ bSizer1 = wx.BoxSizer( wx.VERTICAL )
+
+ bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
+
+ self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Size", wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText1.Wrap( -1 )
+ bSizer2.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ sizeradioChoices = [ u"automatic", u"manual" ]
+ self.sizeradio = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, sizeradioChoices, 1, wx.RA_SPECIFY_COLS )
+ self.sizeradio.SetSelection( 0 )
+ bSizer2.Add( self.sizeradio, 0, wx.ALIGN_TOP|wx.ALL, 5 )
+
+ fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
+ fgSizer1.SetFlexibleDirection( wx.BOTH )
+ fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
+
+ self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"width", wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText2.Wrap( -1 )
+ fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.widthsp = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 1000000, 600 )
+ fgSizer1.Add( self.widthsp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"height", wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText3.Wrap( -1 )
+ fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.heightsp = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 1, 10000000, 400 )
+ fgSizer1.Add( self.heightsp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+
+ bSizer2.Add( fgSizer1, 1, wx.EXPAND, 5 )
+
+
+ bSizer1.Add( bSizer2, 1, wx.EXPAND, 5 )
+
+ bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
+
+ self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, u"Image format", wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText4.Wrap( -1 )
+ bSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ formatChoices = [ u"png", u"svg" ]
+ self.format = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, formatChoices, 0 )
+ self.format.SetSelection( 0 )
+ bSizer3.Add( self.format, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+
+ bSizer1.Add( bSizer3, 1, wx.EXPAND, 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, 0, wx.EXPAND, 5 )
+
+
+ self.SetSizer( bSizer1 )
+ self.Layout()
+ bSizer1.Fit( self )
+
+ self.Centre( wx.BOTH )
+
+ # Connect Events
+ self.sizeradio.Bind( wx.EVT_RADIOBOX, self.OnSizeRadio )
+
+ self.widthsp.SetValue(width)
+ self.heightsp.SetValue(height)
+ self.widthsp.Enable(False)
+ self.heightsp.Enable(False)
+ self.m_sdbSizer1OK.SetFocus()
+
+ def __del__( self ):
+ pass
+
+
+ # Virtual event handlers, overide them in your derived class
+ def OnSizeRadio( self, event ):
+ if self.sizeradio.GetSelection() == 0 :
+ self.widthsp.Enable(False)
+ self.heightsp.Enable(False)
+ else :
+ self.widthsp.Enable(True)
+ 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.DEFAULT_FRAME_STYLE )
+ 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"iamge.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.Layout()
+ self.sizer_1.Fit( self )
+
+ def OnCloseMe(self, event):
+ self.Destroy()
+
+ def OnSaveImage(self, event) :
+ dlg = wx.FileDialog(
+ self, message="Enregistrer sous...", defaultDir=os.getcwd(),
+ defaultFile= self.imagename, wildcard=self.parametres['wildcard'], style=wx.SAVE | wx.OVERWRITE_PROMPT
+ )
+ dlg.SetFilterIndex(2)
+ dlg.CenterOnParent()
+ if dlg.ShowModal() == wx.ID_OK:
+ path = dlg.GetPath()
+ copyfile(self.imageFile, path)
+
+class BarFrame :
+ def __init__(self, ira, table, colnames, rownames, tree = False):
+ if not tree :
+ width = 100 + (10*len(rownames)) + (100 * len(colnames))
+ height = len(rownames) * 15
+ if height < 400 :
+ height = 400
+ else :
+ width = 500
+ height = (35 * len(colnames)) + (15 * len(rownames))
+ dial = BarGraphDialog(ira, width, height)
+ val = dial.ShowModal()
+ if val == wx.ID_OK :
+ tmpgraph = tempfile.mktemp(dir=ira.TEMPDIR)
+ if dial.format.GetSelection() == 0 :
+ svg = 'FALSE'
+ wildcard = "png|*.png"
+ else :
+ svg = 'TRUE'
+ wildcard = "svg|*.svg"
+ parametres = {'width' : dial.widthsp.GetValue(),
+ 'height': dial.heightsp.GetValue(),
+ 'colnames' : colnames,
+ 'rownames' : rownames,
+ 'tmpgraph' : tmpgraph,
+ 'rgraph' : ira.RscriptsPath['Rgraph'],
+ 'svg' : svg,
+ 'wildcard' : wildcard}
+ if tree :
+ parametres['tree'] = tree
+ txt = barplot(table, parametres)
+ tmpscript = tempfile.mktemp(dir=ira.TEMPDIR)
+ with open(tmpscript,'w') as f :
+ f.write(txt)
+ exec_rcode(ira.RPath, tmpscript, wait = True)
+ win = MessageImage(ira, parametres, u"Graphique", 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.Show(True)
+ dial.Destroy()
\ No newline at end of file