* Make it work in bookworm, redid some of the changes from last commit

* Changed default number types to int16 for ADC_Result and float32 for
  Accumulations
This commit is contained in:
Markus Rosenstihl
2026-03-09 10:55:55 +01:00
parent 29f003c99e
commit 28e6c9d1a0
10 changed files with 79 additions and 87 deletions
+16 -21
View File
@@ -24,9 +24,9 @@ gi.require_version('GtkSource', '3.0')
# gui graphics
from gi.repository import GObject as gobject
import sqlite3,uuid
from pkg_resources import parse_version
#gobject.threads_init( )
from gi.repository import Gtk as gtk
gtk_version_missmatch = gtk.check_version( 3, 0, 0 )
@@ -64,10 +64,9 @@ max_points_to_display = 0
import matplotlib.axes
import matplotlib.figure
#for printing issues
#if hasattr( gtk, "PrintOperation" ):
# import matplotlib.backends.backend_cairo
if hasattr( gtk, "PrintOperation" ):
import matplotlib.backends.backend_cairo
print('backend:', matplotlib.get_backend()) # must print GTK3Agg
# import our own stuff
from damaris.gui import ExperimentWriter, ExperimentHandling
from damaris.gui import ResultReader, ResultHandling
@@ -180,7 +179,7 @@ class DamarisGUI:
# my notebook
self.main_notebook = self.xml_gui.get_object( "main_notebook" )
self.log = LogWindow( self.xml_gui, self )
self.log = LogWindow( self.xml_gui , self)
self.sw = ScriptWidgets( self.xml_gui )
@@ -194,7 +193,7 @@ class DamarisGUI:
# lock file to prevent other DAMARIS to start immediatly
self.lockfile = LockFile() # = os.path.expanduser("~/.damaris.lock")
self.id = None
#to stop queued experiments
self.stop_experiment_flag = threading.Event()
@@ -289,7 +288,6 @@ class DamarisGUI:
self.toolbar_pause_button = self.xml_gui.get_object( "toolbar_pause_button" )
# print button
# disabled 2026-02-24
#self.toolbar_print_button = self.xml_gui.get_object( "toolbar_print_button" )
#if not hasattr( gtk, "PrintOperation" ):
# self.toolbar_print_button.set_sensitive( False )
@@ -543,7 +541,7 @@ class DamarisGUI:
for r in still_running:
r.quit_flag.set( )
print("waiting for threads stoping...", end=' ')
still_running = [x for x in [ self.si.exp_handling, self.si.res_handling, self.si.back_driver ] if x is not None and x.is_alive()]
still_running = [x for x in [ self.si.exp_handling, self.si.res_handling, self.si.back_driver ] if x is not None and x.is_alive( )]
for t in still_running:
t.join( )
print("done")
@@ -626,7 +624,7 @@ class DamarisGUI:
r_text = None
b_text = None
if self.si.exp_handling is not None:
if not self.si.exp_handling.is_alive():
if not self.si.exp_handling.is_alive( ):
self.si.exp_handling.join( )
if self.si.exp_handling.raised_exception:
print("experiment script failed at line %d (function %s): %s" % (self.si.exp_handling.location[ 0 ],
@@ -644,7 +642,7 @@ class DamarisGUI:
e_text += experimenttimetext
if self.si.res_handling is not None:
if not self.si.res_handling.is_alive():
if not self.si.res_handling.is_alive( ):
self.si.res_handling.join( )
if self.si.res_handling.raised_exception:
print("result script failed at line %d (function %s): %s" % (self.si.res_handling.location[ 0 ],
@@ -659,7 +657,7 @@ class DamarisGUI:
r_text = "Result Script Running (%d)" % r
if self.si.back_driver is not None:
if not self.si.back_driver.is_alive():
if not self.si.back_driver.is_alive( ):
if self.si.back_driver.raised_exception:
b_text = "Backend Failed"
else:
@@ -673,7 +671,7 @@ class DamarisGUI:
b_text += backendtimetext
if self.dump_thread is not None:
if self.dump_thread.is_alive():
if self.dump_thread.is_alive( ):
sys.stdout.write( "." )
self.dump_dots += 1
if self.dump_dots > 80:
@@ -715,7 +713,7 @@ class DamarisGUI:
return True
else:
if self.save_thread is not None:
if self.save_thread.is_alive():
if self.save_thread.is_alive( ):
sys.stdout.write( "." )
self.dump_dots += 1
if self.dump_dots > 80:
@@ -1088,7 +1086,7 @@ class DamarisGUI:
if requested_doc in self.doc_urls and self.doc_urls[ requested_doc ] is not None:
if self.doc_browser is not None:
if not self.doc_browser.is_alive():
if not self.doc_browser.is_alive( ):
self.doc_browser.join( )
if self.doc_browser.my_webbrowser is not None:
print("new browser tab")
@@ -1151,8 +1149,7 @@ class LogWindow:
self.textview.connect( "key-press-event", self.textview_keypress)
self.textbuffer = self.textview.get_buffer( )
self.logstream = log
print("here i am")
#self.logstream.gui_log = self
self.logstream.gui_log = self
self.last_timetag = None
self( "Started in directory %s\n" % os.getcwd( ) )
@@ -2478,11 +2475,9 @@ class MonitorWidgets:
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)
if parse_version(matplotlib.__version__) >= parse_version("3.6"):
self.matplot_toolbar = matplotlib.backends.backend_gtk3.NavigationToolbar2GTK3( self.matplot_canvas )
else: #
self.matplot_toolbar = matplotlib.backends.backend_gtk3.NavigationToolbar2GTK3( self.matplot_canvas, self.main_window )
# Matplot Toolbar hinzufuegen (Display_Table, 2. Zeile)
self.matplot_toolbar = matplotlib.backends.backend_gtk3.NavigationToolbar2GTK3( self.matplot_canvas,
self.main_window )
self.display_table.attach( self.matplot_toolbar, 0, 1, 1, 2, gtk.AttachOptions.FILL | gtk.AttachOptions.EXPAND, 0, 0, 0 )
self.matplot_toolbar.show( )
+3 -3
View File
@@ -114,7 +114,7 @@ class ResultReader:
self.result_description = {}
self.in_description_section=True
self.in_description_data=()
for an_item in elem.iter():
for an_item in elem:
self.in_description_data = (an_item.get("key"), an_item.get("type"), an_item.text)
# make item contents to dictionary item:
k,t,v=self.in_description_data
@@ -213,7 +213,7 @@ class ResultReader:
self.adc_result_sample_counter>0:
# fill the ADC_Result with collected data
# x data
self.result.x=numpy.arange(self.adc_result_sample_counter, dtype="float64")/\
self.result.x=numpy.arange(self.adc_result_sample_counter, dtype="float32")/\
self.result.get_sampling_rate()
self.result.y = []
nChannels = self.result.get_nChannels()
@@ -293,7 +293,7 @@ class ResultReader:
self.__filetype == ResultReader.ADCDATA_TYPE and \
self.adc_result_sample_counter>0:
# fill the ADC_Result with collected data
self.result.x=numpy.arange(self.adc_result_sample_counter, dtype="float64")/\
self.result.x=numpy.arange(self.adc_result_sample_counter, dtype="float32")/\
self.result.get_sampling_rate()
self.result.y=[]
self.result.index=[]
+4 -2
View File
@@ -644,6 +644,7 @@ Public License instead of this License.
<property name="visible">True</property>
</object>
</child>
<!--
<child>
<object class="GtkToolButton" id="toolbar_print_button">
@@ -654,8 +655,9 @@ Public License instead of this License.
<packing>
<property name="homogeneous">True</property>
</packing>
</child>
-->
</child>
-->
<child>
<object class="GtkSeparatorToolItem" id="toolbutton2">
<property name="visible">True</property>
+3 -3
View File
@@ -70,7 +70,7 @@ class ScriptInterface:
next_dump_time+=dump_interval
if self.exp_handling is not None:
if not self.exp_handling.isAlive():
if not self.exp_handling.is_alive():
self.exp_handling.join()
if self.exp_handling.raised_exception:
print(": experiment script failed at line %d (function %s): %s"%(self.exp_handling.location[0],
@@ -81,7 +81,7 @@ class ScriptInterface:
self.exp_handling = None
if self.res_handling is not None:
if not self.res_handling.isAlive():
if not self.res_handling.is_alive():
self.res_handling.join()
if self.res_handling.raised_exception:
print(": result script failed at line %d (function %s): %s"%(self.res_handling.location[0],
@@ -92,7 +92,7 @@ class ScriptInterface:
self.res_handling = None
if self.back_driver is not None:
if not self.back_driver.isAlive():
if not self.back_driver.is_alive():
print(": backend finished")
self.back_driver=None