Skip to content

Commit 6c6faae

Browse files
committed
Give progress information when running actions
1 parent be6dd06 commit 6c6faae

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Form/formactions.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,22 @@ def run(self):
243243

244244
if response == Gtk.ResponseType.OK:
245245
# run the selected actions
246+
self.uistate.set_busy_cursor(True)
247+
self.uistate.progress.show()
248+
self.uistate.pulse_progressbar(0)
249+
# get the list of actions to be run
250+
# this helps give meaningful progress information (because we know how many actions in total will be run)
251+
actions = []
246252
for action_type_row in self.model:
247253
for action_row in action_type_row.iterchildren():
248254
if action_row.model.get_value(action_row.iter, self.RUN_ACTION_COL):
249-
command = action_row.model.get_value(action_row.iter, self.ACTION_COMMAND_COL)
250-
(command)(self.dbstate, self.uistate, self.track)
255+
actions.append(action_row.model.get_value(action_row.iter, self.ACTION_COMMAND_COL))
256+
# run the actions
257+
for index, action in enumerate(actions):
258+
(action)(self.dbstate, self.uistate, self.track)
259+
self.uistate.pulse_progressbar((index + 1) / len(actions) * 100)
260+
self.uistate.progress.hide()
261+
self.uistate.set_busy_cursor(False)
251262

252263
self.top.destroy()
253264

0 commit comments

Comments
 (0)