@@ -95,6 +95,7 @@ class FormActions(object):
95
95
DETAIL_COL = 3
96
96
CAN_EDIT_DETAIL_COL = 4 # actionutils.CANNOT_EDIT_DETAIL, actionutils.CAN_EDIT_DETAIL or actionutils.MUST_EDIT_DETAIL
97
97
ACTION_COMMAND_COL = 5
98
+ EDIT_DETAIL_COL = 6
98
99
99
100
def __init__ (self , dbstate , uistate , track , citation ):
100
101
self .dbstate = dbstate
@@ -154,7 +155,7 @@ def _create_dialog(self, title):
154
155
top .vbox .pack_start (box , True , True , 5 )
155
156
156
157
self .model = Gtk .TreeStore (
157
- bool , bool , str , str , int , GObject .TYPE_PYOBJECT )
158
+ bool , bool , str , str , int , GObject .TYPE_PYOBJECT , bool )
158
159
self .tree = Gtk .TreeView (model = self .model )
159
160
renderer_text = Gtk .CellRendererText ()
160
161
column1 = Gtk .TreeViewColumn (_ ("Action" ))
@@ -168,10 +169,20 @@ def _create_dialog(self, title):
168
169
column1 .pack_start (renderer_text , True )
169
170
column1 .add_attribute (renderer_text , 'text' , self .ACTION_COL )
170
171
172
+ render_edit_detail_toggle = Gtk .CellRendererToggle ()
173
+ render_edit_detail_toggle .connect (
174
+ "toggled" , self .on_edit_detail_toggled )
171
175
column2 = Gtk .TreeViewColumn (
176
+ _ ("Edit" ), render_edit_detail_toggle , active = self .EDIT_DETAIL_COL )
177
+ column2 .set_cell_data_func (
178
+ render_edit_detail_toggle , FormActions .detail_data_func )
179
+
180
+ column3 = Gtk .TreeViewColumn (
172
181
_ ("Detail" ), renderer_text , text = self .DETAIL_COL )
182
+
173
183
self .tree .append_column (column1 )
174
184
self .tree .append_column (column2 )
185
+ self .tree .append_column (column3 )
175
186
176
187
self .tree .get_selection ().set_mode (Gtk .SelectionMode .MULTIPLE )
177
188
@@ -210,6 +221,18 @@ def on_action_toggled(self, widget, path):
210
221
self .model [parent ][self .RUN_INCONSISTENT_COL ] = not consistent
211
222
self .model [parent ][self .RUN_ACTION_COL ] = consistent and value
212
223
224
+ @staticmethod
225
+ def detail_data_func (col , cell , model , iter , user_data ):
226
+ can_edit_detail = model .get_value (
227
+ iter , FormActions .CAN_EDIT_DETAIL_COL )
228
+ cell .set_property ("visible" , can_edit_detail !=
229
+ actionutils .CANNOT_EDIT_DETAIL )
230
+ cell .set_property ("activatable" , (can_edit_detail != actionutils .MUST_EDIT_DETAIL ) and (
231
+ model .get_value (iter , FormActions .RUN_ACTION_COL )))
232
+
233
+ def on_edit_detail_toggled (self , widget , path ):
234
+ self .model [path ][self .EDIT_DETAIL_COL ] = not self .model [path ][self .EDIT_DETAIL_COL ]
235
+
213
236
@staticmethod
214
237
def all_children_consistent (model , parent , col ):
215
238
consistent = True
@@ -240,7 +263,7 @@ def _populate_model(self):
240
263
for action_detail in actions :
241
264
# add available actions within this category
242
265
self .model .append (
243
- parent , (False , False ) + action_detail )
266
+ parent , (False , False ) + action_detail + ( action_detail [ 2 ] == actionutils . MUST_EDIT_DETAIL ,) )
244
267
245
268
def run (self ):
246
269
"""
0 commit comments