@@ -229,20 +229,32 @@ def create_gantt_fig(trace_filename, svg_filename, settings=None):
229229 print (f"Warning: actor { act } not found (missing scenario specification s@A?)." )
230230 acts_list .append (None )
231231 else :
232- acts_list = [actors [row ]]
232+ if not row in actors :
233+ print (f"Warning: actor { row } not found." )
234+ acts_list = [None ]
235+ else :
236+ acts_list = [actors [row ]]
233237 gantt_actors .append ((row , acts_list ))
234238 else :
235239 # make a default structure
236240 # gantt_actors: list of tuples with name, list of Actors
237- #TODO: group same actor in different scenarios together
238241 c_idx = 0
239242 sorted_actors = sorted (actors .items (), key = lambda a : a [1 ].min_firing_time ())
243+ grouped_actors = {}
240244 for act_name , act in sorted_actors :
241245 parts = act_name .split (SCENARIO_SEPARATOR )
242246 act_name = parts [len (parts )- 1 ]
243- gantt_actors .append ((act_name , [act ]))
247+ if act_name in grouped_actors :
248+ g_idx = grouped_actors [act_name ]
249+ gantt_actors [g_idx ][1 ].append (act )
250+ else :
251+ grouped_actors [act_name ] = len (gantt_actors )
252+ gantt_actors .append ((act_name , [act ]))
253+ if settings .row_order () == "by-actor-name" :
254+ gantt_actors = sorted (gantt_actors , key = lambda a : a [0 ])
244255 c_idx = (c_idx + 1 ) % len (COLOR_PALETTE_FILLS )
245256
257+ # gantt_actors: list of tuples with name, list of Actors
246258 save_gantt_svg (gantt_actors , arrivals , outputs , svg_filename , settings = settings )
247259 convert_svg_to_pdf (svg_filename )
248260
0 commit comments