description is plotted better now
This commit is contained in:
@@ -2268,6 +2268,13 @@ class MonitorWidgets:
|
||||
self.display_autoscaling_checkbutton = self.xml_gui.get_object( "display_autoscaling_checkbutton" )
|
||||
self.display_statistics_checkbutton = self.xml_gui.get_object( "display_statistics_checkbutton" )
|
||||
|
||||
self.display_descriptions_checkbutton = gtk.CheckButton(label="Show Desc.")
|
||||
self.display_descriptions_checkbutton.set_active(True)
|
||||
self.display_descriptions_checkbutton.show()
|
||||
self.display_settings_frame.set_property("n-columns", 5)
|
||||
self.display_settings_frame.attach(self.display_descriptions_checkbutton, 4, 5, 0, 1, gtk.AttachOptions.FILL, 0, 0, 0)
|
||||
self.display_descriptions_checkbutton.connect("toggled", self.display_descriptions_toggled)
|
||||
|
||||
# Matplot (Display_Table, 1st Row) --------------------------------------------------------
|
||||
|
||||
# create new plot
|
||||
@@ -2361,6 +2368,7 @@ class MonitorWidgets:
|
||||
self.__rescale = True
|
||||
self.update_counter = 0
|
||||
self.update_counter_lock = threading.Lock( )
|
||||
self.description_text = None
|
||||
|
||||
def source_list_reset( self ):
|
||||
self.display_source_treestore.clear( )
|
||||
@@ -2683,6 +2691,10 @@ class MonitorWidgets:
|
||||
if self.displayed_data[ 0 ] is not None:
|
||||
self.update_display( self.displayed_data[ 0 ][ : ] )
|
||||
|
||||
def display_descriptions_toggled( self, widget, data=None ):
|
||||
if self.displayed_data[ 0 ] is not None:
|
||||
self.update_display( self.displayed_data[ 0 ][ : ] )
|
||||
|
||||
def save_display_data_as_text( self, widget, data=None ):
|
||||
"""
|
||||
copy data to tmp file and show save dialog
|
||||
@@ -2933,6 +2945,12 @@ class MonitorWidgets:
|
||||
self.graphen = [ ]
|
||||
self.matplot_axes.clear( )
|
||||
self.matplot_axes.grid( True )
|
||||
if self.description_text is not None:
|
||||
try:
|
||||
self.description_text.remove()
|
||||
except:
|
||||
pass
|
||||
self.description_text = None
|
||||
self.matplot_canvas.draw_idle( )
|
||||
|
||||
def update_display( self, subject=None ):
|
||||
@@ -3091,25 +3109,34 @@ class MonitorWidgets:
|
||||
self.matplot_axes.set_ylabel( "" )
|
||||
|
||||
# Any variables to be drawn on plot
|
||||
if False:
|
||||
descriptions = None
|
||||
description_lines = []
|
||||
if self.display_descriptions_checkbutton.get_active():
|
||||
if isinstance(in_result, Accumulation):
|
||||
descriptions = in_result.common_descriptions
|
||||
description_lines.append("n = %d" % in_result.n)
|
||||
if in_result.common_descriptions is not None:
|
||||
description_lines.extend(["%s = %s" % (key, in_result.common_descriptions[key]) for key in in_result.common_descriptions.keys()])
|
||||
elif isinstance(in_result, ADC_Result):
|
||||
descriptions = in_result.description
|
||||
if hasattr(in_result, "job_id") and in_result.job_id is not None:
|
||||
description_lines.append("job_id = %s" % str(in_result.job_id))
|
||||
if hasattr(in_result, "description") and in_result.description is not None:
|
||||
description_lines.extend(["%s = %s" % (key, in_result.description[key]) for key in in_result.description.keys()])
|
||||
|
||||
if description_lines:
|
||||
description_string = "\n".join(description_lines)
|
||||
if self.description_text is None:
|
||||
self.description_text = self.matplot_axes.text(0.98, 0.95, description_string,
|
||||
size=10,
|
||||
transform=self.matplot_axes.transAxes,
|
||||
va='top', ha='right', ma='left',
|
||||
bbox=dict(facecolor='lightgray', alpha=0.5, boxstyle='round,pad=0.2'))
|
||||
else:
|
||||
pass
|
||||
#actual_config = self.config.get()
|
||||
if (descriptions is not None):
|
||||
#print(actual_config['pretty_descriptions'])
|
||||
description_string = ""
|
||||
for key in descriptions.keys():
|
||||
description_string += "%s = %s\n" % (key,descriptions[key])
|
||||
self.matplot_axes.text(0.8,0.95, description_string[:-1],
|
||||
size=10,
|
||||
transform=self.matplot_axes.transAxes,
|
||||
va='top',
|
||||
backgroundcolor='white')
|
||||
self.description_text.set_text(description_string)
|
||||
elif self.description_text is not None:
|
||||
try:
|
||||
self.description_text.remove()
|
||||
except:
|
||||
pass
|
||||
self.description_text = None
|
||||
|
||||
# Draw it!
|
||||
self.matplot_canvas.draw_idle( )
|
||||
|
||||
Reference in New Issue
Block a user