Implemted PPM display (Fixes T140)

This commit is contained in:
Markus Rosenstihl 2018-12-12 10:29:27 +01:00
parent 9bdb8df76e
commit dc7099d731

View File

@ -2801,8 +2801,17 @@ class MonitorWidgets:
unconditionally throw away everything unconditionally throw away everything
we are inside gtk/gdk lock we are inside gtk/gdk lock
""" """
self.display_x_scaling_combobox.set_sensitive( False ) self.display_x_scaling_combobox.set_sensitive( True )
self.display_y_scaling_combobox.set_sensitive( False ) self.display_y_scaling_combobox.set_sensitive( True )
x_scale = self.display_x_scaling_combobox.get_active_text()
y_scale = self.display_y_scaling_combobox.get_active_text()
if x_scale == "lin":
self.matplot_axes.set_xscale("linear")
elif x_scale == "log10":
self.matplot_axes.set_xscale("log", basex=10, nonposx="mask")
elif x_scale == "ppm":
self.matplot_axes.set_xscale("linear")
self.matplot_axes.invert_xaxis()
if not hasattr( self, "__rescale" ): if not hasattr( self, "__rescale" ):
self.__rescale = True self.__rescale = True
@ -2847,35 +2856,45 @@ class MonitorWidgets:
self.clear_display( ) self.clear_display( )
return return
if isinstance( in_result, Accumulation ) or isinstance( in_result, ADC_Result ): if isinstance( in_result, Accumulation ) or isinstance( in_result, ADC_Result ):
# directly taken from bluedamaris
xmin = in_result.get_xmin( ) xmin = in_result.get_xmin( )
xmax = in_result.get_xmax( ) xmax = in_result.get_xmax( )
ymin = in_result.get_ymin( ) ymin = in_result.get_ymin( )
ymax = in_result.get_ymax( ) ymax = in_result.get_ymax( )
# Check for log-scale # # Check for log-scale
if xmin <= 0 or xmax <= 0: # if xmin <= 0 or xmax <= 0:
self.display_x_scaling_combobox.set_sensitive( False ) # self.display_x_scaling_combobox.set_sensitive( False )
self.display_x_scaling_combobox.set_active( 0 ) # self.display_x_scaling_combobox.set_active( 0 )
else: # else:
self.display_x_scaling_combobox.set_sensitive( True ) # self.display_x_scaling_combobox.set_sensitive( True )
#
if ymin <= 0 or ymax <= 0: # if ymin <= 0 or ymax <= 0:
self.display_y_scaling_combobox.set_sensitive( False ) # self.display_y_scaling_combobox.set_sensitive( False )
self.display_y_scaling_combobox.set_active( 0 ) # self.display_y_scaling_combobox.set_active( 0 )
else: # else:
self.display_y_scaling_combobox.set_sensitive( False ) # self.display_y_scaling_combobox.set_sensitive( False )
# Initial rescaling needed? # Initial rescaling needed?
if self.__rescale: if self.__rescale:
x_scale = self.display_x_scaling_combobox.get_active_text( ) x_scale = self.display_x_scaling_combobox.get_active_text( )
y_scale = self.display_y_scaling_combobox.get_active_text( ) y_scale = self.display_y_scaling_combobox.get_active_text( )
if xmin <= 0 or x_scale == "lin": if x_scale == "lin":
self.matplot_axes.set_xscale( "linear" ) self.matplot_axes.set_xscale( "linear" )
if ymin <= 0 or y_scale == "lin": self.matplot_axes.set_xlim(xmin, xmax)
elif x_scale == "log10":
self.matplot_axes.set_xscale("log", basex=10, nonposx="mask")
self.matplot_axes.set_xlim(xmin, xmax)
elif x_scale == "ppm":
self.matplot_axes.set_xscale("linear")
self.matplot_axes.set_xlabel("PPM")
#self.matplot_axes.set_xlim(xmax, xmin)
self.matplot_axes.invert_xaxis()
if y_scale == "lin":
self.matplot_axes.set_yscale( "linear" ) self.matplot_axes.set_yscale( "linear" )
self.matplot_axes.set_xlim( xmin, xmax ) elif y_scale == "log10":
self.matplot_axes.set_yscale("log", basex=10, nonposy="mask")
#self.matplot_axes.set_xlim( xmin, xmax )
self.matplot_axes.set_ylim( ymin, ymax ) self.matplot_axes.set_ylim( ymin, ymax )
self.__rescale = False self.__rescale = False