Generate list of available parsers
This commit is contained in:
16
__main__.py
16
__main__.py
@@ -169,6 +169,10 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
# Tab closing
|
# Tab closing
|
||||||
self.tabWidget.setTabsClosable(True)
|
self.tabWidget.setTabsClosable(True)
|
||||||
|
|
||||||
|
# Get list of available parsers
|
||||||
|
self.available_parsers = '*.' + ' *.'.join(sorter.available_parsers)
|
||||||
|
print('Available parsers: ' + self.available_parsers)
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
# Associate this with the library switcher
|
# Associate this with the library switcher
|
||||||
library_subclass = QtWidgets.QToolButton()
|
library_subclass = QtWidgets.QToolButton()
|
||||||
@@ -200,6 +204,7 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
self.listView.setFocus()
|
self.listView.setFocus()
|
||||||
|
|
||||||
# Open last... open books.
|
# Open last... open books.
|
||||||
|
# Then set the value to None for the next run
|
||||||
self.open_files(self.last_open_books)
|
self.open_files(self.last_open_books)
|
||||||
self.last_open_books = None
|
self.last_open_books = None
|
||||||
|
|
||||||
@@ -240,17 +245,16 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
def add_books(self):
|
def add_books(self):
|
||||||
# TODO
|
# TODO
|
||||||
# Maybe expand this to traverse directories recursively
|
# Maybe expand this to traverse directories recursively
|
||||||
# Generate list of available parsers
|
|
||||||
|
|
||||||
my_file = QtWidgets.QFileDialog.getOpenFileNames(
|
opened_files = QtWidgets.QFileDialog.getOpenFileNames(
|
||||||
self, 'Open file', self.last_open_path,
|
self, 'Open file', self.last_open_path,
|
||||||
"eBooks (*.epub *.cbz *.cbr)")
|
f'eBooks ({self.available_parsers})')
|
||||||
|
|
||||||
if my_file[0]:
|
if opened_files[0]:
|
||||||
self.last_open_path = os.path.dirname(my_file[0][0])
|
self.last_open_path = os.path.dirname(opened_files[0][0])
|
||||||
self.sorterProgress.setVisible(True)
|
self.sorterProgress.setVisible(True)
|
||||||
self.statusMessage.setText('Adding books...')
|
self.statusMessage.setText('Adding books...')
|
||||||
self.thread = BackGroundBookAddition(self, my_file[0], self.database_path)
|
self.thread = BackGroundBookAddition(self, opened_files[0], self.database_path)
|
||||||
self.thread.finished.connect(self.move_on)
|
self.thread.finished.connect(self.move_on)
|
||||||
self.thread.start()
|
self.thread.start()
|
||||||
|
|
||||||
|
@@ -26,6 +26,7 @@ from parsers.epub import ParseEPUB
|
|||||||
from parsers.cbz import ParseCBZ
|
from parsers.cbz import ParseCBZ
|
||||||
from parsers.cbr import ParseCBR
|
from parsers.cbr import ParseCBR
|
||||||
|
|
||||||
|
available_parsers = ['epub', 'cbz', 'cbr']
|
||||||
progressbar = None # This is populated by __main__
|
progressbar = None # This is populated by __main__
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user