Merge #137 and make metadata dialogs non modal as otherwise on OSX the file open dialog gets hidden by them.

This commit is contained in:
Kovid Goyal 2007-08-06 18:02:19 +00:00
parent 361a841062
commit 4b3694ac18
5 changed files with 14 additions and 12 deletions

View File

@ -74,6 +74,8 @@ def option_parser(usage):
metadata = parser.add_option_group('METADATA OPTIONS')
metadata.add_option('--header', action='store_true', default=False, dest='header',
help='Add a header to all the pages with title and author.')
metadata.add_option('--headerformat', default="%t by %a", dest='headerformat', type='string',
help='Set the format of the header. %a is replaced by the author and %t by the title. Default is %default')
metadata.add_option("-t", "--title", action="store", type="string", default=None,\
dest="title", help="Set the title. Default: filename.")
metadata.add_option("-a", "--author", action="store", type="string", \

View File

@ -1231,6 +1231,7 @@ class HTMLConverter(object):
except Exception, err:
print 'WARNING: An error occurred while processing a table:', err
print 'Ignoring table markup'
self.in_table = False
self.process_children(tag, tag_css)
else:
self.process_children(tag, tag_css)
@ -1309,10 +1310,13 @@ def process_file(path, options):
args['thumbnail'] = tpath
header = None
if options.header:
header = Paragraph()
header.append(Bold(options.title))
header.append(' by ')
header.append(Italic(options.author+" "))
header = Paragraph()
fheader = options.headerformat
fheader = re.sub(r'([^%]|^)%t','\1' + options.title, fheader)
fheader = re.sub(r'([^%]|^)%a','\1' + options.author, fheader)
fheader = re.sub(r'%%a','%a',fheader)
fheader = re.sub(r'%%t','%t',fheader)
header.append(fheader + " ")
book, fonts = Book(options, header=header, **args)
le = re.compile(options.link_exclude) if options.link_exclude else \
re.compile('$')

View File

@ -1,9 +1,6 @@
<ui version="4.0" >
<class>MetadataBulkDialog</class>
<widget class="QDialog" name="MetadataBulkDialog" >
<property name="windowModality" >
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry" >
<rect>
<x>0</x>

View File

@ -1,15 +1,12 @@
<ui version="4.0" >
<class>MetadataSingleDialog</class>
<widget class="QDialog" name="MetadataSingleDialog" >
<property name="windowModality" >
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>865</width>
<height>776</height>
<width>777</width>
<height>656</height>
</rect>
</property>
<property name="windowTitle" >

View File

@ -367,7 +367,9 @@ class BooksView(QTableView):
QString(), 0, LibraryDatabase.sizeof_old_database(path),
self)
progress.setModal(True)
progress.setValue(0)
app = QCoreApplication.instance()
def meter(count):
progress.setValue(count)
app.processEvents()