@@ -160,6 +160,25 @@ def got_focus(self, entry, event, row):
160
160
self .selected = self .model .get_iter ((row ,))
161
161
self .indicators [row ].set_active (True )
162
162
163
+ def activate_action (self , widget , row , column , action ):
164
+ pass
165
+
166
+ def populate_popup (self , entry , menu , row , column ):
167
+ if self .actions [column - 1 ]:
168
+ action_id = 0
169
+ for action in self .actions [column - 1 ]:
170
+ action_menuitem = Gtk .MenuItem (label = action .title )
171
+ # add the action if there is no 'enable_if' expression or the result of eval(action.enable_if) is True (or convertible to True)
172
+ if action .enable_if is None or eval (action .enable_if ):
173
+ action_menuitem .connect ('activate' , self .activate_action , row , column , action )
174
+ action_menuitem .show_all ()
175
+ menu .insert (action_menuitem , action_id )
176
+ action_id += 1
177
+ if action_id :
178
+ separator = Gtk .SeparatorMenuItem ()
179
+ separator .show_all ()
180
+ menu .insert (separator , action_id )
181
+
163
182
def changed (self , entry , row , column ):
164
183
set_size (entry )
165
184
self .model .handler_block (self .sig_id )
0 commit comments