diff --git a/__main__.py b/__main__.py index 0e50325..7f03c6a 100755 --- a/__main__.py +++ b/__main__.py @@ -216,7 +216,7 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow): return # The hackiness of this hack is just... - default_size = 175 # This is size of the QIcon (160 by default) + + default_size = 170 # This is size of the QIcon (160 by default) + # minimum margin is needed between thumbnails # for n icons, the n + 1th icon will appear at > n +1.11875 diff --git a/library.py b/library.py index 8dec2d4..31125a2 100644 --- a/library.py +++ b/library.py @@ -104,7 +104,7 @@ class Library: img_pixmap.loadFromData(cover) else: img_pixmap.load(':/images/NotFound.png') - img_pixmap = img_pixmap.scaled(420, 600, QtCore.Qt.IgnoreAspectRatio) + img_pixmap = img_pixmap.scaled(420, 600, QtCore.Qt.IgnoreAspectRatio) item = QtGui.QStandardItem() item.setToolTip(tooltip_string) # The following order is needed to keep sorting working diff --git a/resources/raw/gray-shadow.png b/resources/raw/gray-shadow.png new file mode 100644 index 0000000..72a7dff Binary files /dev/null and b/resources/raw/gray-shadow.png differ diff --git a/resources/raw/resources.qrc b/resources/raw/resources.qrc index e1e094b..e5725d0 100644 --- a/resources/raw/resources.qrc +++ b/resources/raw/resources.qrc @@ -1,5 +1,6 @@ + gray-shadow.png NotFound.png checkmark.svg error.svg diff --git a/resources/resources.py b/resources/resources.py index c214ad6..585fd24 100644 --- a/resources/resources.py +++ b/resources/resources.py @@ -1117,6 +1117,19 @@ qt_resource_data = b"\ \x00\x00\xd2\x04\x2f\x00\x00\x69\x82\x17\x00\x80\xb4\x2f\xb6\xe1\ \xd6\x4d\xdd\x20\x9a\xae\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\ \x60\x82\ +\x00\x00\x00\xa3\ +\x00\ +\x00\x09\x38\x78\x9c\xeb\x0c\xf0\x73\xe7\xe5\x92\xe2\x62\x60\x60\ +\xe0\xf5\xf4\x70\x09\x62\x60\x60\x5c\xc2\xc0\xc0\x14\xc1\xc1\x06\ +\x14\xd1\xfd\x32\xe9\x14\x90\xe2\x2c\xf0\x88\x2c\x66\x60\x10\x2a\ +\x01\x61\xc6\x7b\x69\xf2\x15\x0c\x0c\x1c\xaf\x3c\x5d\x1c\x43\x2a\ +\xe6\xbc\xbd\x6a\xc8\x78\xc0\x80\xe7\xc0\x86\x35\x12\x87\xe7\x9f\ +\xe2\x5a\x6c\xa7\xc2\xf2\xef\xcf\xdb\x77\xf6\x0c\x1f\x6e\x54\xca\ +\x32\x30\x18\xb7\xb1\x38\xb4\x28\x32\x4e\x48\xf0\x60\x50\x91\x10\ +\x62\xe0\x04\x72\x9b\x46\xb9\xa3\xdc\x51\xee\x28\x77\x94\x3b\xca\ +\x1d\xe5\x8e\x72\x07\x39\xb7\x80\x91\xc5\x87\x6d\xf5\xcd\x67\x8b\ +\x6a\x80\x4d\x21\x06\x4f\x57\x3f\x97\x75\x4e\x09\x4d\x00\xf2\xfe\ +\xe3\x9e\ \x00\x00\x01\x55\ \x3c\ \x73\x76\x67\x20\x78\x6d\x6c\x6e\x73\x3d\x22\x68\x74\x74\x70\x3a\ @@ -1182,6 +1195,10 @@ qt_resource_name = b"\ \x02\xea\x4d\x87\ \x00\x4e\ \x00\x6f\x00\x74\x00\x46\x00\x6f\x00\x75\x00\x6e\x00\x64\x00\x2e\x00\x70\x00\x6e\x00\x67\ +\x00\x0f\ +\x0a\xe2\xd1\x87\ +\x00\x67\ +\x00\x72\x00\x61\x00\x79\x00\x2d\x00\x73\x00\x68\x00\x61\x00\x64\x00\x6f\x00\x77\x00\x2e\x00\x70\x00\x6e\x00\x67\ \x00\x0d\ \x0b\x5d\x1f\x07\ \x00\x63\ @@ -1194,22 +1211,25 @@ qt_resource_name = b"\ qt_resource_struct_v1 = b"\ \x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\ -\x00\x00\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00\x02\ +\x00\x00\x00\x00\x00\x02\x00\x00\x00\x04\x00\x00\x00\x02\ \x00\x00\x00\x12\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ -\x00\x00\x00\x50\x00\x00\x00\x00\x00\x01\x00\x00\x46\x70\ -\x00\x00\x00\x30\x00\x00\x00\x00\x00\x01\x00\x00\x45\x17\ +\x00\x00\x00\x74\x00\x00\x00\x00\x00\x01\x00\x00\x47\x17\ +\x00\x00\x00\x30\x00\x01\x00\x00\x00\x01\x00\x00\x45\x17\ +\x00\x00\x00\x54\x00\x00\x00\x00\x00\x01\x00\x00\x45\xbe\ " qt_resource_struct_v2 = b"\ \x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\ \x00\x00\x00\x00\x00\x00\x00\x00\ -\x00\x00\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00\x02\ +\x00\x00\x00\x00\x00\x02\x00\x00\x00\x04\x00\x00\x00\x02\ \x00\x00\x00\x00\x00\x00\x00\x00\ \x00\x00\x00\x12\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ \x00\x00\x01\x5f\xb9\x9f\xcd\x26\ -\x00\x00\x00\x50\x00\x00\x00\x00\x00\x01\x00\x00\x46\x70\ +\x00\x00\x00\x74\x00\x00\x00\x00\x00\x01\x00\x00\x47\x17\ \x00\x00\x01\x5f\x7e\xcc\x7f\x20\ -\x00\x00\x00\x30\x00\x00\x00\x00\x00\x01\x00\x00\x45\x17\ +\x00\x00\x00\x30\x00\x01\x00\x00\x00\x01\x00\x00\x45\x17\ +\x00\x00\x01\x5f\xf0\x1d\xc5\xb3\ +\x00\x00\x00\x54\x00\x00\x00\x00\x00\x01\x00\x00\x45\xbe\ \x00\x00\x01\x5f\x7e\xcc\x7f\x20\ " diff --git a/widgets.py b/widgets.py index 6a438ad..f2aa8b4 100644 --- a/widgets.py +++ b/widgets.py @@ -668,16 +668,28 @@ class LibraryDelegate(QtWidgets.QStyledItemDelegate): # TODO # Calculate progress on the basis of lines + # The shadow pixmap currently is set to 420 x 600 + shadow_pixmap = QtGui.QPixmap() + shadow_pixmap.load(':/images/gray-shadow.png') + shadow_pixmap = shadow_pixmap.scaled(160, 230, QtCore.Qt.IgnoreAspectRatio) + shadow_x = option.rect.topLeft().x() + 10 + shadow_y = option.rect.topLeft().y() - 5 + if not file_exists: - read_icon = QtGui.QIcon(':/images/error.svg').pixmap(36) painter.setOpacity(.7) + painter.drawPixmap(shadow_x, shadow_y, shadow_pixmap) QtWidgets.QStyledItemDelegate.paint(self, painter, option, index) painter.setOpacity(1) + + read_icon = QtGui.QIcon(':/images/error.svg').pixmap(36) x_draw = option.rect.bottomRight().x() - 30 y_draw = option.rect.bottomRight().y() - 35 painter.drawPixmap(x_draw, y_draw, read_icon) return + painter.setOpacity(.8) + painter.drawPixmap(shadow_x, shadow_y, shadow_pixmap) + painter.setOpacity(1) QtWidgets.QStyledItemDelegate.paint(self, painter, option, index) if position: current_chapter = position['current_chapter'] @@ -685,14 +697,10 @@ class LibraryDelegate(QtWidgets.QStyledItemDelegate): progress_percent = int(current_chapter * 100 / total_chapters) if current_chapter == total_chapters: - QtWidgets.QStyledItemDelegate.paint(self, painter, option, index) read_icon = QtGui.QIcon(':/images/checkmark.svg').pixmap(36) - elif current_chapter == 1: - QtWidgets.QStyledItemDelegate.paint(self, painter, option, index) else: # TODO # See if saving the svg to disk can be avoided - QtWidgets.QStyledItemDelegate.paint(self, painter, option, index) pie_chart.GeneratePie(progress_percent, self.temp_dir).generate() svg_path = os.path.join(self.temp_dir, 'lector_progress.svg') read_icon = QtGui.QIcon(svg_path).pixmap(32)