Polish
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
✓ Theming
|
||||
✓ Keep fontsize and margins consistent - Let page increase in length
|
||||
✓ Fullscreening
|
||||
Record progress
|
||||
All ebooks should first be added to the database and then returned as HTML
|
||||
Pagination
|
||||
Set context menu for definitions and the like
|
||||
@@ -132,6 +133,7 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
||||
# ListView
|
||||
# self.listView.setSpacing(0)
|
||||
self.listView.setGridSize(QtCore.QSize(175, 240))
|
||||
self.listView.setMouseTracking(True)
|
||||
self.listView.verticalScrollBar().setSingleStep(7)
|
||||
self.listView.doubleClicked.connect(self.list_doubleclick)
|
||||
self.listView.setItemDelegate(LibraryDelegate())
|
||||
@@ -277,6 +279,7 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
||||
|
||||
current_tab = self.tabWidget.widget(self.tabWidget.currentIndex())
|
||||
required_content = current_tab.metadata['content'][chapter_name]
|
||||
current_tab.contentView.verticalScrollBar().setValue(0)
|
||||
current_tab.contentView.setHtml(required_content)
|
||||
|
||||
def set_fullscreen(self):
|
||||
@@ -291,6 +294,11 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
||||
|
||||
def list_doubleclick(self, myindex):
|
||||
index = self.listView.model().index(myindex.row(), 0)
|
||||
state = self.listView.model().data(index, QtCore.Qt.UserRole + 5)
|
||||
|
||||
if state == 'deleted':
|
||||
return
|
||||
|
||||
metadata = self.listView.model().data(index, QtCore.Qt.UserRole + 3)
|
||||
|
||||
# Shift focus to the tab that has the book open (if there is one)
|
||||
|
23
widgets.py
23
widgets.py
@@ -277,7 +277,7 @@ class Tab(QtWidgets.QWidget):
|
||||
|
||||
title = self.metadata['title']
|
||||
position = self.metadata['position']
|
||||
|
||||
|
||||
# TODO
|
||||
# Chapter position and vertical scrollbar position
|
||||
if not position:
|
||||
@@ -305,19 +305,28 @@ class LibraryDelegate(QtWidgets.QStyledItemDelegate):
|
||||
super(LibraryDelegate, self).__init__(parent)
|
||||
|
||||
def paint(self, painter, option, index):
|
||||
QtWidgets.QStyledItemDelegate.paint(self, painter, option, index)
|
||||
# This is a hint for the future
|
||||
# Color icon slightly red
|
||||
# if option.state & QtWidgets.QStyle.State_Selected:
|
||||
# painter.fillRect(option.rect, QtGui.QColor().fromRgb(255, 0, 0, 20))
|
||||
|
||||
option = option.__class__(option)
|
||||
state = index.data(QtCore.Qt.UserRole + 5)
|
||||
if state:
|
||||
if state == 'deleted':
|
||||
painter.setOpacity(.5)
|
||||
read_icon = QtGui.QIcon.fromTheme('vcs-conflicting').pixmap(36)
|
||||
painter.setOpacity(.5)
|
||||
QtWidgets.QStyledItemDelegate.paint(self, painter, option, index)
|
||||
painter.setOpacity(1)
|
||||
if state == 'completed':
|
||||
read_icon = QtGui.QIcon.fromTheme('vcs-normal').pixmap(36)
|
||||
if state == 'inprogress':
|
||||
read_icon = QtGui.QIcon.fromTheme('vcs-locally-modified').pixmap(36)
|
||||
else:
|
||||
return
|
||||
|
||||
x_draw = option.rect.bottomRight().x() - 30
|
||||
y_draw = option.rect.bottomRight().y() - 35
|
||||
painter.drawPixmap(x_draw, y_draw, read_icon)
|
||||
x_draw = option.rect.bottomRight().x() - 30
|
||||
y_draw = option.rect.bottomRight().y() - 35
|
||||
painter.drawPixmap(x_draw, y_draw, read_icon)
|
||||
|
||||
else:
|
||||
QtWidgets.QStyledItemDelegate.paint(self, painter, option, index)
|
||||
|
Reference in New Issue
Block a user