Fine tune progress display
Option: Set consider read at percentage Small fixes
This commit is contained in:
@@ -94,16 +94,18 @@ def generate_pie(progress_percent, temp_dir=None):
|
||||
return lSvg
|
||||
|
||||
|
||||
def pixmapper(progress, total, temp_dir, size):
|
||||
def pixmapper(position_percent, temp_dir, consider_read_at, size):
|
||||
# A current_chapter of -1 implies the files does not exist
|
||||
# A chapter number == Total chapters implies the file is unread
|
||||
return_pixmap = None
|
||||
# position_percent and consider_read_at are expected as a <1 decimal value
|
||||
|
||||
if progress == -1:
|
||||
return_pixmap = None
|
||||
consider_read_at = consider_read_at / 100
|
||||
|
||||
if position_percent == -1:
|
||||
return_pixmap = QtGui.QIcon(':/images/error.svg').pixmap(size)
|
||||
return return_pixmap
|
||||
|
||||
if progress >= .95 * total: # Consider book read @ 95% progress
|
||||
if position_percent >= consider_read_at: # Consider book read @ 95% progress
|
||||
return_pixmap = QtGui.QIcon(':/images/checkmark.svg').pixmap(size)
|
||||
else:
|
||||
|
||||
@@ -111,8 +113,7 @@ def pixmapper(progress, total, temp_dir, size):
|
||||
# See if saving the svg to disk can be avoided
|
||||
# Maybe make the alignment a little more uniform across emblems
|
||||
|
||||
progress_percent = int(progress * 100 / total)
|
||||
generate_pie(progress_percent, temp_dir)
|
||||
generate_pie(int(position_percent * 100), temp_dir)
|
||||
svg_path = os.path.join(temp_dir, 'lector_progress.svg')
|
||||
return_pixmap = QtGui.QIcon(svg_path).pixmap(size - 4) ## The -4 looks more proportional
|
||||
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1088</width>
|
||||
<width>1119</width>
|
||||
<height>612</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -47,6 +47,74 @@
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_14">
|
||||
<item>
|
||||
<widget class="QLabel" name="readAtLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Consider book read at percent</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="readAtPercent">
|
||||
<property name="minimum">
|
||||
<number>90</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>95</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="toolTip">
|
||||
<string>Restart application to see changes</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Icon theme: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="darkIconsRadio">
|
||||
<property name="toolTip">
|
||||
<string>Restart application to see changes</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Dark</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="lightIconsRadio">
|
||||
<property name="toolTip">
|
||||
<string>Restart application to see changes</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>L&ight</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
@@ -88,40 +156,6 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="toolTip">
|
||||
<string>Restart application to see changes</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Icon theme: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="darkIconsRadio">
|
||||
<property name="toolTip">
|
||||
<string>Restart application to see changes</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Dark</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="lightIconsRadio">
|
||||
<property name="toolTip">
|
||||
<string>Restart application to see changes</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>L&ight</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autoTags">
|
||||
<property name="text">
|
||||
|
@@ -11,7 +11,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
class Ui_Dialog(object):
|
||||
def setupUi(self, Dialog):
|
||||
Dialog.setObjectName("Dialog")
|
||||
Dialog.resize(1088, 612)
|
||||
Dialog.resize(1119, 612)
|
||||
self.gridLayout = QtWidgets.QGridLayout(Dialog)
|
||||
self.gridLayout.setObjectName("gridLayout")
|
||||
self.listView = QtWidgets.QListView(Dialog)
|
||||
@@ -46,6 +46,38 @@ class Ui_Dialog(object):
|
||||
self.gridLayout_4.setObjectName("gridLayout_4")
|
||||
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
|
||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||
self.horizontalLayout_13 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_13.setObjectName("horizontalLayout_13")
|
||||
self.horizontalLayout_14 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_14.setObjectName("horizontalLayout_14")
|
||||
self.readAtLabel = QtWidgets.QLabel(self.groupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.readAtLabel.sizePolicy().hasHeightForWidth())
|
||||
self.readAtLabel.setSizePolicy(sizePolicy)
|
||||
self.readAtLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
|
||||
self.readAtLabel.setObjectName("readAtLabel")
|
||||
self.horizontalLayout_14.addWidget(self.readAtLabel)
|
||||
self.readAtPercent = QtWidgets.QSpinBox(self.groupBox)
|
||||
self.readAtPercent.setMinimum(90)
|
||||
self.readAtPercent.setProperty("value", 95)
|
||||
self.readAtPercent.setObjectName("readAtPercent")
|
||||
self.horizontalLayout_14.addWidget(self.readAtPercent)
|
||||
self.horizontalLayout_13.addLayout(self.horizontalLayout_14)
|
||||
self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_7.setObjectName("horizontalLayout_7")
|
||||
self.label = QtWidgets.QLabel(self.groupBox)
|
||||
self.label.setObjectName("label")
|
||||
self.horizontalLayout_7.addWidget(self.label)
|
||||
self.darkIconsRadio = QtWidgets.QRadioButton(self.groupBox)
|
||||
self.darkIconsRadio.setObjectName("darkIconsRadio")
|
||||
self.horizontalLayout_7.addWidget(self.darkIconsRadio)
|
||||
self.lightIconsRadio = QtWidgets.QRadioButton(self.groupBox)
|
||||
self.lightIconsRadio.setObjectName("lightIconsRadio")
|
||||
self.horizontalLayout_7.addWidget(self.lightIconsRadio)
|
||||
self.horizontalLayout_13.addLayout(self.horizontalLayout_7)
|
||||
self.verticalLayout_2.addLayout(self.horizontalLayout_13)
|
||||
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
|
||||
self.refreshLibrary = QtWidgets.QCheckBox(self.groupBox)
|
||||
@@ -66,18 +98,6 @@ class Ui_Dialog(object):
|
||||
self.verticalLayout_2.addLayout(self.horizontalLayout_3)
|
||||
self.horizontalLayout_9 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_9.setObjectName("horizontalLayout_9")
|
||||
self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_7.setObjectName("horizontalLayout_7")
|
||||
self.label = QtWidgets.QLabel(self.groupBox)
|
||||
self.label.setObjectName("label")
|
||||
self.horizontalLayout_7.addWidget(self.label)
|
||||
self.darkIconsRadio = QtWidgets.QRadioButton(self.groupBox)
|
||||
self.darkIconsRadio.setObjectName("darkIconsRadio")
|
||||
self.horizontalLayout_7.addWidget(self.darkIconsRadio)
|
||||
self.lightIconsRadio = QtWidgets.QRadioButton(self.groupBox)
|
||||
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)
|
||||
@@ -283,17 +303,18 @@ class Ui_Dialog(object):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
Dialog.setWindowTitle(_translate("Dialog", "Settings"))
|
||||
self.groupBox.setTitle(_translate("Dialog", "Library"))
|
||||
self.refreshLibrary.setText(_translate("Dialog", "Startup: Refresh library"))
|
||||
self.fileRemember.setText(_translate("Dialog", "Remember open files"))
|
||||
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.readAtLabel.setText(_translate("Dialog", "Consider book read at percent"))
|
||||
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.refreshLibrary.setText(_translate("Dialog", "Startup: Refresh library"))
|
||||
self.fileRemember.setText(_translate("Dialog", "Remember open files"))
|
||||
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.groupBox_2.setTitle(_translate("Dialog", "Reading"))
|
||||
self.hideScrollBars.setToolTip(_translate("Dialog", "Horizontal scrolling with Alt + Scroll\n"
|
||||
|
Reference in New Issue
Block a user