@@ -318,12 +318,19 @@ def __init__(self, tk_parent, buttons):
318318 self .frame .grid (sticky = tk .NSEW )
319319
320320
321+ def runwindow_subprocess_target (config ):
322+ logger .debug ("Subprocess started" )
323+ graph = config_to_graph (config )
324+ graph .run ()
325+ logger .debug ("Subprocess finished" )
326+
327+
321328class RunWindow :
322329 """Opens a separate window to run the pipeline in. The actual pipeline is then run
323330 in a separate process as well, so that it can be stopped."""
324331
325332 def __init__ (self , graph : PipelineGraph ):
326- self . config = graph_to_config ( graph )
333+ logger . debug ( "Running in a separate process" )
327334
328335 self .toplevel = tk .Toplevel ()
329336 self .toplevel .columnconfigure (0 , weight = 1 )
@@ -337,16 +344,12 @@ def __init__(self, graph: PipelineGraph):
337344 self .button = tk .Button (self .toplevel , text = "Stop" , command = self .on_button )
338345 self .button .grid (row = 2 , column = 0 , sticky = tk .EW )
339346
340- self .process = multiprocessing .Process (target = self .subproc )
347+ config = graph_to_config (graph )
348+ self .process = multiprocessing .Process (target = runwindow_subprocess_target , args = [ config ])
341349 self .process .start ()
342350
343351 self .poll ()
344352
345- def subproc (self ):
346- self .config .write (sys .stdout )
347- graph = config_to_graph (self .config )
348- graph .run ()
349-
350353 def poll (self ):
351354 if self .process :
352355 if self .process .is_alive ():
0 commit comments