11from PySide2 import QtWidgets
22from PySide2 .QtCore import Qt , Slot
33
4- from activity_browser import log , signals
4+ from activity_browser import log , signals , actions
55from activity_browser .mod .bw2data import calculation_setups
66
77from ..icons import qicons
@@ -174,6 +174,8 @@ def __init__(self, parent=None):
174174 "Hold CTRL and click to select multiple rows to open or delete them."
175175 )
176176
177+ self .open_method_action = actions .MethodOpen .get_QAction (self .selected_methods )
178+
177179 def to_python (self ):
178180 return self .model .methods
179181
@@ -195,11 +197,14 @@ def contextMenuEvent(self, event) -> None:
195197 if self .indexAt (event .pos ()).row () == - 1 :
196198 return
197199 menu = QtWidgets .QMenu ()
200+
201+ menu .addAction (self .open_method_action )
198202 menu .addAction (
199203 qicons .delete ,
200- "Remove row " ,
204+ "Remove rows " ,
201205 lambda : self .model .delete_rows (self .selectedIndexes ()),
202206 )
207+
203208 menu .exec_ (event .globalPos ())
204209
205210 def dragEnterEvent (self , event ):
@@ -225,6 +230,9 @@ def dropEvent(self, event):
225230 ):
226231 self .model .relocateRow (from_index , to_index )
227232
233+ def selected_methods (self ):
234+ return [self .model .get_method (p ) for p in self .selectedIndexes () if p .column () == 0 ]
235+
228236
229237class ScenarioImportTable (ABDataFrameView ):
230238 """Self-contained widget that shows the scenario headers for a given
0 commit comments