Comic view drag and drop
Menu icons Polish for docks
This commit is contained in:
5
TODO
5
TODO
@@ -61,9 +61,8 @@ TODO
|
||||
✓ Spacebar should not cut off lines at the top
|
||||
✓ Track open bookmark windows so they can be closed quickly at exit
|
||||
Annotations
|
||||
Text
|
||||
Overlapping - Will involve passing current charformat
|
||||
Annotation preview upon application
|
||||
✓ Text
|
||||
Annotation preview in listView
|
||||
Image
|
||||
Adjust key navigation according to viewport dimensions
|
||||
Search document using QTextCursor
|
||||
|
@@ -63,13 +63,10 @@ class PliantQGraphicsView(QtWidgets.QGraphicsView):
|
||||
self.common_functions = PliantWidgetsCommonFunctions(
|
||||
self, self.main_window)
|
||||
|
||||
# TODO
|
||||
# Image panning with mouse
|
||||
self.ignore_wheel_event = False
|
||||
self.ignore_wheel_event_number = 0
|
||||
self.setMouseTracking(True)
|
||||
self.setDragMode(QtWidgets.QGraphicsView.ScrollHandDrag)
|
||||
self.viewport().setCursor(QtCore.Qt.ArrowCursor)
|
||||
|
||||
self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
|
||||
self.customContextMenuRequested.connect(
|
||||
@@ -225,9 +222,13 @@ class PliantQGraphicsView(QtWidgets.QGraphicsView):
|
||||
self.parent.metadata['position']['is_read'] = False
|
||||
self.common_functions.update_model()
|
||||
|
||||
def mouseMoveEvent(self, *args):
|
||||
self.viewport().setCursor(QtCore.Qt.ArrowCursor)
|
||||
def mouseMoveEvent(self, event):
|
||||
if QtWidgets.QApplication.mouseButtons() == QtCore.Qt.NoButton:
|
||||
self.viewport().setCursor(QtCore.Qt.OpenHandCursor)
|
||||
else:
|
||||
self.viewport().setCursor(QtCore.Qt.ClosedHandCursor)
|
||||
self.parent.mouse_hide_timer.start(3000)
|
||||
QtWidgets.QGraphicsView.mouseMoveEvent(self, event)
|
||||
|
||||
def generate_graphicsview_context_menu(self, position):
|
||||
contextMenu = QtWidgets.QMenu()
|
||||
@@ -468,8 +469,8 @@ class PliantQTextBrowser(QtWidgets.QTextBrowser):
|
||||
|
||||
current_chapter = self.parent.metadata['position']['current_chapter']
|
||||
cursor_at_mouse = self.cursorForPosition(position)
|
||||
annotation_is_present = self.common_functions.check_annotation_position(
|
||||
'text', current_chapter, cursor_at_mouse.position())
|
||||
annotation_is_present = self.common_functions.annotation_specific(
|
||||
'check', 'text', current_chapter, cursor_at_mouse.position())
|
||||
|
||||
contextMenu = QtWidgets.QMenu()
|
||||
|
||||
@@ -558,12 +559,12 @@ class PliantQTextBrowser(QtWidgets.QTextBrowser):
|
||||
f'https://www.youtube.com/results?search_query={selection}')
|
||||
|
||||
if action == editAnnotationNoteAction:
|
||||
self.common_functions.show_annotation_note(
|
||||
'text', current_chapter, cursor_at_mouse.position())
|
||||
self.common_functions.annotation_specific(
|
||||
'note', 'text', current_chapter, cursor_at_mouse.position())
|
||||
|
||||
if action == deleteAnnotationAction:
|
||||
self.common_functions.delete_annotation(
|
||||
'text', current_chapter, cursor_at_mouse.position())
|
||||
self.common_functions.annotation_specific(
|
||||
'delete', 'text', current_chapter, cursor_at_mouse.position())
|
||||
|
||||
if action == bookmarksToggleAction:
|
||||
self.parent.toggle_bookmarks()
|
||||
@@ -675,61 +676,6 @@ class PliantWidgetsCommonFunctions:
|
||||
cursor, cursor_start, cursor_end)
|
||||
self.pw.setTextCursor(new_cursor)
|
||||
|
||||
def check_annotation_position(self, annotation_type, chapter, cursor_position):
|
||||
try:
|
||||
chapter_annotations = self.pw.annotation_dict[chapter]
|
||||
except KeyError:
|
||||
return False
|
||||
|
||||
for i in chapter_annotations:
|
||||
if annotation_type == 'text':
|
||||
cursor_start = i['cursor'][0]
|
||||
cursor_end = i['cursor'][1]
|
||||
|
||||
if cursor_start <= cursor_position <= cursor_end:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def delete_annotation(self, annotation_type, chapter, cursor_position):
|
||||
try:
|
||||
chapter_annotations = self.pw.annotation_dict[chapter]
|
||||
except KeyError:
|
||||
return
|
||||
|
||||
for i in chapter_annotations:
|
||||
if annotation_type == 'text':
|
||||
cursor_start = i['cursor'][0]
|
||||
cursor_end = i['cursor'][1]
|
||||
|
||||
if cursor_start <= cursor_position <= cursor_end:
|
||||
self.pw.annotation_dict[chapter].remove(i)
|
||||
|
||||
current_scroll_position = self.pw.verticalScrollBar().value()
|
||||
self.clear_annotations()
|
||||
self.load_annotations(chapter)
|
||||
self.pw.verticalScrollBar().setValue(current_scroll_position)
|
||||
|
||||
def show_annotation_note(self, annotation_type, chapter, cursor_position):
|
||||
# TODO
|
||||
# Consolidate this and the next 2 functions
|
||||
|
||||
try:
|
||||
chapter_annotations = self.pw.annotation_dict[chapter]
|
||||
except KeyError:
|
||||
return
|
||||
|
||||
for i in chapter_annotations:
|
||||
if annotation_type == 'text':
|
||||
cursor_start = i['cursor'][0]
|
||||
cursor_end = i['cursor'][1]
|
||||
|
||||
if cursor_start <= cursor_position <= cursor_end:
|
||||
note = i['note']
|
||||
self.pw.parent.annotationNoteDock.set_annotation(i)
|
||||
self.pw.parent.annotationNoteEdit.setText(note)
|
||||
self.pw.parent.annotationNoteDock.show()
|
||||
|
||||
def clear_annotations(self):
|
||||
if not self.are_we_doing_images_only:
|
||||
cursor = self.pw.textCursor()
|
||||
@@ -743,6 +689,37 @@ class PliantWidgetsCommonFunctions:
|
||||
cursor.clearSelection()
|
||||
self.pw.setTextCursor(cursor)
|
||||
|
||||
def annotation_specific(self, mode, annotation_type, chapter, cursor_position):
|
||||
try:
|
||||
chapter_annotations = self.pw.annotation_dict[chapter]
|
||||
except KeyError:
|
||||
return False
|
||||
|
||||
for i in chapter_annotations:
|
||||
if annotation_type == 'text':
|
||||
cursor_start = i['cursor'][0]
|
||||
cursor_end = i['cursor'][1]
|
||||
|
||||
if cursor_start <= cursor_position <= cursor_end:
|
||||
if mode == 'check':
|
||||
return True
|
||||
if mode == 'delete':
|
||||
self.pw.annotation_dict[chapter].remove(i)
|
||||
if mode == 'note':
|
||||
note = i['note']
|
||||
self.pw.parent.annotationNoteDock.set_annotation(i)
|
||||
self.pw.parent.annotationNoteEdit.setText(note)
|
||||
self.pw.parent.annotationNoteDock.show()
|
||||
|
||||
# Post iteration
|
||||
if mode == 'check':
|
||||
return False
|
||||
if mode == 'delete':
|
||||
scroll_position = self.pw.verticalScrollBar().value()
|
||||
self.clear_annotations()
|
||||
self.load_annotations(chapter)
|
||||
self.pw.verticalScrollBar().setValue(scroll_position)
|
||||
|
||||
def update_model(self):
|
||||
# We're updating the underlying model to have real-time
|
||||
# updates on the read status
|
||||
|
8
lector/resources/raw/DarkIcons/about.svg
Normal file
8
lector/resources/raw/DarkIcons/about.svg
Normal file
@@ -0,0 +1,8 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
||||
<defs>
|
||||
<style id="current-color-scheme" type="text/css">
|
||||
.ColorScheme-Text { color:#5c616c; } .ColorScheme-Highlight { color:#5294e2; }
|
||||
</style>
|
||||
</defs>
|
||||
<path style="fill:currentColor" class="ColorScheme-Text" d="M 8 1.0039062 C 4.134 1.0039062 1 4.1380063 1 8.0039062 C 1 11.869906 4.134 15.003906 8 15.003906 C 11.866 15.003906 15 11.869906 15 8.0039062 C 15 4.1380063 11.866 1.0039062 8 1.0039062 z M 8 3.7539062 C 8.69036 3.7539062 9.25 4.3135463 9.25 5.0039062 C 9.25 5.6942662 8.69036 6.2539062 8 6.2539062 C 7.30964 6.2539062 6.75 5.6942662 6.75 5.0039062 C 6.75 4.3135463 7.30964 3.7539062 8 3.7539062 z M 7 7.0039062 L 9 7.0039062 L 9 12.003906 L 7 12.003906 L 7 7.0039062 z" transform="translate(4 4)"/>
|
||||
</svg>
|
After Width: | Height: | Size: 815 B |
8
lector/resources/raw/DarkIcons/switches.svg
Normal file
8
lector/resources/raw/DarkIcons/switches.svg
Normal file
@@ -0,0 +1,8 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
||||
<defs>
|
||||
<style id="current-color-scheme" type="text/css">
|
||||
.ColorScheme-Text { color:#5c616c; } .ColorScheme-Highlight { color:#5294e2; }
|
||||
</style>
|
||||
</defs>
|
||||
<path style="fill:currentColor" class="ColorScheme-Text" d="M 2 0 C 0.892 0 0 0.892 0 2 L 0 14 C 0 15.108 0.892 16 2 16 L 14 16 C 15.108 16 16 15.108 16 14 L 16 2 C 16 0.892 15.108 0 14 0 L 2 0 z M 3.7148438 2 L 12.285156 2 C 13.235156 2 14 2.7651437 14 3.7148438 L 14 12.285156 C 14 13.235156 13.235156 14 12.285156 14 L 3.7148438 14 C 2.7651438 14 2 13.235156 2 12.285156 L 2 3.7148438 C 2 2.7651438 2.7651437 2 3.7148438 2 z M 6.7402344 3 L 6.6289062 4.3164062 A 3.964 3.9286 0 0 0 5.4707031 4.9804688 L 4.2617188 4.4179688 L 3.0019531 6.5820312 L 4.0976562 7.3378906 A 3.964 3.9286 0 0 0 4.0371094 8 A 3.964 3.9286 0 0 0 4.0957031 8.6660156 L 3.0019531 9.4179688 L 4.2617188 11.582031 L 5.4667969 11.019531 A 3.964 3.9286 0 0 0 6.6289062 11.679688 L 6.7402344 13 L 9.2617188 13 L 9.3730469 11.683594 A 3.964 3.9286 0 0 0 10.53125 11.019531 L 11.740234 11.582031 L 13.001953 9.4179688 L 11.904297 8.6621094 A 3.964 3.9286 0 0 0 11.964844 8 A 3.964 3.9286 0 0 0 11.908203 7.3339844 L 13.001953 6.5820312 L 11.740234 4.4179688 L 10.535156 4.9804688 A 3.964 3.9286 0 0 0 9.3730469 4.3203125 L 9.2617188 3 L 6.7402344 3 z M 8.0019531 6.5722656 A 1.4414 1.4286 0 0 1 9.4433594 8 A 1.4414 1.4286 0 0 1 8.0019531 9.4277344 A 1.4414 1.4286 0 0 1 6.5605469 8 A 1.4414 1.4286 0 0 1 8.0019531 6.5722656 z" transform="translate(4 4)"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.5 KiB |
8
lector/resources/raw/LightIcons/about.svg
Normal file
8
lector/resources/raw/LightIcons/about.svg
Normal file
@@ -0,0 +1,8 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
||||
<defs>
|
||||
<style id="current-color-scheme" type="text/css">
|
||||
.ColorScheme-Text { color:#d3dae3; } .ColorScheme-Highlight { color:#5294e2; }
|
||||
</style>
|
||||
</defs>
|
||||
<path style="fill:currentColor" class="ColorScheme-Text" d="M 8 1.0039062 C 4.134 1.0039062 1 4.1380063 1 8.0039062 C 1 11.869906 4.134 15.003906 8 15.003906 C 11.866 15.003906 15 11.869906 15 8.0039062 C 15 4.1380063 11.866 1.0039062 8 1.0039062 z M 8 3.7539062 C 8.69036 3.7539062 9.25 4.3135463 9.25 5.0039062 C 9.25 5.6942662 8.69036 6.2539062 8 6.2539062 C 7.30964 6.2539062 6.75 5.6942662 6.75 5.0039062 C 6.75 4.3135463 7.30964 3.7539062 8 3.7539062 z M 7 7.0039062 L 9 7.0039062 L 9 12.003906 L 7 12.003906 L 7 7.0039062 z" transform="translate(4 4)"/>
|
||||
</svg>
|
After Width: | Height: | Size: 815 B |
8
lector/resources/raw/LightIcons/switches.svg
Normal file
8
lector/resources/raw/LightIcons/switches.svg
Normal file
@@ -0,0 +1,8 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
||||
<defs>
|
||||
<style id="current-color-scheme" type="text/css">
|
||||
.ColorScheme-Text { color:#d3dae3; } .ColorScheme-Highlight { color:#5294e2; }
|
||||
</style>
|
||||
</defs>
|
||||
<path style="fill:currentColor" class="ColorScheme-Text" d="M 2 0 C 0.892 0 0 0.892 0 2 L 0 14 C 0 15.108 0.892 16 2 16 L 14 16 C 15.108 16 16 15.108 16 14 L 16 2 C 16 0.892 15.108 0 14 0 L 2 0 z M 3.7148438 2 L 12.285156 2 C 13.235156 2 14 2.7651437 14 3.7148438 L 14 12.285156 C 14 13.235156 13.235156 14 12.285156 14 L 3.7148438 14 C 2.7651438 14 2 13.235156 2 12.285156 L 2 3.7148438 C 2 2.7651438 2.7651437 2 3.7148438 2 z M 6.7402344 3 L 6.6289062 4.3164062 A 3.964 3.9286 0 0 0 5.4707031 4.9804688 L 4.2617188 4.4179688 L 3.0019531 6.5820312 L 4.0976562 7.3378906 A 3.964 3.9286 0 0 0 4.0371094 8 A 3.964 3.9286 0 0 0 4.0957031 8.6660156 L 3.0019531 9.4179688 L 4.2617188 11.582031 L 5.4667969 11.019531 A 3.964 3.9286 0 0 0 6.6289062 11.679688 L 6.7402344 13 L 9.2617188 13 L 9.3730469 11.683594 A 3.964 3.9286 0 0 0 10.53125 11.019531 L 11.740234 11.582031 L 13.001953 9.4179688 L 11.904297 8.6621094 A 3.964 3.9286 0 0 0 11.964844 8 A 3.964 3.9286 0 0 0 11.908203 7.3339844 L 13.001953 6.5820312 L 11.740234 4.4179688 L 10.535156 4.9804688 A 3.964 3.9286 0 0 0 9.3730469 4.3203125 L 9.2617188 3 L 6.7402344 3 z M 8.0019531 6.5722656 A 1.4414 1.4286 0 0 1 9.4433594 8 A 1.4414 1.4286 0 0 1 8.0019531 9.4277344 A 1.4414 1.4286 0 0 1 6.5605469 8 A 1.4414 1.4286 0 0 1 8.0019531 6.5722656 z" transform="translate(4 4)"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.5 KiB |
@@ -1,5 +1,9 @@
|
||||
<RCC>
|
||||
<qresource prefix="images">
|
||||
<file>DarkIcons/about.svg</file>
|
||||
<file>DarkIcons/switches.svg</file>
|
||||
<file>LightIcons/about.svg</file>
|
||||
<file>LightIcons/switches.svg</file>
|
||||
<file>LightIcons/annotate.svg</file>
|
||||
<file>DarkIcons/annotate.svg</file>
|
||||
<file>Google.png</file>
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -118,9 +118,18 @@ class SettingsUI(QtWidgets.QDialog, settingswindow.Ui_Dialog):
|
||||
list_options = [
|
||||
library_string, switches_string, annotations_string, about_string]
|
||||
|
||||
for i in list_options:
|
||||
icon_dict = {
|
||||
0: 'view-readermode',
|
||||
1: 'switches',
|
||||
2: 'annotate',
|
||||
3: 'about'}
|
||||
|
||||
for count, i in enumerate(list_options):
|
||||
item = QtGui.QStandardItem()
|
||||
item.setText(i)
|
||||
this_icon = icon_dict[count]
|
||||
item.setIcon(
|
||||
self.main_window.QImageFactory.get_image(this_icon))
|
||||
self.listModel.appendRow(item)
|
||||
self.listView.setModel(self.listModel)
|
||||
self.listView.clicked.connect(self.page_switch)
|
||||
|
@@ -145,7 +145,7 @@ class Tab(QtWidgets.QWidget):
|
||||
self.annotationNoteDock.hide()
|
||||
|
||||
self.annotationNoteEdit = QtWidgets.QTextEdit(self.annotationDock)
|
||||
self.annotationNoteEdit.setMaximumSize(QtCore.QSize(200, 200))
|
||||
self.annotationNoteEdit.setMaximumSize(QtCore.QSize(250, 250))
|
||||
self.annotationNoteEdit.setFocusPolicy(QtCore.Qt.StrongFocus)
|
||||
self.annotationNoteDock.setWidget(self.annotationNoteEdit)
|
||||
|
||||
@@ -593,17 +593,18 @@ class PliantDockWidget(QtWidgets.QDockWidget):
|
||||
self.main_window.bookToolBar.bookmarkButton.setChecked(True)
|
||||
|
||||
elif self.intended_for == 'annotations':
|
||||
dock_width = desktop_size.width() // 10
|
||||
dock_width = desktop_size.width() // 5.5
|
||||
dock_x = viewport_topLeft.x()
|
||||
self.main_window.bookToolBar.annotationButton.setChecked(True)
|
||||
|
||||
elif self.intended_for == 'notes':
|
||||
dock_width = dock_height = desktop_size.width() // 6
|
||||
dock_width = dock_height = desktop_size.width() // 5.5
|
||||
dock_x = QtGui.QCursor.pos().x()
|
||||
dock_y = QtGui.QCursor.pos().y()
|
||||
|
||||
self.main_window.active_bookmark_docks.append(self)
|
||||
self.setGeometry(dock_x, dock_y, dock_width, dock_height)
|
||||
self.setFocus() # TODO This doesn't work
|
||||
|
||||
def hideEvent(self, event=None):
|
||||
if self.intended_for == 'bookmarks':
|
||||
|
Reference in New Issue
Block a user