mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #6505 (Flesh out window settings and keyboard shortcuts.)
This commit is contained in:
parent
233baa63c6
commit
388d8e34dc
@ -196,6 +196,7 @@ class CoverFlowMixin(object):
|
|||||||
|
|
||||||
def show_cover_browser(self):
|
def show_cover_browser(self):
|
||||||
d = CBDialog(self, self.cover_flow)
|
d = CBDialog(self, self.cover_flow)
|
||||||
|
d.addAction(self.cb_splitter.action_toggle)
|
||||||
self.cover_flow.setVisible(True)
|
self.cover_flow.setVisible(True)
|
||||||
self.cover_flow.setFocus(Qt.OtherFocusReason)
|
self.cover_flow.setFocus(Qt.OtherFocusReason)
|
||||||
d.show()
|
d.show()
|
||||||
|
@ -14,7 +14,8 @@ from Queue import Empty, Queue
|
|||||||
from PyQt4.Qt import QAbstractTableModel, QVariant, QModelIndex, Qt, \
|
from PyQt4.Qt import QAbstractTableModel, QVariant, QModelIndex, Qt, \
|
||||||
QTimer, pyqtSignal, QIcon, QDialog, QAbstractItemDelegate, QApplication, \
|
QTimer, pyqtSignal, QIcon, QDialog, QAbstractItemDelegate, QApplication, \
|
||||||
QSize, QStyleOptionProgressBarV2, QString, QStyle, QToolTip, QFrame, \
|
QSize, QStyleOptionProgressBarV2, QString, QStyle, QToolTip, QFrame, \
|
||||||
QHBoxLayout, QVBoxLayout, QSizePolicy, QLabel, QCoreApplication
|
QHBoxLayout, QVBoxLayout, QSizePolicy, QLabel, QCoreApplication, QAction, \
|
||||||
|
QByteArray
|
||||||
|
|
||||||
from calibre.utils.ipc.server import Server
|
from calibre.utils.ipc.server import Server
|
||||||
from calibre.utils.ipc.job import ParallelJob
|
from calibre.utils.ipc.job import ParallelJob
|
||||||
@ -281,6 +282,7 @@ class JobsButton(QFrame):
|
|||||||
self.pi = ProgressIndicator(self, size)
|
self.pi = ProgressIndicator(self, size)
|
||||||
self._jobs = QLabel('<b>'+_('Jobs:')+' 0')
|
self._jobs = QLabel('<b>'+_('Jobs:')+' 0')
|
||||||
self._jobs.mouseReleaseEvent = self.mouseReleaseEvent
|
self._jobs.mouseReleaseEvent = self.mouseReleaseEvent
|
||||||
|
self.shortcut = _('Shift+Alt+J')
|
||||||
|
|
||||||
if horizontal:
|
if horizontal:
|
||||||
self.setLayout(QHBoxLayout())
|
self.setLayout(QHBoxLayout())
|
||||||
@ -297,15 +299,24 @@ class JobsButton(QFrame):
|
|||||||
self.layout().setMargin(0)
|
self.layout().setMargin(0)
|
||||||
self._jobs.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
|
self._jobs.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
|
||||||
self.setCursor(Qt.PointingHandCursor)
|
self.setCursor(Qt.PointingHandCursor)
|
||||||
self.setToolTip(_('Click to see list of active jobs.'))
|
b = _('Click to see list of jobs')
|
||||||
|
self.setToolTip(b + u' (%s)'%self.shortcut)
|
||||||
|
self.action_toggle = QAction(b, parent)
|
||||||
|
parent.addAction(self.action_toggle)
|
||||||
|
self.action_toggle.setShortcut(self.shortcut)
|
||||||
|
self.action_toggle.triggered.connect(self.toggle)
|
||||||
|
|
||||||
def initialize(self, jobs_dialog, job_manager):
|
def initialize(self, jobs_dialog, job_manager):
|
||||||
self.jobs_dialog = jobs_dialog
|
self.jobs_dialog = jobs_dialog
|
||||||
job_manager.job_added.connect(self.job_added)
|
job_manager.job_added.connect(self.job_added)
|
||||||
job_manager.job_done.connect(self.job_done)
|
job_manager.job_done.connect(self.job_done)
|
||||||
|
self.jobs_dialog.addAction(self.action_toggle)
|
||||||
|
|
||||||
|
|
||||||
def mouseReleaseEvent(self, event):
|
def mouseReleaseEvent(self, event):
|
||||||
|
self.toggle()
|
||||||
|
|
||||||
|
def toggle(self, *args):
|
||||||
if self.jobs_dialog.isVisible():
|
if self.jobs_dialog.isVisible():
|
||||||
self.jobs_dialog.hide()
|
self.jobs_dialog.hide()
|
||||||
else:
|
else:
|
||||||
@ -372,6 +383,10 @@ class JobsDialog(QDialog, Ui_JobsDialog):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
geom = gprefs.get('jobs_dialog_geometry', bytearray(''))
|
||||||
|
self.restoreGeometry(QByteArray(geom))
|
||||||
|
|
||||||
|
|
||||||
def show_job_details(self, index):
|
def show_job_details(self, index):
|
||||||
row = index.row()
|
row = index.row()
|
||||||
job = self.jobs_view.model().row_to_job(row)
|
job = self.jobs_view.model().row_to_job(row)
|
||||||
@ -397,6 +412,8 @@ class JobsDialog(QDialog, Ui_JobsDialog):
|
|||||||
try:
|
try:
|
||||||
state = bytearray(self.jobs_view.horizontalHeader().saveState())
|
state = bytearray(self.jobs_view.horizontalHeader().saveState())
|
||||||
gprefs['jobs view column layout'] = state
|
gprefs['jobs view column layout'] = state
|
||||||
|
geom = bytearray(self.saveGeometry())
|
||||||
|
gprefs['jobs_dialog_geometry'] = geom
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
e.accept()
|
e.accept()
|
||||||
|
@ -132,7 +132,7 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, # {{{
|
|||||||
# Jobs Button {{{
|
# Jobs Button {{{
|
||||||
self.job_manager = JobManager()
|
self.job_manager = JobManager()
|
||||||
self.jobs_dialog = JobsDialog(self, self.job_manager)
|
self.jobs_dialog = JobsDialog(self, self.job_manager)
|
||||||
self.jobs_button = JobsButton(horizontal=True)
|
self.jobs_button = JobsButton(horizontal=True, parent=self)
|
||||||
self.jobs_button.initialize(self.jobs_dialog, self.job_manager)
|
self.jobs_button.initialize(self.jobs_dialog, self.job_manager)
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
@ -871,14 +871,14 @@ class LayoutButton(QToolButton):
|
|||||||
def set_state_to_show(self, *args):
|
def set_state_to_show(self, *args):
|
||||||
self.setChecked(False)
|
self.setChecked(False)
|
||||||
label =_('Show')
|
label =_('Show')
|
||||||
self.setText(label + ' ' + self.label + ' ' + self.shortcut)
|
self.setText(label + ' ' + self.label + u' (%s)'%self.shortcut)
|
||||||
self.setToolTip(self.text())
|
self.setToolTip(self.text())
|
||||||
self.setStatusTip(self.text())
|
self.setStatusTip(self.text())
|
||||||
|
|
||||||
def set_state_to_hide(self, *args):
|
def set_state_to_hide(self, *args):
|
||||||
self.setChecked(True)
|
self.setChecked(True)
|
||||||
label = _('Hide')
|
label = _('Hide')
|
||||||
self.setText(label + ' ' + self.label+ ' ' + self.shortcut)
|
self.setText(label + ' ' + self.label+ u' (%s)'%self.shortcut)
|
||||||
self.setToolTip(self.text())
|
self.setToolTip(self.text())
|
||||||
self.setStatusTip(self.text())
|
self.setStatusTip(self.text())
|
||||||
|
|
||||||
@ -941,7 +941,10 @@ class Splitter(QSplitter):
|
|||||||
@property
|
@property
|
||||||
def is_side_index_hidden(self):
|
def is_side_index_hidden(self):
|
||||||
sizes = list(self.sizes())
|
sizes = list(self.sizes())
|
||||||
return sizes[self.side_index] == 0
|
try:
|
||||||
|
return sizes[self.side_index] == 0
|
||||||
|
except IndexError:
|
||||||
|
return True
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def save_name(self):
|
def save_name(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user