DAMARIS can now run scripts immediatly upon startup.

This is the first step towards a simple queing implementation.
This commit is contained in:
Markus Rosenstihl
2018-03-16 17:03:44 +01:00
parent 328d50fc43
commit 8991e61600
5 changed files with 55 additions and 38 deletions

View File

@@ -174,7 +174,7 @@ class Experiment:
:param float time: seconds to wait
:param int ttls: lines to set (integer)
:param bool gating: reduce time by gating, i.e. wat in front of rf_pulse
:param bool gating: reduce time by gating, i.e. wait in front of rf_pulse
:return:
"""
if gating:

View File

@@ -52,11 +52,9 @@ matplotlib.rcParams[ "axes.formatter.limits" ] = "-3,3"
if matplotlib.rcParams[ "backend" ] == "GTK":
from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
max_points_to_display = 0 # no limit
elif matplotlib.rcParams[ "backend" ] == "GTKCairo":
from matplotlib.backends.backend_gtkcairo import FigureCanvasGTKCairo as FigureCanvas
max_points_to_display = 1 << 14 # cairo cannot render longer paths than 18???
else:
# default
@@ -130,7 +128,7 @@ class DamarisGUI:
Stop_State = 3
Quit_State = 4
def __init__( self, exp_script_filename=None, res_script_filename=None ):
def __init__( self, exp_script_filename=None, res_script_filename=None, start_immediatly=False ):
# state: edit, run, stop, quit
# state transitions:
# edit -> run|quit
@@ -172,6 +170,15 @@ class DamarisGUI:
res_script = self.sw.load_file_as_unicode( res_script_filename )
self.sw.set_scripts( exp_script, res_script )
if start_immediatly:
if exp_script and res_script:
self.start_immediatly = start_immediatly
else:
raise ("RuntimeError", "experiment and result scripts not given,\
aborting immediate start of experiment")
else:
self.start_immediatly = False
self.statusbar_init( )
self.main_window.show_all( )
@@ -226,16 +233,16 @@ class DamarisGUI:
# prolong lifetime of clipboard till the very end (avoid error message)
self.main_clipboard = self.sw.main_clipboard
gtk.gdk.threads_enter( )
if self.start_immediatly:
self.toolbar_run_button.emit("clicked")
gtk.main( )
gtk.gdk.threads_leave( )
self.si = None
self.sw = None
self.config = None
self.xml_gui = None
# event handling: the real acitons in gui programming
# first global events
def quit_event( self, widget, data=None ):