Fix fullscreen toggle affecting reading position bug
Bookmark navigation much more reliable Start annotations UI
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1022</width>
|
||||
<height>513</height>
|
||||
<width>1088</width>
|
||||
<height>612</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -88,13 +88,6 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autoTags">
|
||||
<property name="text">
|
||||
<string>Generate tags from files</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
@@ -129,6 +122,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autoTags">
|
||||
<property name="text">
|
||||
<string>Generate tags from files</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -218,6 +218,27 @@ Reopen book to see changes</string>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="annotationsPage">
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="textTab">
|
||||
<attribute name="title">
|
||||
<string>Text</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QWidget" name="imageTab">
|
||||
<attribute name="title">
|
||||
<string>Comic/PDF</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="aboutPage">
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="0" column="0">
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'raw/settings2.ui'
|
||||
# Form implementation generated from reading ui file 'raw/settings.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.10.1
|
||||
#
|
||||
@@ -11,7 +11,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
class Ui_Dialog(object):
|
||||
def setupUi(self, Dialog):
|
||||
Dialog.setObjectName("Dialog")
|
||||
Dialog.resize(1022, 513)
|
||||
Dialog.resize(1088, 612)
|
||||
self.gridLayout = QtWidgets.QGridLayout(Dialog)
|
||||
self.gridLayout.setObjectName("gridLayout")
|
||||
self.listView = QtWidgets.QListView(Dialog)
|
||||
@@ -66,9 +66,6 @@ class Ui_Dialog(object):
|
||||
self.verticalLayout_2.addLayout(self.horizontalLayout_3)
|
||||
self.horizontalLayout_9 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_9.setObjectName("horizontalLayout_9")
|
||||
self.autoTags = QtWidgets.QCheckBox(self.groupBox)
|
||||
self.autoTags.setObjectName("autoTags")
|
||||
self.horizontalLayout_9.addWidget(self.autoTags)
|
||||
self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_7.setObjectName("horizontalLayout_7")
|
||||
self.label = QtWidgets.QLabel(self.groupBox)
|
||||
@@ -81,6 +78,9 @@ class Ui_Dialog(object):
|
||||
self.lightIconsRadio.setObjectName("lightIconsRadio")
|
||||
self.horizontalLayout_7.addWidget(self.lightIconsRadio)
|
||||
self.horizontalLayout_9.addLayout(self.horizontalLayout_7)
|
||||
self.autoTags = QtWidgets.QCheckBox(self.groupBox)
|
||||
self.autoTags.setObjectName("autoTags")
|
||||
self.horizontalLayout_9.addWidget(self.autoTags)
|
||||
self.verticalLayout_2.addLayout(self.horizontalLayout_9)
|
||||
self.gridLayout_4.addLayout(self.verticalLayout_2, 0, 0, 1, 1)
|
||||
self.verticalLayout.addWidget(self.groupBox)
|
||||
@@ -123,6 +123,20 @@ class Ui_Dialog(object):
|
||||
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
self.gridLayout_2.addItem(spacerItem, 1, 0, 1, 1)
|
||||
self.stackedWidget.addWidget(self.switchPage)
|
||||
self.annotationsPage = QtWidgets.QWidget()
|
||||
self.annotationsPage.setObjectName("annotationsPage")
|
||||
self.gridLayout_7 = QtWidgets.QGridLayout(self.annotationsPage)
|
||||
self.gridLayout_7.setObjectName("gridLayout_7")
|
||||
self.tabWidget = QtWidgets.QTabWidget(self.annotationsPage)
|
||||
self.tabWidget.setObjectName("tabWidget")
|
||||
self.textTab = QtWidgets.QWidget()
|
||||
self.textTab.setObjectName("textTab")
|
||||
self.tabWidget.addTab(self.textTab, "")
|
||||
self.imageTab = QtWidgets.QWidget()
|
||||
self.imageTab.setObjectName("imageTab")
|
||||
self.tabWidget.addTab(self.imageTab, "")
|
||||
self.gridLayout_7.addWidget(self.tabWidget, 0, 0, 1, 1)
|
||||
self.stackedWidget.addWidget(self.annotationsPage)
|
||||
self.aboutPage = QtWidgets.QWidget()
|
||||
self.aboutPage.setObjectName("aboutPage")
|
||||
self.gridLayout_6 = QtWidgets.QGridLayout(self.aboutPage)
|
||||
@@ -148,6 +162,7 @@ class Ui_Dialog(object):
|
||||
self.gridLayout.addLayout(self.verticalLayout_4, 0, 1, 1, 1)
|
||||
|
||||
self.retranslateUi(Dialog)
|
||||
self.tabWidget.setCurrentIndex(0)
|
||||
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||
|
||||
def retranslateUi(self, Dialog):
|
||||
@@ -159,13 +174,13 @@ class Ui_Dialog(object):
|
||||
self.coverShadows.setText(_translate("Dialog", "Cover shadows"))
|
||||
self.performCulling.setToolTip(_translate("Dialog", "Enabling reduces startup time and memory usage"))
|
||||
self.performCulling.setText(_translate("Dialog", "Load covers only when needed"))
|
||||
self.autoTags.setText(_translate("Dialog", "Generate tags from files"))
|
||||
self.label.setToolTip(_translate("Dialog", "Restart application to see changes"))
|
||||
self.label.setText(_translate("Dialog", "Icon theme: "))
|
||||
self.darkIconsRadio.setToolTip(_translate("Dialog", "Restart application to see changes"))
|
||||
self.darkIconsRadio.setText(_translate("Dialog", "&Dark"))
|
||||
self.lightIconsRadio.setToolTip(_translate("Dialog", "Restart application to see changes"))
|
||||
self.lightIconsRadio.setText(_translate("Dialog", "L&ight"))
|
||||
self.autoTags.setText(_translate("Dialog", "Generate tags from files"))
|
||||
self.groupBox_2.setTitle(_translate("Dialog", "Reading"))
|
||||
self.hideScrollBars.setToolTip(_translate("Dialog", "Horizontal scrolling with Alt + Scroll\n"
|
||||
"Reopen book to see changes"))
|
||||
@@ -173,6 +188,8 @@ class Ui_Dialog(object):
|
||||
self.cachingEnabled.setToolTip(_translate("Dialog", "Greatly reduces page transition time at the cost of more memory"))
|
||||
self.cachingEnabled.setText(_translate("Dialog", "Cache comic / pdf pages"))
|
||||
self.languageLabel.setText(_translate("Dialog", "Dictionary language:"))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.textTab), _translate("Dialog", "Text"))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.imageTab), _translate("Dialog", "Comic/PDF"))
|
||||
self.okButton.setText(_translate("Dialog", "Scan Library"))
|
||||
self.cancelButton.setText(_translate("Dialog", "Close"))
|
||||
|
||||
|
@@ -104,8 +104,10 @@ class SettingsUI(QtWidgets.QDialog, settingswindow.Ui_Dialog):
|
||||
|
||||
library_string = self._translate('SettingsUI', 'Library')
|
||||
switches_string = self._translate('SettingsUI', 'Switches')
|
||||
annotations_string = self._translate('SettingsUI', 'Annotations')
|
||||
about_string = self._translate('SettingsUI', 'About')
|
||||
list_options = [library_string, switches_string, about_string]
|
||||
list_options = [
|
||||
library_string, switches_string, annotations_string, about_string]
|
||||
|
||||
for i in list_options:
|
||||
item = QtGui.QStandardItem()
|
||||
|
@@ -20,6 +20,8 @@
|
||||
# Reading modes
|
||||
# Double page, Continuous etc
|
||||
# Especially for comics
|
||||
# Remove variables that have anything to do with scroll position
|
||||
|
||||
|
||||
import os
|
||||
import uuid
|
||||
@@ -103,10 +105,10 @@ class Tab(QtWidgets.QWidget):
|
||||
self.contentView.setHtml(chapter_content)
|
||||
self.contentView.setReadOnly(True)
|
||||
|
||||
tempHiddenButton = QtWidgets.QToolButton(self)
|
||||
tempHiddenButton.setVisible(False)
|
||||
tempHiddenButton.clicked.connect(self.set_scroll_value)
|
||||
tempHiddenButton.animateClick(100)
|
||||
self.hiddenButton = QtWidgets.QToolButton(self)
|
||||
self.hiddenButton.setVisible(False)
|
||||
self.hiddenButton.clicked.connect(self.set_scroll_value)
|
||||
self.hiddenButton.animateClick(50)
|
||||
|
||||
# The following are common to both the text browser and
|
||||
# the graphics view
|
||||
@@ -178,11 +180,6 @@ class Tab(QtWidgets.QWidget):
|
||||
pass
|
||||
|
||||
def set_scroll_value(self, switch_widgets=True, search_data=None):
|
||||
# TODO
|
||||
# Bookmark navigation does not work in case 2 entries in the same
|
||||
# chapter are clicked successively
|
||||
# It plain refuses to work other times
|
||||
|
||||
if self.sender().objectName() == 'tabWidget':
|
||||
return
|
||||
|
||||
@@ -190,37 +187,26 @@ class Tab(QtWidgets.QWidget):
|
||||
previous_widget = self.main_window.tabWidget.currentWidget()
|
||||
self.main_window.tabWidget.setCurrentWidget(self)
|
||||
|
||||
scroll_value = self.metadata['position']['scroll_value']
|
||||
if search_data:
|
||||
scroll_value = search_data[0]
|
||||
|
||||
# Scroll a little ahead
|
||||
# This avoids confusion with potentially duplicate phrases
|
||||
# And the found result is at the top of the window
|
||||
scroll_position = scroll_value * self.contentView.verticalScrollBar().maximum()
|
||||
self.contentView.verticalScrollBar().setValue(scroll_position * 1.02)
|
||||
|
||||
try:
|
||||
search_text = self.metadata['position']['last_visible_text']
|
||||
if search_data:
|
||||
search_text = search_data[1]
|
||||
|
||||
if search_text:
|
||||
find_backward = False
|
||||
cursor = self.contentView.textCursor()
|
||||
cursor.movePosition(QtGui.QTextCursor.Start, QtGui.QTextCursor.KeepAnchor)
|
||||
self.contentView.setTextCursor(cursor)
|
||||
|
||||
find_forward = self.contentView.find(search_text)
|
||||
if not find_forward:
|
||||
find_backward = self.contentView.find(
|
||||
search_text, QtGui.QTextDocument.FindBackward)
|
||||
self.contentView.verticalScrollBar().setValue(
|
||||
self.contentView.verticalScrollBar().maximum())
|
||||
|
||||
if find_backward:
|
||||
current_scroll_position = self.contentView.verticalScrollBar().value()
|
||||
new_scroll_position = current_scroll_position * .98
|
||||
self.contentView.verticalScrollBar().setValue(new_scroll_position)
|
||||
# find_forward is a new cursor object that must replace
|
||||
# the existing text cursor
|
||||
find_forward = self.contentView.document().find(search_text)
|
||||
find_forward.clearSelection()
|
||||
self.contentView.setTextCursor(find_forward)
|
||||
self.contentView.ensureCursorVisible()
|
||||
|
||||
text_cursor = self.contentView.textCursor()
|
||||
text_cursor.clearSelection()
|
||||
self.contentView.setTextCursor(text_cursor)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
@@ -289,19 +275,32 @@ class Tab(QtWidgets.QWidget):
|
||||
self.exit_fullscreen()
|
||||
return
|
||||
|
||||
if not self.are_we_doing_images_only:
|
||||
self.contentView.record_scroll_position()
|
||||
|
||||
self.contentView.setWindowFlags(QtCore.Qt.Window)
|
||||
self.contentView.setWindowState(QtCore.Qt.WindowFullScreen)
|
||||
self.contentView.show()
|
||||
self.main_window.hide()
|
||||
|
||||
if not self.are_we_doing_images_only:
|
||||
self.hiddenButton.animateClick(100)
|
||||
|
||||
self.is_fullscreen = True
|
||||
|
||||
def exit_fullscreen(self):
|
||||
if not self.are_we_doing_images_only:
|
||||
self.contentView.record_scroll_position()
|
||||
|
||||
self.main_window.show()
|
||||
self.contentView.setWindowFlags(QtCore.Qt.Widget)
|
||||
self.contentView.setWindowState(QtCore.Qt.WindowNoState)
|
||||
self.contentView.show()
|
||||
self.is_fullscreen = False
|
||||
|
||||
if not self.are_we_doing_images_only:
|
||||
self.hiddenButton.animateClick(100)
|
||||
|
||||
# Hide the view modification buttons in case they're visible
|
||||
self.main_window.bookToolBar.customize_view_off()
|
||||
|
||||
|
Reference in New Issue
Block a user