Implemted PPM display (Fixes T140)
This commit is contained in:
parent
9bdb8df76e
commit
dc7099d731
@ -2801,8 +2801,17 @@ class MonitorWidgets:
|
||||
unconditionally throw away everything
|
||||
we are inside gtk/gdk lock
|
||||
"""
|
||||
self.display_x_scaling_combobox.set_sensitive( False )
|
||||
self.display_y_scaling_combobox.set_sensitive( False )
|
||||
self.display_x_scaling_combobox.set_sensitive( True )
|
||||
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" ):
|
||||
self.__rescale = True
|
||||
|
||||
@ -2847,35 +2856,45 @@ class MonitorWidgets:
|
||||
self.clear_display( )
|
||||
return
|
||||
if isinstance( in_result, Accumulation ) or isinstance( in_result, ADC_Result ):
|
||||
# directly taken from bluedamaris
|
||||
|
||||
xmin = in_result.get_xmin( )
|
||||
xmax = in_result.get_xmax( )
|
||||
ymin = in_result.get_ymin( )
|
||||
ymax = in_result.get_ymax( )
|
||||
|
||||
# Check for log-scale
|
||||
if xmin <= 0 or xmax <= 0:
|
||||
self.display_x_scaling_combobox.set_sensitive( False )
|
||||
self.display_x_scaling_combobox.set_active( 0 )
|
||||
else:
|
||||
self.display_x_scaling_combobox.set_sensitive( True )
|
||||
|
||||
if ymin <= 0 or ymax <= 0:
|
||||
self.display_y_scaling_combobox.set_sensitive( False )
|
||||
self.display_y_scaling_combobox.set_active( 0 )
|
||||
else:
|
||||
self.display_y_scaling_combobox.set_sensitive( False )
|
||||
# # Check for log-scale
|
||||
# if xmin <= 0 or xmax <= 0:
|
||||
# self.display_x_scaling_combobox.set_sensitive( False )
|
||||
# self.display_x_scaling_combobox.set_active( 0 )
|
||||
# else:
|
||||
# self.display_x_scaling_combobox.set_sensitive( True )
|
||||
#
|
||||
# if ymin <= 0 or ymax <= 0:
|
||||
# self.display_y_scaling_combobox.set_sensitive( False )
|
||||
# self.display_y_scaling_combobox.set_active( 0 )
|
||||
# else:
|
||||
# self.display_y_scaling_combobox.set_sensitive( False )
|
||||
|
||||
# Initial rescaling needed?
|
||||
if self.__rescale:
|
||||
x_scale = self.display_x_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" )
|
||||
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_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.__rescale = False
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user