mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Cleanup jobs widget
This commit is contained in:
parent
86fca5e201
commit
00f8528d1b
@ -70,6 +70,7 @@ class JobManager(QAbstractTableModel, AdaptSQP): # {{{
|
|||||||
job_done = pyqtSignal(int)
|
job_done = pyqtSignal(int)
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
self.header_titles = _('Job'), _('Status'), _('Progress'), _('Running time'), _('Start time'),
|
||||||
QAbstractTableModel.__init__(self)
|
QAbstractTableModel.__init__(self)
|
||||||
SearchQueryParser.__init__(self, ['all'])
|
SearchQueryParser.__init__(self, ['all'])
|
||||||
|
|
||||||
@ -96,18 +97,13 @@ class JobManager(QAbstractTableModel, AdaptSQP): # {{{
|
|||||||
return len(self.jobs)
|
return len(self.jobs)
|
||||||
|
|
||||||
def headerData(self, section, orientation, role):
|
def headerData(self, section, orientation, role):
|
||||||
if role != Qt.ItemDataRole.DisplayRole:
|
if role == Qt.ItemDataRole.DisplayRole:
|
||||||
return None
|
if orientation == Qt.Orientation.Horizontal:
|
||||||
if orientation == Qt.Orientation.Horizontal:
|
try:
|
||||||
return ({
|
return self.header_titles[section]
|
||||||
0: _('Job'),
|
except Exception:
|
||||||
1: _('Status'),
|
pass
|
||||||
2: _('Progress'),
|
return str(section + 1)
|
||||||
3: _('Running time'),
|
|
||||||
4: _('Start time'),
|
|
||||||
}.get(section, ''))
|
|
||||||
else:
|
|
||||||
return (section+1)
|
|
||||||
|
|
||||||
def show_tooltip(self, arg):
|
def show_tooltip(self, arg):
|
||||||
widget, pos = arg
|
widget, pos = arg
|
||||||
@ -661,8 +657,9 @@ class JobsDialog(QDialog, Ui_JobsDialog):
|
|||||||
state = gprefs.get('jobs view column layout3', None)
|
state = gprefs.get('jobs view column layout3', None)
|
||||||
if state is not None:
|
if state is not None:
|
||||||
self.jobs_view.horizontalHeader().restoreState(QByteArray(state))
|
self.jobs_view.horizontalHeader().restoreState(QByteArray(state))
|
||||||
except:
|
except Exception:
|
||||||
pass
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
idx = self.jobs_view.model().index(0, 0)
|
idx = self.jobs_view.model().index(0, 0)
|
||||||
if idx.isValid():
|
if idx.isValid():
|
||||||
sm = self.jobs_view.selectionModel()
|
sm = self.jobs_view.selectionModel()
|
||||||
@ -670,12 +667,14 @@ class JobsDialog(QDialog, Ui_JobsDialog):
|
|||||||
|
|
||||||
def save_state(self):
|
def save_state(self):
|
||||||
try:
|
try:
|
||||||
state = bytearray(self.jobs_view.horizontalHeader().saveState())
|
with gprefs:
|
||||||
gprefs['jobs view column layout3'] = state
|
state = bytearray(self.jobs_view.horizontalHeader().saveState())
|
||||||
geom = bytearray(self.saveGeometry())
|
gprefs['jobs view column layout3'] = state
|
||||||
gprefs['jobs_dialog_geometry'] = geom
|
geom = bytearray(self.saveGeometry())
|
||||||
except:
|
gprefs['jobs_dialog_geometry'] = geom
|
||||||
pass
|
except Exception:
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
def show_job_details(self, index):
|
def show_job_details(self, index):
|
||||||
index = self.proxy_model.mapToSource(index)
|
index = self.proxy_model.mapToSource(index)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user