Beispiel #1
0
 def __init__(self,
              rd,
              recipes,
              out,
              one_file=True,
              ext='txt',
              conv=None,
              imgcount=1,
              progress_func=None,
              exporter=exporter,
              exporter_kwargs={},
              padding=None):
     """Output all recipes in recipes into a document or multiple
     documents. if one_file, then everything is in one
     file. Otherwise, we treat 'out' as a directory and put
     individual recipe files within it."""
     self.timer = TimeAction('exporterMultirec.__init__()')
     self.rd = rd
     self.recipes = recipes
     self.out = out
     self.padding = padding
     self.one_file = one_file
     Pluggable.__init__(self, [BaseExporterMultiRecPlugin])
     SuspendableThread.__init__(self, self.name)
     if progress_func:
         print 'Argument progress_func is obsolete and will be ignored:', progress_func
     self.ext = ext
     self.exporter = exporter
     self.exporter_kwargs = exporter_kwargs
     self.fractions = self.exporter_kwargs.get('fractions',
                                               convert.FRACTIONS_ASCII)
     self.DEFAULT_ENCODING = self.exporter.DEFAULT_ENCODING
     self.one_file = one_file
Beispiel #2
0
 def __init__(
     self,
     rd,
     recipes,
     out,
     one_file=True,
     ext="txt",
     conv=None,
     imgcount=1,
     progress_func=None,
     exporter=exporter,
     exporter_kwargs={},
     padding=None,
 ):
     """Output all recipes in recipes into a document or multiple
     documents. if one_file, then everything is in one
     file. Otherwise, we treat 'out' as a directory and put
     individual recipe files within it."""
     self.timer = TimeAction("exporterMultirec.__init__()")
     self.rd = rd
     self.recipes = recipes
     self.out = out
     self.padding = padding
     self.one_file = one_file
     Pluggable.__init__(self, [BaseExporterMultiRecPlugin])
     SuspendableThread.__init__(self, self.name)
     if progress_func:
         print "Argument progress_func is obsolete and will be ignored:", progress_func
     self.ext = ext
     self.exporter = exporter
     self.exporter_kwargs = exporter_kwargs
     self.fractions = self.exporter_kwargs.get("fractions", convert.FRACTIONS_ASCII)
     self.DEFAULT_ENCODING = self.exporter.DEFAULT_ENCODING
     self.one_file = one_file
Beispiel #3
0
 def __init__ (self, rd, recipes, out, one_file=True,
               ext='txt',
               conv=None,
               imgcount=1,
               exporter=exporter,
               exporter_kwargs={},
               padding=None):
     """Output all recipes in recipes into a document or multiple
     documents. if one_file, then everything is in one
     file. Otherwise, we treat 'out' as a directory and put
     individual recipe files within it."""
     self.timer=TimeAction('exporterMultirec.__init__()')
     self.rd = rd
     self.recipes = recipes
     self.out = out
     self.padding=padding
     self.one_file = one_file
     Pluggable.__init__(self,[BaseExporterMultiRecPlugin])
     SuspendableThread.__init__(self,self.name)
     self.ext = ext
     self.exporter = exporter
     self.exporter_kwargs = exporter_kwargs
     self.fractions = self.exporter_kwargs.get('fractions',
                                               convert.FRACTIONS_ASCII)
     self.DEFAULT_ENCODING = self.exporter.DEFAULT_ENCODING
     self.one_file = one_file
Beispiel #4
0
    def __init__(
        self,
        rd,
        r,
        out,
        conv=None,
        imgcount=1,
        order=["image", "attr", "ings", "text"],
        attr_order=DEFAULT_ATTR_ORDER,
        text_attr_order=DEFAULT_TEXT_ATTR_ORDER,
        do_markup=True,
        use_ml=False,
        convert_attnames=True,
        fractions=convert.FRACTIONS_ASCII,
    ):
        """Instantiate our exporter.

        conv is a preexisting convert.converter() class
        imgcount is a number we use to start counting our exported images.
        order is a list of our core elements in order: 'image','attr','text' and 'ings'
        attr_order is a list of our attributes in the order we should export them:
                   title, category, cuisine, servings, source, rating, preptime, cooktime
        text_attr_order is a list of our text attributes.
        do_markup is a flag; if true, we interpret tags in text blocks by calling
                  self.handle_markup to e.g. to simple plaintext renderings of tags.
        use_ml is a flag; if true, we escape strings we output to be valid *ml
        convert_attnames is a flag; if true, we hand write_attr a translated attribute name
                         suitable for printing or display. If not, we just hand it the standard
                         attribute name (this is a good idea if a subclass needs to rely on the
                         attribute name staying consistent for processing, since converting attnames
                         will produce locale specific strings.
        """
        self.attr_order = attr_order
        self.text_attr_order = text_attr_order
        self.out = out
        self.r = r
        self.rd = rd
        self.do_markup = do_markup
        self.fractions = fractions
        self.use_ml = use_ml
        self.convert_attnames = convert_attnames
        if not conv:
            conv = convert.get_converter()
        self.conv = conv
        self.imgcount = imgcount
        self.images = []
        self.order = order
        Pluggable.__init__(self, [BaseExporterPlugin])
        SuspendableThread.__init__(self, self.name)
