Ejemplo n.º 1
0
        def on_write_MAT_files_combo_box(event):
            #
            # Update the state to reflect the new measurement choice
            #
            sel = write_measurements_combo_box.GetStringSelection()
            output_filename = output_filename_edit_box.Value
            if sel == WRITE_HDF_FILE_TEXT:
                cpprefs.set_write_MAT_files(cpprefs.WRITE_HDF5)
                if output_filename.lower().endswith('.mat'):
                    output_filename = output_filename[:-4] + u".h5"
            elif sel == WRITE_MAT_FILE_TEXT:
                cpprefs.set_write_MAT_files(True)
                if output_filename.lower().endswith('.h5'):
                    output_filename = output_filename[:-3] + u".mat"
            else:
                cpprefs.set_write_MAT_files(False)

            if output_filename != output_filename_edit_box.Value:
                output_filename_edit_box.Value = output_filename
                cpprefs.set_output_file_name(output_filename_edit_box.Value)
            #
            # Reconstruct the sizers depending on whether we have one or two rows
            #
            if sel == DO_NOT_WRITE_MEASUREMENTS_TEXT:
                show = False
                output_sizer = wx.BoxSizer(wx.HORIZONTAL)
                output_sizer.Add(output_filename_help_button, 0, wx.EXPAND)
                output_sizer.Add(output_file_format_text, 0, wx.ALIGN_RIGHT)
                output_sizer.Add(write_measurements_combo_box, 0,
                                 wx.ALIGN_LEFT)
            else:
                show = True
                output_sizer = wx.FlexGridSizer(2, 3, 2, 2)
                output_sizer.SetFlexibleDirection(wx.HORIZONTAL)
                output_sizer.AddGrowableCol(2)
                output_filename_edit_box_sizer = wx.BoxSizer(wx.HORIZONTAL)
                output_filename_edit_box_sizer.Add(output_filename_edit_box, 1,
                                                   wx.EXPAND)
                output_filename_edit_box_sizer.AddSpacer(2)
                output_filename_edit_box_sizer.Add(
                    allow_output_filename_overwrite_check_box, 0,
                    wx.ALIGN_CENTER)
                output_sizer.Add(output_filename_help_button, 0, wx.EXPAND)
                output_sizer.Add(output_filename_text, 0, wx.ALIGN_RIGHT)
                output_sizer.Add(output_filename_edit_box_sizer, 1, wx.EXPAND)

                output_sizer.Add(wx.BoxSizer(), 0, wx.EXPAND)
                output_sizer.Add(output_file_format_text, 0, wx.ALIGN_RIGHT)
                output_sizer.Add(write_measurements_combo_box, 0,
                                 wx.ALIGN_LEFT)

            panel.SetSizer(output_sizer)
            for ctrl in (output_filename_text, output_filename_edit_box,
                         allow_output_filename_overwrite_check_box):
                ctrl.Show(show)

            panel.Parent.Layout()
            panel.Layout()
Ejemplo n.º 2
0
 def on_write_MAT_files_combo_box(event):
     #
     # Update the state to reflect the new measurement choice
     #
     sel = write_measurements_combo_box.GetStringSelection()
     output_filename = output_filename_edit_box.Value
     if sel == WRITE_HDF_FILE_TEXT:
         cpprefs.set_write_MAT_files(cpprefs.WRITE_HDF5)
         if output_filename.lower().endswith('.mat'):
             output_filename = output_filename[:-4] + u".h5"
     elif sel == WRITE_MAT_FILE_TEXT:
         cpprefs.set_write_MAT_files(True)
         if output_filename.lower().endswith('.h5'):
             output_filename = output_filename[:-3] + u".mat"
     else:
         cpprefs.set_write_MAT_files(False)
         
     if output_filename != output_filename_edit_box.Value:
         output_filename_edit_box.Value = output_filename
         cpprefs.set_output_file_name(
             output_filename_edit_box.Value)
     #
     # Reconstruct the sizers depending on whether we have one or two rows
     #
     if sel == DO_NOT_WRITE_MEASUREMENTS_TEXT:
         show = False
         output_sizer = wx.BoxSizer(wx.HORIZONTAL)
         output_sizer.Add(output_filename_help_button, 0, wx.EXPAND)
         output_sizer.Add(output_file_format_text, 0, wx.ALIGN_RIGHT)
         output_sizer.Add(write_measurements_combo_box, 0, wx.ALIGN_LEFT)
     else:
         show = True
         output_sizer = wx.FlexGridSizer(2, 3, 2, 2)
         output_sizer.SetFlexibleDirection(wx.HORIZONTAL)
         output_sizer.AddGrowableCol(2)
         output_filename_edit_box_sizer = wx.BoxSizer(wx.HORIZONTAL)
         output_filename_edit_box_sizer.Add(
             output_filename_edit_box, 1 , wx.EXPAND)
         output_filename_edit_box_sizer.AddSpacer(2)
         output_filename_edit_box_sizer.Add(
             allow_output_filename_overwrite_check_box, 0, 
             wx.ALIGN_CENTER)
         output_sizer.Add(output_filename_help_button, 0, wx.EXPAND)
         output_sizer.Add(output_filename_text, 0, wx.ALIGN_RIGHT)
         output_sizer.Add(output_filename_edit_box_sizer, 1, wx.EXPAND)
         
         output_sizer.Add(wx.BoxSizer(), 0, wx.EXPAND)
         output_sizer.Add(output_file_format_text, 0, wx.ALIGN_RIGHT)
         output_sizer.Add(write_measurements_combo_box, 0, wx.ALIGN_LEFT)
         
     panel.SetSizer(output_sizer)
     for ctrl in (output_filename_text,
                  output_filename_edit_box,
                  allow_output_filename_overwrite_check_box):
         ctrl.Show(show)
         
     panel.Parent.Layout()
     panel.Layout()
Ejemplo n.º 3
0
 def on_write_MAT_files_combo_box(event):
     sel = self.__write_measurements_combo_box.GetStringSelection()
     output_filename = self.__output_filename_edit_box.Value
     if sel == WRITE_HDF_FILE:
         cpprefs.set_write_MAT_files(cpprefs.WRITE_HDF5)
         if output_filename.lower().endswith('.mat'):
             output_filename = output_filename[:-4] + u".h5"
     elif sel == WRITE_MAT_FILE:
         cpprefs.set_write_MAT_files(True)
         if output_filename.lower().endswith('.h5'):
             output_filename = output_filename[:-3] + u".mat"
     else:
         cpprefs.set_write_MAT_files(False)
     if output_filename != self.__output_filename_edit_box.Value:
         self.__output_filename_edit_box.Value = output_filename
         cpprefs.set_output_file_name(self.__output_filename_edit_box.Value)
     self.__show_output_filename(sel != DO_NOT_WRITE_MEASUREMENTS)
     panel.Layout()
     panel.Refresh()
Ejemplo n.º 4
0
 def on_write_MAT_files_checkbox(event):
     wants_write = self.__write_measurements_check_box.Value
     cpprefs.set_write_MAT_files(wants_write)
     self.__show_output_filename(wants_write)
     panel.Layout()