can now set ADC_Result bit depth in the config window (Bug #16)
This commit is contained in:
@@ -1953,6 +1953,20 @@ class ConfigTab:
|
||||
self.config_info_textview = self.xml_gui.get_object( "info_textview" )
|
||||
self.config_script_font_button = self.xml_gui.get_object( "script_fontbutton" )
|
||||
|
||||
# ADC bit depth setting
|
||||
self.config_adc_bit_depth_hbox = gtk.HBox(homogeneous=False, spacing=6)
|
||||
self.config_adc_bit_depth_label = gtk.Label(label="ADC bit depth:")
|
||||
self.config_adc_bit_depth_spinbutton = gtk.SpinButton.new_with_range(8, 32, 1)
|
||||
self.config_adc_bit_depth_spinbutton.set_value(ADC_Result.default_bit_depth)
|
||||
self.config_adc_bit_depth_spinbutton.set_tooltip_text("Set the default bit depth for clipping detection (e.g., 14 for 14-bit ADCs).")
|
||||
self.config_adc_bit_depth_spinbutton.connect("value-changed", self.on_adc_bit_depth_changed)
|
||||
self.config_adc_bit_depth_hbox.pack_start(self.config_adc_bit_depth_label, False, False, 0)
|
||||
self.config_adc_bit_depth_hbox.pack_start(self.config_adc_bit_depth_spinbutton, False, False, 0)
|
||||
backend_vbox = self.xml_gui.get_object("vbox4")
|
||||
if backend_vbox:
|
||||
backend_vbox.pack_start(self.config_adc_bit_depth_hbox, False, False, 0)
|
||||
self.config_adc_bit_depth_hbox.show_all()
|
||||
|
||||
# insert version informations
|
||||
components_text = """
|
||||
operating system %(os)s
|
||||
@@ -2046,7 +2060,7 @@ pygobject version %(pygobject)s
|
||||
"""
|
||||
complib_iter = self.config_data_pool_complib.get_active_iter( )
|
||||
complib = self.config_data_pool_complib.get_model( ).get_value( complib_iter, 0 )
|
||||
return {
|
||||
actual_config = {
|
||||
"start_backend": self.config_start_backend_checkbutton.get_active( ),
|
||||
"start_result_script": self.config_start_result_script_checkbutton.get_active( ),
|
||||
"start_experiment_script": self.config_start_experiment_script_checkbutton.get_active( ),
|
||||
@@ -2059,8 +2073,10 @@ pygobject version %(pygobject)s
|
||||
"data_pool_complib": complib,
|
||||
"data_pool_comprate": self.config_data_pool_comprate.get_value_as_int( ),
|
||||
"script_font": self.config_script_font_button.get_font_name( ),
|
||||
"adc_bit_depth": ADC_Result.default_bit_depth
|
||||
"adc_bit_depth": self.config_adc_bit_depth_spinbutton.get_value_as_int()
|
||||
}
|
||||
ADC_Result.default_bit_depth = actual_config["adc_bit_depth"]
|
||||
return actual_config
|
||||
|
||||
def set( self, config ):
|
||||
if "start_backend" in config:
|
||||
@@ -2088,6 +2104,7 @@ pygobject version %(pygobject)s
|
||||
self.set_script_font_handler( None )
|
||||
if "adc_bit_depth" in config:
|
||||
try:
|
||||
self.config_adc_bit_depth_spinbutton.set_value(float(config["adc_bit_depth"]))
|
||||
ADC_Result.default_bit_depth = int(config["adc_bit_depth"])
|
||||
except (ValueError, TypeError):
|
||||
pass
|
||||
@@ -2104,6 +2121,9 @@ pygobject version %(pygobject)s
|
||||
if iter is None:
|
||||
print("compression method %s is not supported" % config[ "data_pool_complib" ])
|
||||
|
||||
def on_adc_bit_depth_changed(self, widget):
|
||||
ADC_Result.default_bit_depth = widget.get_value_as_int()
|
||||
|
||||
def load_config_handler( self, widget ):
|
||||
if self.system_default_filename:
|
||||
self.load_config( self.system_default_filename )
|
||||
|
||||
Reference in New Issue
Block a user