Beispiel #5
0
    def __init__(
        self,
        rd,
        r,
        out,
        conv=None,
        imgcount=1,
        order=['image', 'attr', 'ings', 'text'],
        attr_order=DEFAULT_ATTR_ORDER,
        text_attr_order=DEFAULT_TEXT_ATTR_ORDER,
        do_markup=True,
        use_ml=False,
        convert_attnames=True,
        fractions=convert.FRACTIONS_ASCII,
    ):
        """Instantiate our exporter.

        conv is a preexisting convert.converter() class
        imgcount is a number we use to start counting our exported images.
        order is a list of our core elements in order: 'image','attr','text' and 'ings'
        attr_order is a list of our attributes in the order we should export them:
                   title, category, cuisine, servings, source, rating, preptime, cooktime
        text_attr_order is a list of our text attributes.
        do_markup is a flag; if true, we interpret tags in text blocks by calling
                  self.handle_markup to e.g. to simple plaintext renderings of tags.
        use_ml is a flag; if true, we escape strings we output to be valid *ml
        convert_attnames is a flag; if true, we hand write_attr a translated attribute name
                         suitable for printing or display. If not, we just hand it the standard
                         attribute name (this is a good idea if a subclass needs to rely on the
                         attribute name staying consistent for processing, since converting attnames
                         will produce locale specific strings.
        """
        self.attr_order = attr_order
        self.text_attr_order = text_attr_order
        self.out = out
        self.r = r
        self.rd = rd
        self.do_markup = do_markup
        self.fractions = fractions
        self.use_ml = use_ml
        self.convert_attnames = convert_attnames
        if not conv: conv = convert.get_converter()
        self.conv = conv
        self.imgcount = imgcount
        self.images = []
        self.order = order
        Pluggable.__init__(self, [BaseExporterPlugin])
        SuspendableThread.__init__(self, self.name)
Beispiel #6
0
    def __init__(self,
                 rd,
                 recipes,
                 out,
                 one_file=True,
                 create_file=True,
                 ext='txt',
                 conv=None,
                 imgcount=1,
                 exporter=exporter,
                 exporter_kwargs={},
                 padding=None):
        """Output all recipes in recipes into a document or multiple
        documents. if one_file, then everything is in one
        file. Otherwise, we treat 'out' as a directory and put
        individual recipe files within it.

        @param out: The name of the output file or directory

        @param one_file: If True works in one_file mode. For this the class will
                    create the file which is accessible by self.ofi
                    If this is set to False a directory will be created and the
                    name of the directory will be passed via self.outdir and self.ofi

        @param create_file: If this parameter is True the files will be created
                    otherwise to create the file is up to the user.
        """
        self.timer = TimeAction('exporterMultirec.__init__()')
        self.rd = rd
        self.recipes = recipes
        self.out = out
        self.outdir = out
        self.padding = padding
        self.one_file = one_file
        Pluggable.__init__(self, [BaseExporterMultiRecPlugin])
        SuspendableThread.__init__(self, self.name)
        self.ext = ext
        self.exporter = exporter
        self.exporter_kwargs = exporter_kwargs
        self.fractions = self.exporter_kwargs.get('fractions',
                                                  convert.FRACTIONS_ASCII)
        self.DEFAULT_ENCODING = self.exporter.DEFAULT_ENCODING
        self.one_file = one_file
        self.create_file = create_file
Beispiel #7
0
    def __init__(self, rd, recipes, out, one_file=True, create_file=True,
                 ext='txt',
                 conv=None,
                 imgcount=1,
                 exporter=exporter,
                 exporter_kwargs={},
                 padding=None):
        """Output all recipes in recipes into a document or multiple
        documents. if one_file, then everything is in one
        file. Otherwise, we treat 'out' as a directory and put
        individual recipe files within it.

        @param out: The name of the output file or directory

        @param one_file: If True works in one_file mode. For this the class will
                    create the file which is accessible by self.ofi
                    If this is set to False a directory will be created and the
                    name of the directory will be passed via self.outdir and self.ofi

        @param create_file: If this parameter is True the files will be created
                    otherwise to create the file is up to the user.
        """
        self.timer=TimeAction('exporterMultirec.__init__()')
        self.rd = rd
        self.recipes = recipes
        self.out = out
        self.outdir = out
        self.padding=padding
        self.one_file = one_file
        Pluggable.__init__(self,[BaseExporterMultiRecPlugin])
        SuspendableThread.__init__(self,self.name)
        self.ext = ext
        self.exporter = exporter
        self.exporter_kwargs = exporter_kwargs
        self.fractions = self.exporter_kwargs.get('fractions',
                                                  convert.FRACTIONS_ASCII)
        self.DEFAULT_ENCODING = self.exporter.DEFAULT_ENCODING
        self.one_file = one_file
        self.create_file = create_file
Beispiel #8
0
 def __init__(self):
     Pluggable.__init__(self, [PluginPlugin])
Beispiel #9
0
 def __init__(self, *args, **kwargs):
     Pluggable.__init__(self, [PluginPlugin])
 def __init__ (self, *args, **kwargs):
     Pluggable.__init__(self, [PluginPlugin])
Beispiel #11
0
 def __init__(self):
     if not KeyEditorPluginManager.__single:
         KeyEditorPluginManager.__single = self
     else:
         raise KeyEditorPluginManager.__single
     Pluggable.__init__(self, [PluginPlugin])
 def __init__ (self):
     if not KeyEditorPluginManager.__single:
         KeyEditorPluginManager.__single = self
     else:
         raise KeyEditorPluginManager.__single
     Pluggable.__init__(self,[PluginPlugin])