Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion TODO
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ TODO
Signal end of chapter with some text
Graphical themes
Change focus rectangle dimensions
Universal Ctrl + Tab
Universal Ctrl + Tab
Allow tabs to detach and form their own windows
Goodreads API: Ratings, Read, Recommendations
Get ISBN using python-isbnlib
Expand Down
17 changes: 17 additions & 0 deletions lector/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,15 @@ def __init__(self):
self.ksCloseTab.setContext(QtCore.Qt.ApplicationShortcut)
self.ksCloseTab.activated.connect(self.tab_close)

self.ksNextTab = QtWidgets.QShortcut(QtGui.QKeySequence('Ctrl+Tab'), self)
self.ksNextTab.setContext(QtCore.Qt.ApplicationShortcut)
self.ksNextTab.activated.connect(lambda: self.cycle_tabs(1))

self.ksPreviousTab = QtWidgets.QShortcut(
QtGui.QKeySequence('Ctrl+Shift+Tab'), self)
self.ksPreviousTab.setContext(QtCore.Qt.ApplicationShortcut)
self.ksPreviousTab.activated.connect(lambda: self.cycle_tabs(-1))

self.ksDeletePressed = QtWidgets.QShortcut(QtGui.QKeySequence('Delete'), self)
self.ksDeletePressed.setContext(QtCore.Qt.ApplicationShortcut)
self.ksDeletePressed.activated.connect(self.delete_pressed)
Expand Down Expand Up @@ -689,6 +698,14 @@ def tab_disallow_library_movement(self, tab_index):
else:
self.tabWidget.setMovable(True)

def cycle_tabs(self, direction):
tab_count = self.tabWidget.count()
if tab_count < 2:
return

current_tab = self.tabWidget.currentIndex()
self.tabWidget.setCurrentIndex((current_tab + direction) % tab_count)

def set_toc_position(self, event=None):
currentIndex = self.bookToolBar.tocTreeView.currentIndex()
required_position = currentIndex.data(QtCore.Qt.UserRole)
Expand Down