From 1d492e940ad08cebffc6560573981301e658af61 Mon Sep 17 00:00:00 2001 From: Markus Rosenstihl Date: Thu, 19 Mar 2026 13:54:03 +0100 Subject: [PATCH] Added missing lock around update_counter (somehow fixes #10) --- src/gui/DamarisGUI.py | 38 +++++++++----------------------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/src/gui/DamarisGUI.py b/src/gui/DamarisGUI.py index ba3a66c..95ffab1 100644 --- a/src/gui/DamarisGUI.py +++ b/src/gui/DamarisGUI.py @@ -2278,42 +2278,35 @@ 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" ) - # insert monitor # Matplot (Display_Table, 1st Row) -------------------------------------------------------- - # Neue Abbildung erstellen + # create new plot self.matplot_figure = matplotlib.figure.Figure( ) # the plot area surrounded by axes self.matplot_axes = self.matplot_figure.add_axes( [ 0.1, 0.15, 0.8, 0.7 ] ) - # Achsen beschriften & Gitternetzlinien sichtbar machen self.matplot_axes.grid( True ) - # Ersten Plot erstellen und Referenz des ersten Eintrags im zurueckgegebenen Tupel speichern - # Voerst: graphen[0,1] = Real und Img-Kanal; [2,3] = Real-Fehler, [4,5] = Img-Fehler - #self.graphen = [] - #self.measurementresultgraph=None - self.matplot_axes.set_ylim( [ 0.0, 1.0 ] ) self.matplot_axes.set_xlim( [ 0.0, 1.0 ] ) self.matplot_axes.set_autoscale_on( self.display_autoscaling_checkbutton.get_active( ) ) - # Lineare y-/x-Skalierung + # linear y/x scaling self.matplot_axes.set_yscale( "linear" ) self.matplot_axes.set_xscale( "linear" ) - # Matplot in einen GTK-Rahmen stopfen + # add figure to canvas self.matplot_canvas = FigureCanvas( self.matplot_figure ) - # Add right-click context menu to canvas + # add right-click context menu to canvas self.matplot_canvas.connect("button-press-event", self.on_canvas_button_press) self.display_table = self.xml_gui.get_object( "display_table" ) self.display_table.attach( self.matplot_canvas, 0, 6, 0, 1, gtk.AttachOptions.EXPAND | gtk.AttachOptions.FILL, gtk.AttachOptions.EXPAND | gtk.AttachOptions.FILL, 0, 0 ) self.matplot_canvas.show( ) - # Matplot Toolbar hinzufuegen (Display_Table, 2. Zeile) + # add matplotlib toolbar (display_table, 2nd row) self.matplot_toolbar = matplotlib.backends.backend_gtk3.NavigationToolbar2GTK3( self.matplot_canvas ) # Make cursor position text bigger and bold - access message label directly @@ -2327,9 +2320,7 @@ class MonitorWidgets: self.display_table.attach( self.matplot_toolbar, 0, 1, 1, 2, gtk.AttachOptions.FILL | gtk.AttachOptions.EXPAND, 0, 0, 0 ) self.matplot_toolbar.show( ) - # /Mathplot -------------------------------------------------------------------------------- - - # display source + # select display source self.display_source_combobox = self.xml_gui.get_object( "display_source_combobox" ) self.display_source_treestore = gtk.TreeStore( gobject.TYPE_STRING ) self.display_source_combobox.set_model( self.display_source_treestore ) @@ -2341,7 +2332,7 @@ class MonitorWidgets: self.source_list_reset( ) self.display_source_path_label = self.xml_gui.get_object( "display_source_path_label" ) - # display scaling: ToDo enable scaling + # enable display scaling self.display_x_scaling_combobox.set_active( 0 ) self.display_y_scaling_combobox.set_active( 0 ) self.display_x_scaling_combobox.set_sensitive( True ) @@ -2498,7 +2489,9 @@ class MonitorWidgets: ( displayed_object is object_to_display or displayed_object.__class__ is object_to_display.__class__): # oh, another category + self.update_counter_lock.acquire() self.update_counter += 1 + self.update_counter_lock.release() gobject.idle_add( self.update_display_idle_event, self.displayed_data[ 0 ][ : ], priority=gobject.PRIORITY_DEFAULT_IDLE ) else: @@ -2942,19 +2935,6 @@ class MonitorWidgets: yminpos = in_result.get_yminpos() 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 ) - # Initial rescaling needed? if self.__rescale: x_scale = self.display_x_scaling_combobox.get_active_text( )