File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -189,14 +189,25 @@ def set_labels(self, lst):
189189
190190 def get_action_state (self , action_name : str ):
191191 action = self .view_action_group .lookup_action (action_name )
192+ if not action :
193+ log .error (f'No action { action_name !r} found' )
194+ return
192195 return action .get_state ().unpack ()
193196
194197 def set_action_state (self , action_name : str , state ):
195198 # TODO: Try to do GLib.Variant things here instead of in callers
196- self .view_action_group .lookup_action (action_name ).set_state (state )
199+ action = self .view_action_group .lookup_action (action_name )
200+ if not action :
201+ log .error (f'No action { action_name !r} found' )
202+ return
203+ action .set_state (state )
197204
198- def set_action_enabled (self , action , enabled ):
199- self .view_action_group .lookup_action (action ).set_enabled (enabled )
205+ def set_action_enabled (self , action_name , enabled ):
206+ action = self .view_action_group .lookup_action (action_name )
207+ if not action :
208+ log .error (f'No action { action_name !r} found' )
209+ return
210+ action .set_enabled (enabled )
200211
201212 def on_container_switch_in_event (self , uimanager , window ):
202213 """Called when the container app switches to this tab.
You can’t perform that action at this time.
0 commit comments