Small fixes
This commit is contained in:
63
__main__.py
63
__main__.py
@@ -261,30 +261,6 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
if self.settings['scan_library']:
|
if self.settings['scan_library']:
|
||||||
self.settingsDialog.start_library_scan()
|
self.settingsDialog.start_library_scan()
|
||||||
|
|
||||||
def generate_library_context_menu(self, position):
|
|
||||||
# TODO
|
|
||||||
# The library might have multiple items selected
|
|
||||||
# Make sure the context menu actions are carried out on each
|
|
||||||
|
|
||||||
index = self.sender().indexAt(position)
|
|
||||||
if not index.isValid():
|
|
||||||
return
|
|
||||||
|
|
||||||
context_menu = QtWidgets.QMenu()
|
|
||||||
|
|
||||||
openAction = context_menu.addAction(
|
|
||||||
QtGui.QIcon.fromTheme('view-readermode'), 'Start reading')
|
|
||||||
editAction = context_menu.addAction(
|
|
||||||
QtGui.QIcon.fromTheme('edit-rename'), 'Edit')
|
|
||||||
deleteAction = context_menu.addAction(
|
|
||||||
QtGui.QIcon.fromTheme('trash-empty'), 'Delete')
|
|
||||||
readAction = context_menu.addAction(
|
|
||||||
QtGui.QIcon.fromTheme('vcs-normal'), 'Mark read')
|
|
||||||
unreadAction = context_menu.addAction(
|
|
||||||
QtGui.QIcon.fromTheme('emblem-unavailable'), 'Mark unread')
|
|
||||||
|
|
||||||
action = context_menu.exec_(self.sender().mapToGlobal(position))
|
|
||||||
|
|
||||||
def open_books_at_startup(self):
|
def open_books_at_startup(self):
|
||||||
# Last open books and command line books aren't being opened together
|
# Last open books and command line books aren't being opened together
|
||||||
# so that command line books are processed last and therefore retain focus
|
# so that command line books are processed last and therefore retain focus
|
||||||
@@ -956,13 +932,31 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
else:
|
else:
|
||||||
self.settingsDialog.hide()
|
self.settingsDialog.hide()
|
||||||
|
|
||||||
def generate_library_filter_menu(self, directory_list=None):
|
def generate_library_context_menu(self, position):
|
||||||
# TODO
|
# TODO
|
||||||
# Connect this to filtering @ the level of the library
|
# The library might have multiple items selected
|
||||||
# Remember state of the checkboxes on library update and application restart
|
# Make sure the context menu actions are carried out on each
|
||||||
# Behavior for clicking on All
|
|
||||||
# Don't show anything for less than 2 library folders
|
|
||||||
|
|
||||||
|
index = self.sender().indexAt(position)
|
||||||
|
if not index.isValid():
|
||||||
|
return
|
||||||
|
|
||||||
|
context_menu = QtWidgets.QMenu()
|
||||||
|
|
||||||
|
openAction = context_menu.addAction(
|
||||||
|
QtGui.QIcon.fromTheme('view-readermode'), 'Start reading')
|
||||||
|
editAction = context_menu.addAction(
|
||||||
|
QtGui.QIcon.fromTheme('edit-rename'), 'Edit')
|
||||||
|
deleteAction = context_menu.addAction(
|
||||||
|
QtGui.QIcon.fromTheme('trash-empty'), 'Delete')
|
||||||
|
readAction = context_menu.addAction(
|
||||||
|
QtGui.QIcon.fromTheme('vcs-normal'), 'Mark read')
|
||||||
|
unreadAction = context_menu.addAction(
|
||||||
|
QtGui.QIcon.fromTheme('emblem-unavailable'), 'Mark unread')
|
||||||
|
|
||||||
|
action = context_menu.exec_(self.sender().mapToGlobal(position))
|
||||||
|
|
||||||
|
def generate_library_filter_menu(self, directory_list=None):
|
||||||
self.libraryFilterMenu.clear()
|
self.libraryFilterMenu.clear()
|
||||||
|
|
||||||
def generate_name(path_data):
|
def generate_name(path_data):
|
||||||
@@ -1026,20 +1020,25 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
not self.bookToolBar.isVisible())
|
not self.bookToolBar.isVisible())
|
||||||
|
|
||||||
def closeEvent(self, event=None):
|
def closeEvent(self, event=None):
|
||||||
# All tabs must be iterated upon here
|
if event:
|
||||||
|
event.ignore()
|
||||||
|
|
||||||
self.hide()
|
self.hide()
|
||||||
self.settingsDialog.hide()
|
self.settingsDialog.hide()
|
||||||
self.temp_dir.remove()
|
self.temp_dir.remove()
|
||||||
|
|
||||||
self.settings['last_open_books'] = []
|
self.settings['last_open_books'] = []
|
||||||
if self.tabWidget.count() > 1 and self.settings['remember_files']:
|
if self.tabWidget.count() > 1:
|
||||||
|
|
||||||
|
# All tabs must be iterated upon here
|
||||||
all_metadata = []
|
all_metadata = []
|
||||||
for i in range(1, self.tabWidget.count()):
|
for i in range(1, self.tabWidget.count()):
|
||||||
tab_metadata = self.tabWidget.widget(i).metadata
|
tab_metadata = self.tabWidget.widget(i).metadata
|
||||||
self.settings['last_open_books'].append(tab_metadata['path'])
|
|
||||||
all_metadata.append(tab_metadata)
|
all_metadata.append(tab_metadata)
|
||||||
|
|
||||||
|
if self.settings['remember_files']:
|
||||||
|
self.settings['last_open_books'].append(tab_metadata['path'])
|
||||||
|
|
||||||
Settings(self).save_settings()
|
Settings(self).save_settings()
|
||||||
self.thread = BackGroundTabUpdate(self.database_path, all_metadata)
|
self.thread = BackGroundTabUpdate(self.database_path, all_metadata)
|
||||||
self.thread.finished.connect(QtWidgets.qApp.exit)
|
self.thread.finished.connect(QtWidgets.qApp.exit)
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
import os
|
import os
|
||||||
import pickle
|
import pickle
|
||||||
import pathlib
|
import pathlib
|
||||||
from PyQt5 import QtGui, QtCore, QtWidgets
|
from PyQt5 import QtGui, QtCore
|
||||||
|
|
||||||
import database
|
import database
|
||||||
from models import TableProxyModel, ItemProxyModel
|
from models import TableProxyModel, ItemProxyModel
|
||||||
|
@@ -53,7 +53,7 @@ class Tab(QtWidgets.QWidget):
|
|||||||
chapter_name = list(self.metadata['content'])[current_chapter - 1]
|
chapter_name = list(self.metadata['content'])[current_chapter - 1]
|
||||||
chapter_content = self.metadata['content'][chapter_name]
|
chapter_content = self.metadata['content'][chapter_name]
|
||||||
|
|
||||||
# The content display widget is, by default a QTextBrowser
|
# The content display widget is, by default a QTextBrowser.
|
||||||
# In case the incoming data is only images
|
# In case the incoming data is only images
|
||||||
# such as in the case of comic book files,
|
# such as in the case of comic book files,
|
||||||
# we want a QGraphicsView widget doing all the heavy lifting
|
# we want a QGraphicsView widget doing all the heavy lifting
|
||||||
@@ -147,6 +147,7 @@ class Tab(QtWidgets.QWidget):
|
|||||||
# TODO
|
# TODO
|
||||||
# Bookmark navigation does not work in case 2 entries in the same
|
# Bookmark navigation does not work in case 2 entries in the same
|
||||||
# chapter are clicked successively
|
# chapter are clicked successively
|
||||||
|
# It plain refuses to work other times
|
||||||
|
|
||||||
if self.sender().objectName() == 'tabWidget':
|
if self.sender().objectName() == 'tabWidget':
|
||||||
return
|
return
|
||||||
@@ -702,6 +703,8 @@ class BookmarkDelegate(QtWidgets.QStyledItemDelegate):
|
|||||||
|
|
||||||
chapter_index = index.data(QtCore.Qt.UserRole)
|
chapter_index = index.data(QtCore.Qt.UserRole)
|
||||||
chapter_name = self.parent.window().bookToolBar.tocBox.itemText(chapter_index - 1)
|
chapter_name = self.parent.window().bookToolBar.tocBox.itemText(chapter_index - 1)
|
||||||
|
if len(chapter_name) > 25:
|
||||||
|
chapter_name = chapter_name[:25] + '...'
|
||||||
|
|
||||||
QtWidgets.QStyledItemDelegate.paint(self, painter, option, index)
|
QtWidgets.QStyledItemDelegate.paint(self, painter, option, index)
|
||||||
painter.drawText(
|
painter.drawText(
|
||||||
|
Reference in New Issue
Block a user