diff --git a/src/calibre/gui2/dialogs/jobs.ui b/src/calibre/gui2/dialogs/jobs.ui index 5b311bf056..95d0585cf0 100644 --- a/src/calibre/gui2/dialogs/jobs.ui +++ b/src/calibre/gui2/dialogs/jobs.ui @@ -29,9 +29,6 @@ true - - QAbstractItemView::SingleSelection - QAbstractItemView::SelectRows @@ -46,7 +43,7 @@ - &Stop selected job + &Stop selected jobs diff --git a/src/calibre/gui2/jobs.py b/src/calibre/gui2/jobs.py index d6a3951042..c9277518e2 100644 --- a/src/calibre/gui2/jobs.py +++ b/src/calibre/gui2/jobs.py @@ -268,7 +268,8 @@ class JobManager(QAbstractTableModel): # {{{ # }}} # Jobs UI {{{ -class ProgressBarDelegate(QAbstractItemDelegate): + +class ProgressBarDelegate(QAbstractItemDelegate): # {{{ def sizeHint(self, option, index): return QSize(120, 30) @@ -285,8 +286,9 @@ class ProgressBarDelegate(QAbstractItemDelegate): opts.progress = percent opts.text = QString(_('Unavailable') if percent == 0 else '%d%%'%percent) QApplication.style().drawControl(QStyle.CE_ProgressBar, opts, painter) +# }}} -class DetailView(QDialog, Ui_Dialog): +class DetailView(QDialog, Ui_Dialog): # {{{ def __init__(self, parent, job): QDialog.__init__(self, parent) @@ -319,8 +321,9 @@ class DetailView(QDialog, Ui_Dialog): self.next_pos = f.tell() if more: self.log.appendPlainText(more.decode('utf-8', 'replace')) +# }}} -class JobsButton(QFrame): +class JobsButton(QFrame): # {{{ def __init__(self, horizontal=False, size=48, parent=None): QFrame.__init__(self, parent) @@ -405,6 +408,7 @@ class JobsButton(QFrame): self.stop() QCoreApplication.instance().alert(self, 5000) +# }}} class JobsDialog(QDialog, Ui_JobsDialog): @@ -447,7 +451,6 @@ class JobsDialog(QDialog, Ui_JobsDialog): except: pass - def show_job_details(self, index): row = index.row() job = self.jobs_view.model().row_to_job(row) @@ -456,18 +459,23 @@ class JobsDialog(QDialog, Ui_JobsDialog): d.timer.stop() def show_details(self, *args): - for index in self.jobs_view.selectedIndexes(): + index = self.jobs_view.currentIndex() + if index.isValid(): self.show_job_details(index) - return def kill_job(self, *args): - if question_dialog(self, _('Are you sure?'), _('Do you really want to stop the selected job?')): - for index in self.jobs_view.selectionModel().selectedRows(): - row = index.row() + rows = [index.row() for index in + self.jobs_view.selectionModel().selectedRows()] + if question_dialog(self, _('Are you sure?'), + ngettext('Do you really want to stop the selected job?', + 'Do you really want to stop all the selected jobs?', + len(rows))): + for row in rows: self.model.kill_job(row, self) def kill_all_jobs(self, *args): - if question_dialog(self, _('Are you sure?'), _('Do you really want to stop all non-device jobs?')): + if question_dialog(self, _('Are you sure?'), + _('Do you really want to stop all non-device jobs?')): self.model.kill_all_jobs() def closeEvent(self, e):