Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
c71985f621 | ||
|
c8fe0ba8b6 | ||
|
d6df28c503 | ||
|
75ace25c57 |
@@ -476,7 +476,7 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
ebooks_string = self._translate('Main_UI', 'eBooks')
|
ebooks_string = self._translate('Main_UI', 'eBooks')
|
||||||
opened_files = QtWidgets.QFileDialog.getOpenFileNames(
|
opened_files = QtWidgets.QFileDialog.getOpenFileNames(
|
||||||
self, dialog_prompt, self.settings['last_open_path'],
|
self, dialog_prompt, self.settings['last_open_path'],
|
||||||
f'{ebooks_string} ({self.available_parsers})')
|
f'{ebooks_string}({self.available_parsers})')
|
||||||
|
|
||||||
if not opened_files[0]:
|
if not opened_files[0]:
|
||||||
return
|
return
|
||||||
@@ -742,7 +742,7 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
else:
|
else:
|
||||||
self.settingsDialog.hide()
|
self.settingsDialog.hide()
|
||||||
|
|
||||||
#____________________________________________
|
#==================================================================
|
||||||
# The contentView modification functions are in the guifunctions
|
# The contentView modification functions are in the guifunctions
|
||||||
# module. self.profile_functions is the reference here.
|
# module. self.profile_functions is the reference here.
|
||||||
|
|
||||||
@@ -763,7 +763,7 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
self.profile_functions.modify_comic_view(
|
self.profile_functions.modify_comic_view(
|
||||||
signal_sender, key_pressed)
|
signal_sender, key_pressed)
|
||||||
|
|
||||||
#____________________________________________
|
#=================================================================
|
||||||
|
|
||||||
def change_page_view(self, key_pressed=False):
|
def change_page_view(self, key_pressed=False):
|
||||||
# Set zoom mode to best fit to
|
# Set zoom mode to best fit to
|
||||||
@@ -1059,6 +1059,8 @@ def main():
|
|||||||
app = QtWidgets.QApplication(sys.argv)
|
app = QtWidgets.QApplication(sys.argv)
|
||||||
app.setApplicationName('Lector') # This is needed for QStandardPaths
|
app.setApplicationName('Lector') # This is needed for QStandardPaths
|
||||||
# and my own hubris
|
# and my own hubris
|
||||||
|
# Make icons sharp in HiDPI screen
|
||||||
|
app.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)
|
||||||
|
|
||||||
# Internationalization support
|
# Internationalization support
|
||||||
translator = QtCore.QTranslator()
|
translator = QtCore.QTranslator()
|
||||||
|
@@ -101,18 +101,7 @@ class Library:
|
|||||||
position = i[5]
|
position = i[5]
|
||||||
if position:
|
if position:
|
||||||
position = pickle.loads(position)
|
position = pickle.loads(position)
|
||||||
if position['is_read']:
|
position_perc = generate_position_percentage(position)
|
||||||
position_perc = 1
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
position_perc = (
|
|
||||||
position['current_block'] / position['total_blocks'])
|
|
||||||
except (KeyError, ZeroDivisionError):
|
|
||||||
try:
|
|
||||||
position_perc = (
|
|
||||||
position['current_chapter'] / position['total_chapters'])
|
|
||||||
except KeyError:
|
|
||||||
position_perc = None
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
file_exists = os.path.exists(path)
|
file_exists = os.path.exists(path)
|
||||||
@@ -339,3 +328,23 @@ class Library:
|
|||||||
# Remove invalid paths from the database as well
|
# Remove invalid paths from the database as well
|
||||||
database.DatabaseFunctions(
|
database.DatabaseFunctions(
|
||||||
self.main_window.database_path).delete_from_database('Path', invalid_paths)
|
self.main_window.database_path).delete_from_database('Path', invalid_paths)
|
||||||
|
|
||||||
|
|
||||||
|
def generate_position_percentage(position):
|
||||||
|
if not position:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if position['is_read']:
|
||||||
|
position_perc = 1
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
position_perc = (
|
||||||
|
position['current_block'] / position['total_blocks'])
|
||||||
|
except (KeyError, ZeroDivisionError):
|
||||||
|
try:
|
||||||
|
position_perc = (
|
||||||
|
position['current_chapter'] / position['total_chapters'])
|
||||||
|
except KeyError:
|
||||||
|
position_perc = None
|
||||||
|
|
||||||
|
return position_perc
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
VERSION = '0.5.0'
|
VERSION = '0.5.1'
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
@@ -43,10 +43,6 @@ else:
|
|||||||
|
|
||||||
from PyQt5 import QtCore, QtGui
|
from PyQt5 import QtCore, QtGui
|
||||||
from lector import database
|
from lector import database
|
||||||
|
|
||||||
from lector.parsers.epub import ParseEPUB
|
|
||||||
from lector.parsers.mobi import ParseMOBI
|
|
||||||
from lector.parsers.fb2 import ParseFB2
|
|
||||||
from lector.parsers.comicbooks import ParseCOMIC
|
from lector.parsers.comicbooks import ParseCOMIC
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -69,7 +65,11 @@ else:
|
|||||||
# python-lxml - Required for everything except comics
|
# python-lxml - Required for everything except comics
|
||||||
lxml_check = importlib.util.find_spec('lxml')
|
lxml_check = importlib.util.find_spec('lxml')
|
||||||
xmltodict_check = importlib.util.find_spec('xmltodict')
|
xmltodict_check = importlib.util.find_spec('xmltodict')
|
||||||
if lxml_check:
|
if lxml_check and xmltodict_check:
|
||||||
|
from lector.parsers.epub import ParseEPUB
|
||||||
|
from lector.parsers.mobi import ParseMOBI
|
||||||
|
from lector.parsers.fb2 import ParseFB2
|
||||||
|
|
||||||
lxml_dependent = {
|
lxml_dependent = {
|
||||||
'epub': ParseEPUB,
|
'epub': ParseEPUB,
|
||||||
'mobi': ParseMOBI,
|
'mobi': ParseMOBI,
|
||||||
@@ -81,7 +81,7 @@ if lxml_check:
|
|||||||
'fb2.zip': ParseFB2}
|
'fb2.zip': ParseFB2}
|
||||||
sorter.update(lxml_dependent)
|
sorter.update(lxml_dependent)
|
||||||
else:
|
else:
|
||||||
critical_sting = 'python-lxml / xmltodict is not installed. Only comics will load.'
|
critical_sting = 'lxml / xmltodict is not installed. Only comics will load.'
|
||||||
print(critical_sting)
|
print(critical_sting)
|
||||||
logger.critical(critical_sting)
|
logger.critical(critical_sting)
|
||||||
|
|
||||||
@@ -201,7 +201,9 @@ class BookSorter:
|
|||||||
break
|
break
|
||||||
|
|
||||||
if not valid_extension:
|
if not valid_extension:
|
||||||
logger.error('Unsupported extension: ' + filename)
|
this_error = 'Unsupported extension: ' + filename
|
||||||
|
self.errors.append(this_error)
|
||||||
|
logger.error(this_error)
|
||||||
return
|
return
|
||||||
|
|
||||||
book_ref = sorter[file_extension](filename, self.temp_dir, file_md5)
|
book_ref = sorter[file_extension](filename, self.temp_dir, file_md5)
|
||||||
|
Reference in New Issue
Block a user