diff --git a/src/gourmand/plugins/import_export/mealmaster_plugin/mealmaster_importer.py b/src/gourmand/plugins/import_export/mealmaster_plugin/mealmaster_importer.py index 5394060a..c598fa54 100644 --- a/src/gourmand/plugins/import_export/mealmaster_plugin/mealmaster_importer.py +++ b/src/gourmand/plugins/import_export/mealmaster_plugin/mealmaster_importer.py @@ -1,13 +1,10 @@ import array -import os.path import re -import string from gourmand import check_encodings, convert from gourmand.gdebug import TimeAction, debug from gourmand.importers import importer, plaintext_importer -#from gourmand.gglobals import gt class mmf_constants: def __init__ (self): diff --git a/src/gourmand/plugins/import_export/pdf_plugin/pdf_exporter.py b/src/gourmand/plugins/import_export/pdf_plugin/pdf_exporter.py index 761a0c98..6c121a65 100644 --- a/src/gourmand/plugins/import_export/pdf_plugin/pdf_exporter.py +++ b/src/gourmand/plugins/import_export/pdf_plugin/pdf_exporter.py @@ -1,28 +1,15 @@ import math -import os.path -import re -import tempfile -import types -import webbrowser import xml.sax.saxutils from gettext import ngettext from io import BytesIO -import reportlab -import reportlab.lib.colors as colors -import reportlab.lib.fonts as fonts -import reportlab.lib.pagesizes as pagesizes -import reportlab.lib.styles as styles -import reportlab.lib.units as units +from reportlab.lib import colors, pagesizes, styles import reportlab.platypus as platypus from gi.repository import Gtk from reportlab.lib.units import inch, mm -from reportlab.pdfbase import pdfmetrics -from reportlab.pdfgen import canvas -from reportlab.platypus.flowables import ParagraphAndImage import gourmand.exporters.exporter as exporter -from gourmand import convert, gglobals, image_utils +from gourmand import convert, gglobals from gourmand.gtk_extras import cb_extras from gourmand.gtk_extras import dialog_extras as de from gourmand.gtk_extras import optionTable @@ -31,14 +18,26 @@ from .page_drawer import PageDrawer -DEFAULT_PDF_ARGS = {'bottom_margin': 72, 'pagesize': 'letter', 'right_margin': 72, 'top_margin': 72, 'left_margin': 72, 'pagemode': 'portrait', 'base_font_size': 10, 'mode': ('column', 1)} +DEFAULT_PDF_ARGS = { + 'bottom_margin': 72, + 'pagesize': 'letter', + 'right_margin': 72, + 'top_margin': 72, + 'left_margin': 72, + 'pagemode': 'portrait', + 'base_font_size': 10, + 'mode': ('column', 1), +} + -# Code for MCLine from: -# http://two.pairlist.net/pipermail/reportlab-users/2005-February/003695.html class MCLine(platypus.Flowable): - """Line flowable --- draws a line in a flowable""" + """Line flowable. + + Draw a line in a flowable. Code for MCLine from: + http://two.pairlist.net/pipermail/reportlab-users/2005-February/003695.html + """ - def __init__(self,width): + def __init__(self, width): platypus.Flowable.__init__(self) self.width = width @@ -46,12 +45,12 @@ def __repr__(self): return "Line(w=%s)" % self.width def draw(self): - self.canv.line(0,0,self.width,0) + self.canv.line(0, 0, self.width, 0) + class Star (platypus.Flowable): '''A hand flowable.''' def __init__(self, size=None, fillcolor=colors.tan, strokecolor=colors.green): - from reportlab.lib.units import inch if size is None: size=12 # 12 point self.fillcolor, self.strokecolor = fillcolor, strokecolor self.size = size