Example #1
0
def getExporterClasses(mainControl):
    import Exporters    # createExporters
    
    # TODO: Cache?
    return reduce(lambda a, b: a+list(b),
            wx.GetApp().describeExportersApi.describeExportersV01(mainControl),
            list(Exporters.describeExportersV01(mainControl)))
Example #2
0
def getExporterClasses(mainControl):
    import Exporters  # createExporters

    # TODO: Cache?
    return reduce(
        lambda a, b: a + list(b),
        wx.GetApp().describeExportersApi.describeExportersV01(mainControl),
        list(Exporters.describeExportersV01(mainControl)))
Example #3
0
    def _runSavedExport(self, pWiki, savedExportName, continuousExport):
        import Serialization, PluginManager, Exporters, SearchAndReplace

        exportList = Exporters.retrieveSavedExportsList(pWiki,
                pWiki.getWikiData(), continuousExport)
        xmlNode = None
        for exportName, xn in exportList:
            if exportName == savedExportName:
                xmlNode = xn
                break

        if xmlNode is None:
            self.showCmdLineUsage(pWiki,
                    _(u"Saved export '%s' is unknown.") % savedExportName + u"\n\n")
            return


        # TODO: Refactor, it is based on AdditionalDialogs.ExportDialog._showExportProfile
        try:
            etypeProfile = Serialization.serFromXmlUnicode(xmlNode,
                    u"exportTypeName")

            try:  
                exporter, etype, desc, panel = PluginManager.getSupportedExportTypes(
                        pWiki, None, continuousExport)[etypeProfile]
            except KeyError:
                self.showCmdLineUsage(pWiki,
                        _(u"Export type '%s' of saved export is not supported") %
                        etypeProfile + u"\n\n")
                return

            addOptXml = Serialization.findXmlElementFlat(xmlNode,
                    u"additionalOptions")

            addOptVersion = int(addOptXml.getAttribute(u"version"))

            if addOptVersion != exporter.getAddOptVersion():
                self.showCmdLineUsage(pWiki,
                        _(u"Saved export uses different version for additional "
                        "options than current export\nExport type: '%s'\n"
                        "Saved export version: %i\nCurrent export version: %i") %
                        (etypeProfile, addOptVersion, exporter.getAddOptVersion()) +
                        u"\n\n")
                return 

            if addOptXml.getAttribute(u"type") != u"simpleTuple":
                self.showCmdLineUsage(pWiki,
                        _(u"Type of additional option storage ('%s') is unknown") %
                        addOptXml.getAttribute(u"type") + u"\n\n")
                return

            pageSetXml = Serialization.findXmlElementFlat(xmlNode, u"pageSet")

            sarOp = SearchAndReplace.SearchReplaceOperation()
            sarOp.serializeFromXml(pageSetXml)
            
            
            addOpt = Serialization.convertTupleFromXml(addOptXml)

#                 self.ctrls.chSelectedSet.SetSelection(3)
#                 self.ctrls.chExportTo.SetSelection(sel)
#                 exporter.setAddOpt(addOpt, panel)

            exportDest = Serialization.serFromXmlUnicode(xmlNode,
                    u"destinationPath")

#                 self._refreshForEtype()

        except SerializationException, e:
            self.showCmdLineUsage(pWiki, _(u"Error during retrieving "
                    "saved export: ") + e.message + u"\n\n")
    def _runSavedExport(self, pWiki, savedExportName, continuousExport):
        import Serialization, PluginManager, Exporters, SearchAndReplace

        exportList = Exporters.retrieveSavedExportsList(
            pWiki, pWiki.getWikiData(), continuousExport)
        xmlNode = None
        for exportName, xn in exportList:
            if exportName == savedExportName:
                xmlNode = xn
                break

        if xmlNode is None:
            self.showCmdLineUsage(
                pWiki,
                _(u"Saved export '%s' is unknown.") % savedExportName +
                u"\n\n")
            return

        # TODO: Refactor, it is based on AdditionalDialogs.ExportDialog._showExportProfile
        try:
            etypeProfile = Serialization.serFromXmlUnicode(
                xmlNode, u"exportTypeName")

            try:
                exporter, etype, desc, panel = PluginManager.getSupportedExportTypes(
                    pWiki, None, continuousExport)[etypeProfile]
            except KeyError:
                self.showCmdLineUsage(
                    pWiki,
                    _(u"Export type '%s' of saved export is not supported") %
                    etypeProfile + u"\n\n")
                return

            addOptXml = Serialization.findXmlElementFlat(
                xmlNode, u"additionalOptions")

            addOptVersion = int(addOptXml.getAttribute(u"version"))

            if addOptVersion != exporter.getAddOptVersion():
                self.showCmdLineUsage(
                    pWiki,
                    _(u"Saved export uses different version for additional "
                      "options than current export\nExport type: '%s'\n"
                      "Saved export version: %i\nCurrent export version: %i") %
                    (etypeProfile, addOptVersion, exporter.getAddOptVersion())
                    + u"\n\n")
                return

            if addOptXml.getAttribute(u"type") != u"simpleTuple":
                self.showCmdLineUsage(
                    pWiki,
                    _(u"Type of additional option storage ('%s') is unknown") %
                    addOptXml.getAttribute(u"type") + u"\n\n")
                return

            pageSetXml = Serialization.findXmlElementFlat(xmlNode, u"pageSet")

            sarOp = SearchAndReplace.SearchReplaceOperation()
            sarOp.serializeFromXml(pageSetXml)

            addOpt = Serialization.convertTupleFromXml(addOptXml)

            #                 self.ctrls.chSelectedSet.SetSelection(3)
            #                 self.ctrls.chExportTo.SetSelection(sel)
            #                 exporter.setAddOpt(addOpt, panel)

            exportDest = Serialization.serFromXmlUnicode(
                xmlNode, u"destinationPath")

#                 self._refreshForEtype()

        except SerializationException, e:
            self.showCmdLineUsage(
                pWiki,
                _(u"Error during retrieving "
                  "saved export: ") + e.message + u"\n\n")