def __init__(self, parent, modifications):
        self.modifications = modifications
        self.document_generated = False

        # Instead of calling wx.Dialog.__init__ we precreate the dialog
        # so we can set an extra style that must be set before
        # creation, and then we create the GUI object using the Create
        # method.
        pre = wx.PreDialog()
        pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
        pre.Create(parent, -1, "Génération de document")

        # This next step is the most important, it turns this Python
        # object into the real wrapper of the dialog (instead of pre)
        # as far as the wxPython extension is concerned.
        self.PostCreate(pre)

        self.sizer = wx.BoxSizer(wx.VERTICAL)

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(wx.StaticText(self, -1, "Format :"), 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5)
        if not IsOODocument(modifications.template):
            self.format = wx.Choice(self, -1, choices=["Texte"])
        elif sys.platform == 'win32':
            self.format = wx.Choice(self, -1, choices=["LibreOffice", "PDF"])
        else:
            self.format = wx.Choice(self, -1, choices=["LibreOffice"])
        self.format.SetSelection(0)
        self.Bind(wx.EVT_CHOICE, self.onFormat, self.format)
        sizer.Add(self.format, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5)
        default_output = normalize_filename(modifications.default_output)

        self.extension = os.path.splitext(default_output)[-1]
        wildcard = "OpenDocument (*%s)|*%s|PDF files (*.pdf)|*.pdf" % (self.extension, self.extension)
        self.fbb = wx.lib.filebrowsebutton.FileBrowseButton(self, -1,
                                                            size=(600, -1),
                                                            labelText="Nom de fichier :",
                                                            startDirectory=config.documents_directory,
                                                            initialValue=os.path.join(config.documents_directory, default_output),
                                                            fileMask=wildcard,
                                                            fileMode=wx.SAVE)
        sizer.Add(self.fbb, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 5)
        self.sizer.Add(sizer, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)

        self.gauge = wx.Gauge(self, -1, size=(-1, 10))
        self.gauge.SetRange(100)
        self.sizer.Add(self.gauge, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.LEFT | wx.TOP, 5)

        line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL)
        self.sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.BOTTOM, 5)

        sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.sauver_ouvrir = wx.Button(self, -1, "Sauver et ouvrir")
        self.sauver_ouvrir.SetDefault()
        self.Bind(wx.EVT_BUTTON, self.OnSauverOuvrir, self.sauver_ouvrir)
        sizer.Add(self.sauver_ouvrir, 0, wx.LEFT | wx.RIGHT, 5)

        self.sauver = wx.Button(self, -1, "Sauver")
        self.Bind(wx.EVT_BUTTON, self.OnSauver, self.sauver)
        sizer.Add(self.sauver, 0, wx.RIGHT, 5)

        if modifications.multi:
            button = wx.Button(self, -1, "Sauver individuellement")
            self.Bind(wx.EVT_BUTTON, self.OnSauverUnitaire, button)
            sizer.Add(button, 0, wx.RIGHT, 5)

        if modifications.email:
            self.sauver_envoyer = wx.Button(self, -1, "Sauver et envoyer par email")
            self.Bind(wx.EVT_BUTTON, self.OnSauverEnvoyer, self.sauver_envoyer)
            sizer.Add(self.sauver_envoyer, 0, wx.RIGHT, 5)
            if modifications.multi is False and not modifications.email_to:
                self.sauver_envoyer.Disable()

            if database.creche.caf_email:
                self.sauver_envoyer = wx.Button(self, -1, "Sauver et envoyer par email à la CAF")
                self.Bind(wx.EVT_BUTTON, self.OnSauverEnvoyerCAF, self.sauver_envoyer)
                sizer.Add(self.sauver_envoyer, 0, wx.LEFT | wx.RIGHT, 5)

        # btnsizer.Add(self.ok)
        btn = wx.Button(self, wx.ID_CANCEL)
        sizer.Add(btn, 0, wx.RIGHT, 5)
        self.sizer.Add(sizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)

        self.SetSizer(self.sizer)
        self.sizer.Fit(self)
        self.CenterOnScreen()