UI cleanup
This commit is contained in:
1
TODO
1
TODO
@@ -71,7 +71,6 @@ TODO
|
||||
✓ Text
|
||||
✓ Disable buttons for annotations, search in images
|
||||
Adjust key navigation according to viewport dimensions
|
||||
Redo context menu order
|
||||
Filetypes:
|
||||
✓ pdf support
|
||||
Parse TOC
|
||||
|
@@ -171,10 +171,10 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
||||
self.libraryToolBar.tableViewButton.trigger()
|
||||
|
||||
# Book toolbar
|
||||
self.bookToolBar.annotationButton.triggered.connect(
|
||||
lambda: self.tabWidget.currentWidget().toggle_side_dock(0))
|
||||
self.bookToolBar.addBookmarkButton.triggered.connect(self.add_bookmark)
|
||||
self.bookToolBar.bookmarkButton.triggered.connect(
|
||||
lambda: self.tabWidget.currentWidget().toggle_side_dock(0))
|
||||
self.bookToolBar.annotationButton.triggered.connect(
|
||||
lambda: self.tabWidget.currentWidget().toggle_side_dock(1))
|
||||
self.bookToolBar.searchButton.triggered.connect(
|
||||
lambda: self.tabWidget.currentWidget().toggle_side_dock(2))
|
||||
@@ -660,11 +660,15 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
||||
|
||||
# Disable irrelevant buttons in image view mode
|
||||
if current_tab.are_we_doing_images_only:
|
||||
self.bookToolBar.searchButton.setEnabled(False)
|
||||
self.bookToolBar.annotationButton.setEnabled(False)
|
||||
self.bookToolBar.searchButton.setVisible(False)
|
||||
self.bookToolBar.annotationButton.setVisible(False)
|
||||
self.bookToolBar.bookSeparator2.setVisible(False)
|
||||
self.bookToolBar.bookSeparator3.setVisible(False)
|
||||
else:
|
||||
self.bookToolBar.searchButton.setEnabled(True)
|
||||
self.bookToolBar.annotationButton.setEnabled(True)
|
||||
self.bookToolBar.searchButton.setVisible(True)
|
||||
self.bookToolBar.annotationButton.setVisible(True)
|
||||
self.bookToolBar.bookSeparator2.setVisible(True)
|
||||
self.bookToolBar.bookSeparator3.setVisible(True)
|
||||
|
||||
current_position = current_metadata['position']
|
||||
current_toc = [i[0] for i in current_metadata['content']]
|
||||
|
@@ -554,6 +554,17 @@ class PliantQTextBrowser(QtWidgets.QTextBrowser):
|
||||
searchAction = searchGoogleAction = bookmarksToggleAction = 'TODO Insert Latin Joke'
|
||||
deleteAnnotationAction = editAnnotationNoteAction = 'Latin quote 2. Electric Boogaloo.'
|
||||
|
||||
if self.parent.is_fullscreen:
|
||||
fsToggleAction = contextMenu.addAction(
|
||||
self.main_window.QImageFactory.get_image('view-fullscreen'),
|
||||
self._translate('PliantQTextBrowser', 'Exit fullscreen'))
|
||||
elif not self.main_window.settings['show_bars']:
|
||||
distraction_free_prompt = self._translate(
|
||||
'PliantQTextBrowser', 'Exit Distraction Free mode')
|
||||
dfToggleAction = contextMenu.addAction(
|
||||
self.main_window.QImageFactory.get_image('visibility'),
|
||||
distraction_free_prompt)
|
||||
|
||||
if selection and selection != '':
|
||||
first_selected_word = selection.split()[0]
|
||||
define_string = self._translate('PliantQTextBrowser', 'Define')
|
||||
@@ -594,22 +605,6 @@ class PliantQTextBrowser(QtWidgets.QTextBrowser):
|
||||
self.main_window.QImageFactory.get_image('remove'),
|
||||
self._translate('PliantQTextBrowser', 'Delete annotation'))
|
||||
|
||||
if self.parent.is_fullscreen:
|
||||
fsToggleAction = contextMenu.addAction(
|
||||
self.main_window.QImageFactory.get_image('view-fullscreen'),
|
||||
self._translate('PliantQTextBrowser', 'Exit fullscreen'))
|
||||
else:
|
||||
if self.main_window.settings['show_bars']:
|
||||
distraction_free_prompt = self._translate(
|
||||
'PliantQTextBrowser', 'Distraction Free mode')
|
||||
else:
|
||||
distraction_free_prompt = self._translate(
|
||||
'PliantQTextBrowser', 'Exit Distraction Free mode')
|
||||
|
||||
dfToggleAction = contextMenu.addAction(
|
||||
self.main_window.QImageFactory.get_image('visibility'),
|
||||
distraction_free_prompt)
|
||||
|
||||
add_bookmark_string = self._translate('PliantQTextBrowser', 'Add Bookmark')
|
||||
addBookMarkAction = contextMenu.addAction(
|
||||
self.main_window.QImageFactory.get_image('bookmark-new'),
|
||||
@@ -654,7 +649,7 @@ class PliantQTextBrowser(QtWidgets.QTextBrowser):
|
||||
'delete', 'text', current_chapter, cursor_at_mouse.position())
|
||||
|
||||
if action == bookmarksToggleAction:
|
||||
self.parent.toggle_side_dock(1)
|
||||
self.parent.toggle_side_dock(0)
|
||||
|
||||
if action == fsToggleAction:
|
||||
self.parent.exit_fullscreen()
|
||||
|
@@ -74,10 +74,10 @@ class BookToolBar(QtWidgets.QToolBar):
|
||||
self.fontButton.setCheckable(True)
|
||||
self.fontButton.triggered.connect(self.toggle_font_settings)
|
||||
self.bookSeparator1 = self.addSeparator()
|
||||
self.addAction(self.annotationButton)
|
||||
self.bookSeparator2 = self.addSeparator()
|
||||
self.addAction(self.addBookmarkButton)
|
||||
self.addAction(self.bookmarkButton)
|
||||
self.bookSeparator2 = self.addSeparator()
|
||||
self.addAction(self.annotationButton)
|
||||
self.bookSeparator3 = self.addSeparator()
|
||||
self.addAction(self.searchButton)
|
||||
self.bookSeparator4 = self.addSeparator()
|
||||
|
@@ -130,17 +130,6 @@ class Tab(QtWidgets.QWidget):
|
||||
self.sideDockTabWidget = QtWidgets.QTabWidget()
|
||||
self.sideDock.setWidget(self.sideDockTabWidget)
|
||||
|
||||
# Annotation list view and model
|
||||
self.annotationListView = QtWidgets.QListView()
|
||||
self.annotationListView.setEditTriggers(QtWidgets.QListView.NoEditTriggers)
|
||||
self.annotationListView.doubleClicked.connect(self.contentView.toggle_annotation_mode)
|
||||
annotations_string = self._translate('Tab', 'Annotations')
|
||||
if not self.are_we_doing_images_only:
|
||||
self.sideDockTabWidget.addTab(self.annotationListView, annotations_string)
|
||||
|
||||
self.annotationModel = QtGui.QStandardItemModel(self)
|
||||
self.generate_annotation_model()
|
||||
|
||||
# Bookmark tree view and model
|
||||
self.bookmarkTreeView = QtWidgets.QTreeView()
|
||||
self.bookmarkTreeView.setHeaderHidden(True)
|
||||
@@ -155,6 +144,17 @@ class Tab(QtWidgets.QWidget):
|
||||
self.bookmarkProxyModel = BookmarkProxyModel(self)
|
||||
self.generate_bookmark_model()
|
||||
|
||||
# Annotation list view and model
|
||||
self.annotationListView = QtWidgets.QListView()
|
||||
self.annotationListView.setEditTriggers(QtWidgets.QListView.NoEditTriggers)
|
||||
self.annotationListView.doubleClicked.connect(self.contentView.toggle_annotation_mode)
|
||||
annotations_string = self._translate('Tab', 'Annotations')
|
||||
if not self.are_we_doing_images_only:
|
||||
self.sideDockTabWidget.addTab(self.annotationListView, annotations_string)
|
||||
|
||||
self.annotationModel = QtGui.QStandardItemModel(self)
|
||||
self.generate_annotation_model()
|
||||
|
||||
# Search view and model
|
||||
self.searchLineEdit = QtWidgets.QLineEdit()
|
||||
self.searchLineEdit.setFocusPolicy(QtCore.Qt.StrongFocus)
|
||||
@@ -393,13 +393,15 @@ class Tab(QtWidgets.QWidget):
|
||||
ksExitFullscreen.setContext(QtCore.Qt.ApplicationShortcut)
|
||||
ksExitFullscreen.activated.connect(self.exit_fullscreen)
|
||||
|
||||
ksToggleAnnotations = QtWidgets.QShortcut(
|
||||
QtGui.QKeySequence('Ctrl+N'), self.contentView)
|
||||
ksToggleAnnotations.activated.connect(lambda: self.toggle_side_dock(0))
|
||||
|
||||
ksToggleBookmarks = QtWidgets.QShortcut(
|
||||
QtGui.QKeySequence('Ctrl+B'), self.contentView)
|
||||
ksToggleBookmarks.activated.connect(lambda: self.toggle_side_dock(1))
|
||||
ksToggleBookmarks.activated.connect(lambda: self.toggle_side_dock(0))
|
||||
|
||||
# Shortcuts not required for comic view functionality
|
||||
if not self.are_we_doing_images_only:
|
||||
ksToggleAnnotations = QtWidgets.QShortcut(
|
||||
QtGui.QKeySequence('Ctrl+N'), self.contentView)
|
||||
ksToggleAnnotations.activated.connect(lambda: self.toggle_side_dock(1))
|
||||
|
||||
ksToggleSearch = QtWidgets.QShortcut(
|
||||
QtGui.QKeySequence('Ctrl+F'), self.contentView)
|
||||
@@ -567,7 +569,7 @@ class Tab(QtWidgets.QWidget):
|
||||
'description': description}
|
||||
|
||||
self.sideDock.setVisible(True)
|
||||
self.sideDockTabWidget.setCurrentIndex(1)
|
||||
self.sideDockTabWidget.setCurrentIndex(0)
|
||||
self.add_bookmark_to_model(
|
||||
description, chapter, cursor_position, identifier, True)
|
||||
|
||||
|
Reference in New Issue
Block a user