This commit is contained in:
Kovid Goyal 2008-06-18 12:52:58 -07:00
parent b5b6f10c48
commit 37cc4b13ea
3 changed files with 43 additions and 8 deletions

View File

@ -48,10 +48,7 @@ class LRFSingleDialog(QDialog, Ui_LRFSingleDialog):
self.gui_mono_family.setModel(self.font_family_model)
self.load_saved_global_defaults()
def __init__(self, window, db, row):
QDialog.__init__(self, window)
Ui_LRFSingleDialog.__init__(self)
self.setupUi(self)
def populate_list(self):
self.__w = []
self.__w.append(QIcon(':/images/dialog_information.svg'))
self.item1 = QListWidgetItem(self.__w[-1], _("Metadata"), self.categoryList)
@ -61,6 +58,12 @@ class LRFSingleDialog(QDialog, Ui_LRFSingleDialog):
self.item3 = QListWidgetItem(self.__w[-1], _('Page Setup'), self.categoryList)
self.__w.append(QIcon(':/images/chapters.svg'))
self.item4 = QListWidgetItem(self.__w[-1], _('Chapter Detection'), self.categoryList)
def __init__(self, window, db, row):
QDialog.__init__(self, window)
Ui_LRFSingleDialog.__init__(self)
self.setupUi(self)
self.populate_list()
self.categoryList.setCurrentRow(0)
QObject.connect(self.categoryList, SIGNAL('itemEntered(QListWidgetItem *)'),
self.show_category_help)
@ -383,15 +386,15 @@ class LRFSingleDialog(QDialog, Ui_LRFSingleDialog):
self.cmdline = [unicode(i) for i in cmdline]
else:
Settings().set('LRF conversion defaults', cmdline)
print self.cmdline
QDialog.accept(self)
class LRFBulkDialog(LRFSingleDialog):
def __init__(self, window):
QDialog.__init__(self, window)
Ui_LRFSingleDialog.__init__(self)
Ui_LRFSingleDialog.__init__(self)
self.setupUi(self)
self.populate_list()
self.categoryList.takeItem(0)
self.stack.removeWidget(self.stack.widget(0))
@ -401,7 +404,14 @@ class LRFBulkDialog(LRFSingleDialog):
self.setWindowTitle(_('Bulk convert ebooks to LRF'))
def accept(self):
self.cmdline = self.cmdline = [unicode(i) for i in self.build_commandline()]
self.cmdline = [unicode(i) for i in self.build_commandline()]
for meta in ('--title', '--author', '--publisher', '--comment'):
try:
index = self.cmdline.index(meta)
self.cmdline[index:index+2] = []
except ValueError:
continue
self.cover_file = None
QDialog.accept(self)

View File

@ -115,7 +115,7 @@
<item row="0" column="0" >
<widget class="QStackedWidget" name="stack" >
<property name="currentIndex" >
<number>0</number>
<number>3</number>
</property>
<widget class="QWidget" name="metadata_page" >
<property name="geometry" >
@ -1167,5 +1167,21 @@ p, li { white-space: pre-wrap; }
</hint>
</hints>
</connection>
<connection>
<sender>gui_disable_chapter_detection</sender>
<signal>toggled(bool)</signal>
<receiver>gui_chapter_attr</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>344</x>
<y>107</y>
</hint>
<hint type="destinationlabel" >
<x>489</x>
<y>465</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -746,6 +746,15 @@ class Main(MainWindow, Ui_MainWindow):
for i, row in enumerate([r.row() for r in rows]):
cmdline = list(d.cmdline)
mi = self.library_view.model().db.get_metadata(row)
if mi.title:
cmdline.extend(['--title', mi.title])
if mi.authors:
cmdline.extend(['--author', ','.join(mi.authors)])
if mi.publisher:
cmdline.extend(['--publisher', mi.publisher])
if mi.comments:
cmdline.extend(['--comment', mi.comments])
data = None
for fmt in LRF_PREFERRED_SOURCE_FORMATS:
try: