mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Implement bug #3101: GUI, Stop Job Confirmation dialog.
This commit is contained in:
parent
36768f6962
commit
232ad55ff0
@ -21,10 +21,10 @@ class Dialog(QDialog, Ui_Dialog):
|
||||
self.again.stateChanged.connect(self.toggle)
|
||||
self.buttonBox.setFocus(Qt.OtherFocusReason)
|
||||
|
||||
|
||||
def toggle(self, *args):
|
||||
dynamic[_config_name(self.name)] = self.again.isChecked()
|
||||
|
||||
|
||||
def confirm(msg, name, parent=None, pixmap='dialog_warning.png'):
|
||||
if not dynamic.get(_config_name(name), True):
|
||||
return True
|
||||
|
@ -14,7 +14,7 @@
|
||||
<string>Active Jobs</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../../../../resources/images.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/images/jobs.png</normaloff>:/images/jobs.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
@ -44,16 +44,16 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="kill_button">
|
||||
<widget class="QPushButton" name="details_button">
|
||||
<property name="text">
|
||||
<string>&Stop selected job</string>
|
||||
<string>Show job &details</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="details_button">
|
||||
<widget class="QPushButton" name="kill_button">
|
||||
<property name="text">
|
||||
<string>Show job &details</string>
|
||||
<string>&Stop selected job</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -19,7 +19,7 @@ from PyQt4.Qt import QAbstractTableModel, QVariant, QModelIndex, Qt, \
|
||||
|
||||
from calibre.utils.ipc.server import Server
|
||||
from calibre.utils.ipc.job import ParallelJob
|
||||
from calibre.gui2 import Dispatcher, error_dialog, NONE, config, gprefs
|
||||
from calibre.gui2 import Dispatcher, error_dialog, question_dialog, NONE, config, gprefs
|
||||
from calibre.gui2.device import DeviceJob
|
||||
from calibre.gui2.dialogs.jobs_ui import Ui_JobsDialog
|
||||
from calibre import __appname__
|
||||
@ -380,8 +380,8 @@ class JobsDialog(QDialog, Ui_JobsDialog):
|
||||
self.model = model
|
||||
self.setWindowModality(Qt.NonModal)
|
||||
self.setWindowTitle(__appname__ + _(' - Jobs'))
|
||||
self.kill_button.clicked.connect(self.kill_job)
|
||||
self.details_button.clicked.connect(self.show_details)
|
||||
self.kill_button.clicked.connect(self.kill_job)
|
||||
self.stop_all_jobs_button.clicked.connect(self.kill_all_jobs)
|
||||
self.pb_delegate = ProgressBarDelegate(self)
|
||||
self.jobs_view.setItemDelegateForColumn(2, self.pb_delegate)
|
||||
@ -415,19 +415,21 @@ class JobsDialog(QDialog, Ui_JobsDialog):
|
||||
d.exec_()
|
||||
d.timer.stop()
|
||||
|
||||
def kill_job(self, *args):
|
||||
for index in self.jobs_view.selectedIndexes():
|
||||
row = index.row()
|
||||
self.model.kill_job(row, self)
|
||||
return
|
||||
|
||||
def show_details(self, *args):
|
||||
for index in self.jobs_view.selectedIndexes():
|
||||
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.selectedIndexes():
|
||||
row = index.row()
|
||||
self.model.kill_job(row, self)
|
||||
return
|
||||
|
||||
def kill_all_jobs(self, *args):
|
||||
self.model.kill_all_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):
|
||||
self.save_state()
|
||||
|
Loading…
x
Reference in New Issue
Block a user