Small fixes

This commit is contained in:
BasioMeusPuga
2018-03-13 19:20:47 +05:30
parent e0b20e36dd
commit 8564ede48b
4 changed files with 13 additions and 5 deletions

1
TODO
View File

@@ -67,6 +67,7 @@ TODO
If there are files open and the database is deleted, TypeErrors result If there are files open and the database is deleted, TypeErrors result
Cover culling does not occur if some other tab has initial focus Cover culling does not occur if some other tab has initial focus
Exiting with Ctrl + Q does not save the cursor position INITIALLY Exiting with Ctrl + Q does not save the cursor position INITIALLY
Slider position change might be acting up too
Secondary: Secondary:
pdf support pdf support

View File

@@ -17,7 +17,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import os import os
import sys
import zipfile import zipfile
from urllib.parse import unquote from urllib.parse import unquote
@@ -57,7 +56,8 @@ class EPUB:
try: try:
this_xml = self.zip_file.read(filename).decode() this_xml = self.zip_file.read(filename).decode()
except KeyError: except KeyError:
print(str(filename) + ' not found in zip') short_filename = os.path.basename(self.filename)
print(f'{str(filename)} not found in {short_filename}')
return return
root = BeautifulSoup(this_xml, parser) root = BeautifulSoup(this_xml, parser)
@@ -170,7 +170,7 @@ class EPUB:
self.get_file_path(cover_href)) self.get_file_path(cover_href))
if not self.book['cover']: if not self.book['cover']:
# If no cover is located the conventioanl way, # If no cover is located the conventional way,
# we go looking for the largest image in the book # we go looking for the largest image in the book
biggest_image_size = 0 biggest_image_size = 0
biggest_image = None biggest_image = None

View File

@@ -195,6 +195,7 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
# The library refresh button on the Library tab # The library refresh button on the Library tab
self.reloadLibrary.setIcon(QtGui.QIcon.fromTheme('reload')) self.reloadLibrary.setIcon(QtGui.QIcon.fromTheme('reload'))
self.reloadLibrary.setObjectName('reloadLibrary') self.reloadLibrary.setObjectName('reloadLibrary')
self.reloadLibrary.setToolTip('Scan library')
self.reloadLibrary.setAutoRaise(True) self.reloadLibrary.setAutoRaise(True)
self.reloadLibrary.clicked.connect(self.settingsDialog.start_library_scan) self.reloadLibrary.clicked.connect(self.settingsDialog.start_library_scan)
@@ -364,6 +365,9 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
{'Hash': ''}, {'Hash': ''},
'LIKE') 'LIKE')
if not all_covers_db:
return
all_covers = { all_covers = {
i[0]: i[1] for i in all_covers_db} i[0]: i[1] for i in all_covers_db}

View File

@@ -152,8 +152,11 @@ class Tab(QtWidgets.QWidget):
self.metadata['hash'], self.metadata['hash'],
1, QtCore.Qt.MatchExactly) 1, QtCore.Qt.MatchExactly)
try:
self.window().lib_ref.view_model.setData( self.window().lib_ref.view_model.setData(
matching_item[0], self.metadata['last_accessed'], QtCore.Qt.UserRole + 12) matching_item[0], self.metadata['last_accessed'], QtCore.Qt.UserRole + 12)
except IndexError: # The file has been deleted
pass
def set_scroll_value(self, switch_widgets=True, search_data=None): def set_scroll_value(self, switch_widgets=True, search_data=None):
# TODO # TODO