Ejemplo n.º 1
0
 def OnDialectChoice(self, event):
     """Updates all param widgets confirming to the selcted dialect"""
     
     dialect_name = event.GetString()
     value = list(self.choices['dialects']).index(dialect_name)
     
     if dialect_name == 'sniffer':
         dialect, self.has_header = sniff(self.csvfilepath)
     elif dialect_name == 'user':
         event.Skip()
         return None
     else:
         dialect = csv.get_dialect(dialect_name)
         
     #print dialect, self.has_header
     self._update_settings(dialect)
     
     self.choice_dialects.SetValue(value)
Ejemplo n.º 2
0
 def __init__(self, parent, csvfilepath):
     self.parent = parent
     self.csvfilepath = csvfilepath
     
     if csvfilepath is None:
         dialect = csv.get_dialect(csv.list_dialects()[0])
         self.has_header = False
     else:
         dialect, self.has_header = sniff(self.csvfilepath)
     
     self.param_labels = []
     self.param_widgets = []
     
     self._setup_param_widgets()
     self._do_layout()
     self._update_settings(dialect)
     
     self.choice_dialects.SetSelection(0)
Ejemplo n.º 3
0
 def __init__(self, *args, **kwds):
     self.csvfilepath = kwds.pop("csvfilepath")
     self.csvfilename = os.path.split(self.csvfilepath)[1]
     
     kwds["style"] = wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.THICK_FRAME
     
     wx.Dialog.__init__(self, *args, **kwds)
     
     self.csvwidgets = CsvParameterWidgets(self, self.csvfilepath)
     dialect, self.has_header = sniff(self.csvfilepath)
     
     self.grid = CSVPreviewGrid(self, -1, \
                                has_header=self.has_header, \
                                csvfilepath=self.csvfilepath)
     
     self.button_cancel = wx.Button(self, wx.ID_CANCEL, "")
     self.button_ok = wx.Button(self, wx.ID_OK, "")
     
     self._set_properties()
     self._do_layout()
     
     
     self.grid.fill_cells(dialect, self.has_header)