diff --git a/src/gen/plug/report/_options.py b/src/gen/plug/report/_options.py
index 899991305..ef70769ae 100644
--- a/src/gen/plug/report/_options.py
+++ b/src/gen/plug/report/_options.py
@@ -416,33 +416,35 @@ class OptionListCollection(_options.OptionListCollection):
f.write('\n')
def write_module_common(self, f, option_list):
- if option_list.get_style_name() \
- and option_list.get_style_name() != self.default_style_name:
- f.write(' \n' % escxml(option_list.get_style_name()) )
- if option_list.get_paper_metric() \
- and option_list.get_paper_metric() != self.default_paper_metric:
- f.write(' \n' % option_list.get_paper_metric() )
- if option_list.get_custom_paper_size() \
- and option_list.get_custom_paper_size() != self.default_custom_paper_size:
- size = self.get_last_custom_paper_size()
- f.write(' \n' % (size[0], size[1]) )
- if option_list.get_paper_name() \
- and option_list.get_paper_name() != self.default_paper_name:
- f.write(' \n' % escxml(option_list.get_paper_name()) )
- if option_list.get_css_filename() \
- and option_list.get_css_filename() != self.default_css_filename:
- f.write(' \n' % escxml(option_list.get_css_filename()))
- if option_list.get_format_name() \
- and option_list.get_format_name() != self.default_format_name:
- f.write(' \n' % escxml(option_list.get_format_name()) )
- if option_list.get_orientation() \
- and option_list.get_orientation() != self.default_orientation:
- f.write(' \n' % option_list.get_orientation() )
- if option_list.get_margins() \
- and option_list.get_margins() != self.default_margins:
- margins = option_list.get_margins()
- for pos in range(len(margins)):
- f.write(' \n' % (pos, margins[pos]))
+ if option_list.get_format_name():
+ f.write(' \n' %
+ escxml(option_list.get_format_name()) )
+ if option_list.get_format_name() == 'html':
+ if option_list.get_css_filename():
+ f.write(' \n' %
+ escxml(option_list.get_css_filename()))
+ else: # not HTML format, therefore it's paper
+ if option_list.get_paper_name():
+ f.write(' \n' %
+ escxml(option_list.get_paper_name()) )
+ if option_list.get_orientation() is not None: # 0 is legal
+ f.write(' \n' %
+ option_list.get_orientation() )
+ if option_list.get_paper_metric() is not None: # 0 is legal
+ f.write(' \n' %
+ option_list.get_paper_metric() )
+ if option_list.get_custom_paper_size():
+ size = self.get_last_custom_paper_size()
+ f.write(' \n' % (size[0], size[1]) )
+ if option_list.get_margins():
+ margins = option_list.get_margins()
+ for pos in range(len(margins)):
+ f.write(' \n' %
+ (pos, margins[pos]))
+
+ if option_list.get_style_name():
+ f.write(' \n' %
+ escxml(option_list.get_style_name()) )
def parse(self):
"""
@@ -599,7 +601,7 @@ class OptionHandler(_options.OptionHandler):
def set_common_options(self):
if self.saved_option_list.get_style_name():
self.style_name = self.saved_option_list.get_style_name()
- if self.saved_option_list.get_orientation():
+ if self.saved_option_list.get_orientation() is not None: # 0 is legal
self.orientation = self.saved_option_list.get_orientation()
if self.saved_option_list.get_custom_paper_size():
self.custom_paper_size = self.saved_option_list.get_custom_paper_size()
@@ -607,13 +609,30 @@ class OptionHandler(_options.OptionHandler):
self.margins = self.saved_option_list.get_margins()
if self.saved_option_list.get_css_filename():
self.css_filename = self.saved_option_list.get_css_filename()
- if self.saved_option_list.get_paper_metric():
+ if self.saved_option_list.get_paper_metric() is not None: # 0 is legal
self.paper_metric = self.saved_option_list.get_paper_metric()
if self.saved_option_list.get_paper_name():
self.paper_name = self.saved_option_list.get_paper_name()
if self.saved_option_list.get_format_name():
self.format_name = self.saved_option_list.get_format_name()
+ def save_options(self):
+ """
+ Saves options to file.
+
+ """
+
+ # First we save options from options_dict
+ for option_name, option_data in self.options_dict.iteritems():
+ self.saved_option_list.set_option(option_name,
+ self.options_dict[option_name])
+
+ # Handle common options
+ self.save_common_options()
+
+ # Finally, save the whole collection into file
+ self.option_list_collection.save()
+
def save_common_options(self):
# First we save common options
self.saved_option_list.set_style_name(self.style_name)
diff --git a/src/gui/plug/report/_webreportdialog.py b/src/gui/plug/report/_webreportdialog.py
index 6a3f500f1..0c0db36bd 100644
--- a/src/gui/plug/report/_webreportdialog.py
+++ b/src/gui/plug/report/_webreportdialog.py
@@ -45,6 +45,7 @@ class WebReportDialog(ReportDialog):
self.category = CATEGORY_WEB
ReportDialog.__init__(self, dbstate, uistate, option_class,
name, trans_name)
+ self.options.handler.set_format_name('html')
def setup_init(self):
pass