def writeXML(self):
     """
     Public method to write the XML to the file.
     """
     XMLWriterBase.writeXML(self)
     
     self._write('<!DOCTYPE UserProject SYSTEM "UserProject-%s.dtd">' % \
         userProjectFileFormatVersion)
     
     # add some generation comments
     self._write("<!-- eric4 user project file for project %s -->" % self.name)
     if Preferences.getProject("XMLTimestamp"):
         self._write("<!-- Saved: %s -->" % time.strftime('%Y-%m-%d, %H:%M:%S'))
         self._write("<!-- Copyright (C) %s %s, %s -->" % \
                 (time.strftime('%Y'), 
                  self.escape(self.pdata["AUTHOR"][0]), 
                  self.escape(self.pdata["EMAIL"][0])))
     
     # add the main tag
     self._write('<UserProject version="%s">' % userProjectFileFormatVersion)
     
     # do the vcs override stuff
     if self.pudata["VCSOVERRIDE"]:
         self._write("  <VcsType>%s</VcsType>" % self.pudata["VCSOVERRIDE"][0])
     if self.pudata["VCSSTATUSMONITORINTERVAL"]:
         self._write('  <VcsStatusMonitorInterval value="%d" />' % \
             self.pudata["VCSSTATUSMONITORINTERVAL"][0])
     
     self._write("</UserProject>", newline = False)
 def writeXML(self):
     """
     Public method to write the XML to the file.
     """
     XMLWriterBase.writeXML(self)
     
     self._write('<!DOCTYPE HighlightingStyles SYSTEM "HighlightingStyles-%s.dtd">' % \
         highlightingStylesFileFormatVersion)
     
     # add some generation comments
     self._write("<!-- Eric4 highlighting styles -->")
     self._write("<!-- Saved: %s -->" % time.strftime('%Y-%m-%d, %H:%M:%S'))
     self._write("<!-- Author: %s -->" % self.escape("%s" % self.email))
     
     # add the main tag
     self._write('<HighlightingStyles version="%s">' % \
         highlightingStylesFileFormatVersion)
     
     for lexer in self.lexers:
         self._write('  <Lexer name="%s">' % lexer.language())
         for style in lexer.descriptions:
             self._write('    <Style style="%d" '
                         'color="%s" paper="%s" font="%s" eolfill="%d">%s</Style>' % \
                         (style, lexer.color(style).name(), lexer.paper(style).name(), 
                          lexer.font(style).toString(), lexer.eolFill(style), 
                          self.escape(lexer.description(style)))
             )
         self._write('  </Lexer>')
     
     self._write("</HighlightingStyles>", newline = False)
Beispiel #3
0
    def __init__(self, file):
        """
        Constructor
        
        @param file open file (like) object for writing
        """
        XMLWriterBase.__init__(self, file)

        self.email = Preferences.getUser("Email")
 def writeXML(self):
     """
     Public method to write the XML to the file.
     """
     XMLWriterBase.writeXML(self)
     
     self._write('<!DOCTYPE DebuggerProperties SYSTEM "DebuggerProperties-%s.dtd">' % \
         debuggerPropertiesFileFormatVersion)
     
     # add some generation comments
     self._write("<!-- eric4 debugger properties file for project %s -->" % self.name)
     self._write("<!-- This file was generated automatically, do not edit. -->")
     if Preferences.getProject("XMLTimestamp"):
         self._write("<!-- Saved: %s -->" % time.strftime('%Y-%m-%d, %H:%M:%S'))
     
     # add the main tag
     self._write('<DebuggerProperties version="%s">' % \
         debuggerPropertiesFileFormatVersion) 
     
     self._write('  <Interpreter>%s</Interpreter>' % \
         self.project.debugProperties["INTERPRETER"])
     
     self._write('  <DebugClient>%s</DebugClient>' % \
         self.project.debugProperties["DEBUGCLIENT"])
     
     self._write('  <Environment override="%d">%s</Environment>' % \
         (self.project.debugProperties["ENVIRONMENTOVERRIDE"],
          self.escape(self.project.debugProperties["ENVIRONMENTSTRING"])))
     
     self._write('  <RemoteDebugger on="%d">' % \
         self.project.debugProperties["REMOTEDEBUGGER"])
     self._write('    <RemoteHost>%s</RemoteHost>' % \
         self.project.debugProperties["REMOTEHOST"])
     self._write('    <RemoteCommand>%s</RemoteCommand>' % \
         self.escape(self.project.debugProperties["REMOTECOMMAND"]))
     self._write('  </RemoteDebugger>')
     
     self._write('  <PathTranslation on="%d">' % \
         self.project.debugProperties["PATHTRANSLATION"])
     self._write('    <RemotePath>%s</RemotePath>' % \
         self.project.debugProperties["REMOTEPATH"])
     self._write('    <LocalPath>%s</LocalPath>' % \
         self.project.debugProperties["LOCALPATH"])
     self._write('  </PathTranslation>')
     
     self._write('  <ConsoleDebugger on="%d">%s</ConsoleDebugger>' % \
         (self.project.debugProperties["CONSOLEDEBUGGER"],
          self.escape(self.project.debugProperties["CONSOLECOMMAND"])))
     
     self._write('  <Redirect on="%d" />' % \
         self.project.debugProperties["REDIRECT"])
     
     self._write('  <Noencoding on="%d" />' % \
         self.project.debugProperties["NOENCODING"])
     
     self._write("</DebuggerProperties>", newline = False)
 def __init__(self, file, lexers):
     """
     Constructor
     
     @param file open file (like) object for writing
     @param lexers list of lexer objects for which to export the styles
     """
     XMLWriterBase.__init__(self, file)
     
     self.lexers = lexers
     self.email = Preferences.getUser("Email")
 def __init__(self, file, projectName):
     """
     Constructor
     
     @param file open file (like) object for writing
     @param projectName name of the project (string)
     """
     XMLWriterBase.__init__(self, file)
     
     self.pdata = e4App().getObject("Project").pdata
     self.name = projectName
 def __init__(self, multiProject, file, multiProjectName):
     """
     Constructor
     
     @param multiProject Reference to the multi project object
     @param file open file (like) object for writing
     @param projectName name of the project (string)
     """
     XMLWriterBase.__init__(self, file)
     
     self.name = multiProjectName
     self.multiProject = multiProject
 def __init__(self, file, forProject = False, projectName=""):
     """
     Constructor
     
     @param file open file (like) object for writing
     @param forProject flag indicating project related mode (boolean)
     @param projectName name of the project (string)
     """
     XMLWriterBase.__init__(self, file)
     
     self.name = projectName
     self.forProject = forProject
 def __init__(self, file, projectName):
     """
     Constructor
     
     @param file open file (like) object for writing
     @param projectName name of the project (string) or None for the
         global session
     """
     XMLWriterBase.__init__(self, file)
     
     self.name = projectName
     self.project = e4App().getObject("Project")
     self.multiProject = e4App().getObject("MultiProject")
     self.vm = e4App().getObject("ViewManager")
     self.dbg = e4App().getObject("DebugUI")
     self.dbs = e4App().getObject("DebugServer")
 def writeXML(self):
     """
     Public method to write the XML to the file.
     """
     XMLWriterBase.writeXML(self)
     
     self._write('<!DOCTYPE Tasks SYSTEM "Tasks-%s.dtd">' % tasksFileFormatVersion)
     
     # add some generation comments
     if self.forProject:
         self._write("<!-- eric4 tasks file for project %s -->" % self.name)
         if Preferences.getProject("XMLTimestamp"):
             self._write("<!-- Saved: %s -->" % time.strftime('%Y-%m-%d, %H:%M:%S'))
     else:
         self._write("<!-- eric4 tasks file -->")
         self._write("<!-- Saved: %s -->" % time.strftime('%Y-%m-%d, %H:%M:%S'))
     
     # add the main tag
     self._write('<Tasks version="%s">' % tasksFileFormatVersion)
     
     # do the tasks
     if self.forProject:
         tasks = e4App().getObject("TaskViewer").getProjectTasks()
     else:
         tasks = e4App().getObject("TaskViewer").getGlobalTasks()
     for task in tasks:
         self._write('  <Task priority="%d" completed="%s" bugfix="%s">' % \
                     (task.priority, task.completed, task.isBugfixTask))
         self._write('    <Summary>%s</Summary>' % \
                     self.escape("%s" % task.description.strip()))
         self._write('    <Description>%s</Description>' % \
                     self.escape(self.encodedNewLines(task.longtext.strip())))
         self._write('    <Created>%s</Created>' % \
                     time.strftime("%Y-%m-%d, %H:%M:%S", time.localtime(task.created)))
         if task.filename:
             self._write('    <Resource>')
             self._write('      <Filename>%s</Filename>' % \
                 Utilities.fromNativeSeparators(task.filename))
             self._write('      <Linenumber>%d</Linenumber>' % task.lineno)
             self._write('    </Resource>')
         self._write('  </Task>')
     
     self._write('</Tasks>', newline = False)
 def writeXML(self):
     """
     Public method to write the XML to the file.
     """
     XMLWriterBase.writeXML(self)
     
     self._write('<!DOCTYPE MultiProject SYSTEM "MultiProject-%s.dtd">' % \
         multiProjectFileFormatVersion)
     
     # add some generation comments
     self._write("<!-- eric4 multi project file for multi project %s -->" % self.name)
     if Preferences.getMultiProject("XMLTimestamp"):
         self._write("<!-- Saved: %s -->" % time.strftime('%Y-%m-%d, %H:%M:%S'))
         self._write("<!-- Copyright (C) %s -->" % time.strftime('%Y'))
     
     # add the main tag
     self._write('<MultiProject version="%s">' % multiProjectFileFormatVersion)
     
     # do description
     self._write("  <Description>%s</Description>" % \
         self.escape(self.encodedNewLines(self.multiProject.description)))
     
     # do the projects
     self._write("  <Projects>")
     for project in self.multiProject.getProjects():
         self._write('    <Project isMaster="%s">' % project['master'])
         self._write("      <ProjectName>%s</ProjectName>" % \
             self.escape(project['name']))
         self._write("      <ProjectFile>%s</ProjectFile>" % \
             Utilities.fromNativeSeparators(project['file']))
         self._write("      <ProjectDescription>%s</ProjectDescription>" % \
             self.escape(self.encodedNewLines(project['description'])))
         self._write("    </Project>")
     self._write("  </Projects>")
     
     self._write("</MultiProject>", newline = False)
 def writeXML(self):
     """
     Public method to write the XML to the file.
     """
     isGlobal = self.name is None
     
     XMLWriterBase.writeXML(self)
     
     self._write('<!DOCTYPE Session SYSTEM "Session-%s.dtd">' % \
         sessionFileFormatVersion)
     
     # add some generation comments
     if not isGlobal:
         self._write("<!-- eric4 session file for project %s -->" % self.name)
     self._write("<!-- This file was generated automatically, do not edit. -->")
     if Preferences.getProject("XMLTimestamp") or isGlobal:
         self._write("<!-- Saved: %s -->" % time.strftime('%Y-%m-%d, %H:%M:%S'))
     
     # add the main tag
     self._write('<Session version="%s">' % sessionFileFormatVersion) 
     
     # step 0: save open multi project and project for the global session
     if isGlobal:
         if self.multiProject.isOpen():
             self._write('    <MultiProject>%s</MultiProject>' % \
                 self.multiProject.getMultiProjectFile())
         if self.project.isOpen():
             self._write('    <Project>%s</Project>' % \
                 self.project.getProjectFile())
     
     # step 1: save all open (project) filenames and the active window
     allOpenFiles = self.vm.getOpenFilenames()
     self._write("  <Filenames>")
     for of in allOpenFiles:
         if isGlobal or unicode(of).startswith(self.project.ppath):
             ed = self.vm.getOpenEditor(of)
             if ed is not None:
                 line, index = ed.getCursorPosition()
                 folds = ','.join([str(i + 1) for i in ed.getFolds()])
                 zoom = ed.getZoom()
             else:
                 line, index = 0, 0
                 folds = ''
                 zoom = -9999
             self._write('    <Filename cline="%d" cindex="%d" folds="%s" zoom="%d">'
                         '%s</Filename>' % \
                 (line, index, folds, zoom, of))
     self._write("  </Filenames>")
     
     aw = self.vm.getActiveName()
     if aw and unicode(aw).startswith(self.project.ppath):
         ed = self.vm.getOpenEditor(aw)
         if ed is not None:
             line, index = ed.getCursorPosition()
         else:
             line, index = 0, 0
         self._write('  <ActiveWindow cline="%d" cindex="%d">%s</ActiveWindow>' % \
             (line, index, aw))
     
     # step 2a: save all breakpoints
     allBreaks = Preferences.getProject("SessionAllBreakpoints")
     projectFiles = self.project.getSources(True)
     bpModel = self.dbs.getBreakPointModel()
     self._write("  <Breakpoints>")
     for row in range(bpModel.rowCount()):
         index = bpModel.index(row, 0)
         fname, lineno, cond, temp, enabled, count = \
             bpModel.getBreakPointByIndex(index)[:6]
         if isGlobal or allBreaks or fname in projectFiles:
             self._write("    <Breakpoint>")
             self._write("      <BpFilename>%s</BpFilename>" % fname)
             self._write('      <Linenumber value="%d" />' % lineno)
             self._write("      <Condition>%s</Condition>" % self.escape(str(cond)))
             self._write('      <Temporary value="%s" />' % temp)
             self._write('      <Enabled value="%s" />' % enabled)
             self._write('      <Count value="%d" />' % count)
             self._write("    </Breakpoint>")
     self._write("  </Breakpoints>")
     
     # step 2b: save all watch expressions
     self._write("  <Watchexpressions>")
     wpModel = self.dbs.getWatchPointModel()
     for row in range(wpModel.rowCount()):
         index = wpModel.index(row, 0)
         cond, temp, enabled, count, special = wpModel.getWatchPointByIndex(index)[:5]
         self._write('    <Watchexpression>')
         self._write("      <Condition>%s</Condition>" % self.escape(str(cond)))
         self._write('      <Temporary value="%s" />' % temp)
         self._write('      <Enabled value="%s" />' % enabled)
         self._write('      <Count value="%d" />' % count)
         self._write('      <Special>%s</Special>' % special)
         self._write('    </Watchexpression>')
     self._write('  </Watchexpressions>')
     
     # step 3: save the debug info
     self._write("  <DebugInfo>")
     if isGlobal:
         if len(self.dbg.argvHistory):
             dbgCmdline = str(self.dbg.argvHistory[0])
         else:
             dbgCmdline = ""
         if len(self.dbg.wdHistory):
             dbgWd = self.dbg.wdHistory[0]
         else:
             dbgWd = ""
         if len(self.dbg.envHistory):
             dbgEnv = self.dbg.envHistory[0]
         else:
             dbgEnv = ""
         self._write("    <CommandLine>%s</CommandLine>" % self.escape(dbgCmdline))
         self._write("    <WorkingDirectory>%s</WorkingDirectory>" % dbgWd)
         self._write("    <Environment>%s</Environment>" % dbgEnv)
         self._write('    <ReportExceptions value="%s" />' % self.dbg.exceptions)
         self._write("    <Exceptions>")
         for exc in self.dbg.excList:
             self._write("      <Exception>%s</Exception>" % exc)
         self._write("    </Exceptions>")
         self._write("    <IgnoredExceptions>")
         for iexc in self.dbg.excIgnoreList:
             self._write("      <IgnoredException>%s</IgnoredException>" % iexc)
         self._write("    </IgnoredExceptions>")
         self._write('    <AutoClearShell value="%s" />' % self.dbg.autoClearShell)
         self._write('    <TracePython value="%s" />' % self.dbg.tracePython)
         self._write('    <AutoContinue value="%s" />' % self.dbg.autoContinue)
         self._write("    <CovexcPattern></CovexcPattern>")  # kept for compatibility
     else:
         self._write("    <CommandLine>%s</CommandLine>" % \
             self.escape(str(self.project.dbgCmdline)))
         self._write("    <WorkingDirectory>%s</WorkingDirectory>" % \
             self.project.dbgWd)
         self._write("    <Environment>%s</Environment>" % \
             self.project.dbgEnv)
         self._write('    <ReportExceptions value="%s" />' % \
             self.project.dbgReportExceptions)
         self._write("    <Exceptions>")
         for exc in self.project.dbgExcList:
             self._write("      <Exception>%s</Exception>" % exc)
         self._write("    </Exceptions>")
         self._write("    <IgnoredExceptions>")
         for iexc in self.project.dbgExcIgnoreList:
             self._write("      <IgnoredException>%s</IgnoredException>" % iexc)
         self._write("    </IgnoredExceptions>")
         self._write('    <AutoClearShell value="%s" />' % \
             self.project.dbgAutoClearShell)
         self._write('    <TracePython value="%s" />' % \
             self.project.dbgTracePython)
         self._write('    <AutoContinue value="%s" />' % \
             self.project.dbgAutoContinue)
         self._write("    <CovexcPattern></CovexcPattern>")  # kept for compatibility
     self._write("  </DebugInfo>")
     
     # step 4: save bookmarks of all open (project) files
     self._write("  <Bookmarks>")
     for of in allOpenFiles:
         if isGlobal or unicode(of).startswith(self.project.ppath):
             editor = self.vm.getOpenEditor(of)
             for bookmark in editor.getBookmarks():
                 self._write("    <Bookmark>")
                 self._write("      <BmFilename>%s</BmFilename>" % of)
                 self._write('      <Linenumber value="%d" />' % bookmark)
                 self._write("    </Bookmark>")
     self._write("  </Bookmarks>")
     
     self._write("</Session>", newline = False)
 def writeXML(self):
     """
     Public method to write the XML to the file.
     """
     XMLWriterBase.writeXML(self)
     
     self._write('<!DOCTYPE Project SYSTEM "Project-%s.dtd">' % \
         projectFileFormatVersion)
     
     # add some generation comments
     self._write("<!-- eric4 project file for project %s -->" % self.name)
     if Preferences.getProject("XMLTimestamp"):
         self._write("<!-- Saved: %s -->" % time.strftime('%Y-%m-%d, %H:%M:%S'))
         self._write("<!-- Copyright (C) %s %s, %s -->" % \
                 (time.strftime('%Y'), 
                  self.escape(self.pdata["AUTHOR"][0]), 
                  self.escape(self.pdata["EMAIL"][0])))
     
     # add the main tag
     self._write('<Project version="%s">' % projectFileFormatVersion)
     
     # do the language (used for spell checking)
     self._write('  <Language>%s</Language>' % self.pdata["SPELLLANGUAGE"][0])
     if len(self.pdata["SPELLWORDS"][0]) > 0:
         self._write("  <ProjectWordList>%s</ProjectWordList>" % \
             Utilities.fromNativeSeparators(self.pdata["SPELLWORDS"][0]))
     if len(self.pdata["SPELLEXCLUDES"][0]) > 0:
         self._write("  <ProjectExcludeList>%s</ProjectExcludeList>" % \
             Utilities.fromNativeSeparators(self.pdata["SPELLEXCLUDES"][0]))
     
     # do the programming language
     self._write('  <ProgLanguage mixed="%d">%s</ProgLanguage>' % \
         (self.pdata["MIXEDLANGUAGE"][0], self.pdata["PROGLANGUAGE"][0]))
     
     # do the UI type
     self._write('  <ProjectType>%s</ProjectType>' % self.pdata["PROJECTTYPE"][0])
     
     # do description
     if self.pdata["DESCRIPTION"]:
         self._write("  <Description>%s</Description>" % \
             self.escape(self.encodedNewLines(self.pdata["DESCRIPTION"][0])))
     
     # do version, author and email
     for key in ["VERSION", "AUTHOR", "EMAIL"]:
         element = key.capitalize()
         if self.pdata[key]:
             self._write("  <%s>%s</%s>" % \
                 (element, self.escape(self.pdata[key][0]), element))
         
     # do the translation pattern
     if self.pdata["TRANSLATIONPATTERN"]:
         self._write("  <TranslationPattern>%s</TranslationPattern>" % \
             Utilities.fromNativeSeparators(self.pdata["TRANSLATIONPATTERN"][0]))
     
     # do the binary translations path
     if self.pdata["TRANSLATIONSBINPATH"]:
         self._write("  <TranslationsBinPath>%s</TranslationsBinPath>" % \
             Utilities.fromNativeSeparators(self.pdata["TRANSLATIONSBINPATH"][0]))
     
     # do the sources
     self._write("  <Sources>")
     for name in self.pdata["SOURCES"]:
         self._write("    <Source>%s</Source>" % \
             Utilities.fromNativeSeparators(name))
     self._write("  </Sources>")
     
     # do the forms
     self._write("  <Forms>")
     for name in self.pdata["FORMS"]:
         self._write("    <Form>%s</Form>" % \
             Utilities.fromNativeSeparators(name))
     self._write("  </Forms>")
     
     # do the translations
     self._write("  <Translations>")
     for name in self.pdata["TRANSLATIONS"]:
         self._write("    <Translation>%s</Translation>" % \
             Utilities.fromNativeSeparators(name))
     self._write("  </Translations>")
     
     # do the translation exceptions
     if self.pdata["TRANSLATIONEXCEPTIONS"]:
         self._write("  <TranslationExceptions>")
         for name in self.pdata["TRANSLATIONEXCEPTIONS"]:
             self._write("    <TranslationException>%s</TranslationException>" % \
                 Utilities.fromNativeSeparators(name))
         self._write("  </TranslationExceptions>")
     
     # do the resources
     self._write("  <Resources>")
     for name in self.pdata["RESOURCES"]:
         self._write("    <Resource>%s</Resource>" % \
             Utilities.fromNativeSeparators(name))
     self._write("  </Resources>")
     
     # do the interfaces (IDL)
     self._write("  <Interfaces>")
     for name in self.pdata["INTERFACES"]:
         self._write("    <Interface>%s</Interface>" % \
             Utilities.fromNativeSeparators(name))
     self._write("  </Interfaces>")
     
     # do the others
     self._write("  <Others>")
     for name in self.pdata["OTHERS"]:
         self._write("    <Other>%s</Other>" % \
             Utilities.fromNativeSeparators(name))
     self._write("  </Others>")
     
     # do the main script
     if self.pdata["MAINSCRIPT"]:
         self._write("  <MainScript>%s</MainScript>" % \
             Utilities.fromNativeSeparators(self.pdata["MAINSCRIPT"][0]))
     
     # do the vcs stuff
     self._write("  <Vcs>")
     if self.pdata["VCS"]:
         self._write("    <VcsType>%s</VcsType>" % self.pdata["VCS"][0])
     if self.pdata["VCSOPTIONS"]:
         self._write("    <VcsOptions>")
         self._writeBasics(self.pdata["VCSOPTIONS"][0], 3)
         self._write("    </VcsOptions>")
     if self.pdata["VCSOTHERDATA"]:
         self._write("    <VcsOtherData>")
         self._writeBasics(self.pdata["VCSOTHERDATA"][0], 3)
         self._write("    </VcsOtherData>")
     self._write("  </Vcs>")
     
     # do the filetype associations
     self._write("  <FiletypeAssociations>")
     for pattern, filetype in self.pdata["FILETYPES"].items():
         self._write('    <FiletypeAssociation pattern="%s" type="%s" />' % \
             (pattern, filetype))
     self._write("  </FiletypeAssociations>")
     
     # do the lexer associations
     if self.pdata["LEXERASSOCS"]:
         self._write("  <LexerAssociations>")
         for pattern, lexer in self.pdata["LEXERASSOCS"].items():
             self._write('    <LexerAssociation pattern="%s" lexer="%s" />' % \
                 (pattern, lexer))
         self._write("  </LexerAssociations>")
     
     # do the extra project data stuff
     if len(self.pdata["PROJECTTYPESPECIFICDATA"]):
         self._write("  <ProjectTypeSpecific>")
         if self.pdata["PROJECTTYPESPECIFICDATA"]:
             self._write("    <ProjectTypeSpecificData>")
             self._writeBasics(self.pdata["PROJECTTYPESPECIFICDATA"], 3)
             self._write("    </ProjectTypeSpecificData>")
         self._write("  </ProjectTypeSpecific>")
     
     # do the documentation generators stuff
     if len(self.pdata["DOCUMENTATIONPARMS"]):
         self._write("  <Documentation>")
         if self.pdata["DOCUMENTATIONPARMS"]:
             self._write("    <DocumentationParams>")
             self._writeBasics(self.pdata["DOCUMENTATIONPARMS"], 3)
             self._write("    </DocumentationParams>")
         self._write("  </Documentation>")
     
     # do the packagers stuff
     if len(self.pdata["PACKAGERSPARMS"]):
         self._write("  <Packagers>")
         if self.pdata["PACKAGERSPARMS"]:
             self._write("    <PackagersParams>")
             self._writeBasics(self.pdata["PACKAGERSPARMS"], 3)
             self._write("    </PackagersParams>")
         self._write("  </Packagers>")
     
     # do the checkers stuff
     if len(self.pdata["CHECKERSPARMS"]):
         self._write("  <Checkers>")
         if self.pdata["CHECKERSPARMS"]:
             self._write("    <CheckersParams>")
             self._writeBasics(self.pdata["CHECKERSPARMS"], 3)
             self._write("    </CheckersParams>")
         self._write("  </Checkers>")
     
     # do the other tools stuff
     if len(self.pdata["OTHERTOOLSPARMS"]):
         self._write("  <OtherTools>")
         if self.pdata["OTHERTOOLSPARMS"]:
             self._write("    <OtherToolsParams>")
             self._writeBasics(self.pdata["OTHERTOOLSPARMS"], 3)
             self._write("    </OtherToolsParams>")
         self._write("  </OtherTools>")
     
     self._write("</Project>", newline = False)
Beispiel #14
0
    def writeXML(self):
        """
        Public method to write the XML to the file.
        """
        XMLWriterBase.writeXML(self)

        self._write('<!DOCTYPE Shortcuts SYSTEM "Shortcuts-%s.dtd">' % shortcutsFileFormatVersion)

        # add some generation comments
        self._write("<!-- Eric4 keyboard shortcuts -->")
        self._write("<!-- Saved: %s -->" % time.strftime("%Y-%m-%d, %H:%M:%S"))
        self._write("<!-- Author: %s -->" % self.escape("%s" % self.email))

        # add the main tag
        self._write('<Shortcuts version="%s">' % shortcutsFileFormatVersion)

        for act in e4App().getObject("Project").getActions():
            self._write('  <Shortcut category="Project">')
            self._write("    <Name>%s</Name>" % act.objectName())
            self._write("    <Accel>%s</Accel>" % self.escape("%s" % act.shortcut().toString()))
            self._write("    <AltAccel>%s</AltAccel>" % self.escape("%s" % act.alternateShortcut().toString()))
            self._write("  </Shortcut>")

        for act in e4App().getObject("UserInterface").getActions("ui"):
            self._write('  <Shortcut category="General">')
            self._write("    <Name>%s</Name>" % act.objectName())
            self._write("    <Accel>%s</Accel>" % self.escape("%s" % act.shortcut().toString()))
            self._write("    <AltAccel>%s</AltAccel>" % self.escape("%s" % act.alternateShortcut().toString()))
            self._write("  </Shortcut>")

        for act in e4App().getObject("UserInterface").getActions("wizards"):
            self._write('  <Shortcut category="Wizards">')
            self._write("    <Name>%s</Name>" % act.objectName())
            self._write("    <Accel>%s</Accel>" % self.escape("%s" % act.shortcut().toString()))
            self._write("    <AltAccel>%s</AltAccel>" % self.escape("%s" % act.alternateShortcut().toString()))
            self._write("  </Shortcut>")

        for act in e4App().getObject("DebugUI").getActions():
            self._write('  <Shortcut category="Debug">')
            self._write("    <Name>%s</Name>" % act.objectName())
            self._write("    <Accel>%s</Accel>" % self.escape("%s" % act.shortcut().toString()))
            self._write("    <AltAccel>%s</AltAccel>" % self.escape("%s" % act.alternateShortcut().toString()))
            self._write("  </Shortcut>")

        for act in e4App().getObject("ViewManager").getActions("edit"):
            self._write('  <Shortcut category="Edit">')
            self._write("    <Name>%s</Name>" % act.objectName())
            self._write("    <Accel>%s</Accel>" % self.escape("%s" % act.shortcut().toString()))
            self._write("    <AltAccel>%s</AltAccel>" % self.escape("%s" % act.alternateShortcut().toString()))
            self._write("  </Shortcut>")

        for act in e4App().getObject("ViewManager").getActions("file"):
            self._write('  <Shortcut category="File">')
            self._write("    <Name>%s</Name>" % act.objectName())
            self._write("    <Accel>%s</Accel>" % self.escape("%s" % act.shortcut().toString()))
            self._write("    <AltAccel>%s</AltAccel>" % self.escape("%s" % act.alternateShortcut().toString()))
            self._write("  </Shortcut>")

        for act in e4App().getObject("ViewManager").getActions("search"):
            self._write('  <Shortcut category="Search">')
            self._write("    <Name>%s</Name>" % act.objectName())
            self._write("    <Accel>%s</Accel>" % self.escape("%s" % act.shortcut().toString()))
            self._write("    <AltAccel>%s</AltAccel>" % self.escape("%s" % act.alternateShortcut().toString()))
            self._write("  </Shortcut>")

        for act in e4App().getObject("ViewManager").getActions("view"):
            self._write('  <Shortcut category="View">')
            self._write("    <Name>%s</Name>" % act.objectName())
            self._write("    <Accel>%s</Accel>" % self.escape("%s" % act.shortcut().toString()))
            self._write("    <AltAccel>%s</AltAccel>" % self.escape("%s" % act.alternateShortcut().toString()))
            self._write("  </Shortcut>")

        for act in e4App().getObject("ViewManager").getActions("macro"):
            self._write('  <Shortcut category="Macro">')
            self._write("    <Name>%s</Name>" % act.objectName())
            self._write("    <Accel>%s</Accel>" % self.escape("%s" % act.shortcut().toString()))
            self._write("    <AltAccel>%s</AltAccel>" % self.escape("%s" % act.alternateShortcut().toString()))
            self._write("  </Shortcut>")

        for act in e4App().getObject("ViewManager").getActions("bookmark"):
            self._write('  <Shortcut category="Bookmarks">')
            self._write("    <Name>%s</Name>" % act.objectName())
            self._write("    <Accel>%s</Accel>" % self.escape("%s" % act.shortcut().toString()))
            self._write("    <AltAccel>%s</AltAccel>" % self.escape("%s" % act.alternateShortcut().toString()))
            self._write("  </Shortcut>")

        for act in e4App().getObject("ViewManager").getActions("spelling"):
            self._write('  <Shortcut category="Spelling">')
            self._write("    <Name>%s</Name>" % act.objectName())
            self._write("    <Accel>%s</Accel>" % self.escape("%s" % act.shortcut().toString()))
            self._write("    <AltAccel>%s</AltAccel>" % self.escape("%s" % act.alternateShortcut().toString()))
            self._write("  </Shortcut>")

        actions = e4App().getObject("ViewManager").getActions("window")
        for act in actions:
            self._write('  <Shortcut category="Window">')
            self._write("    <Name>%s</Name>" % act.objectName())
            self._write("    <Accel>%s</Accel>" % self.escape("%s" % act.shortcut().toString()))
            self._write("    <AltAccel>%s</AltAccel>" % self.escape("%s" % act.alternateShortcut().toString()))
            self._write("  </Shortcut>")

        for category, ref in e4App().getPluginObjects():
            if hasattr(ref, "getActions"):
                actions = ref.getActions()
                for act in actions:
                    if not act.objectName().isEmpty():
                        # shortcuts are only exported, if their objectName is set
                        self._write('  <Shortcut category="%s">' % category)
                        self._write("    <Name>%s</Name>" % act.objectName())
                        self._write("    <Accel>%s</Accel>" % self.escape("%s" % act.shortcut().toString()))
                        self._write(
                            "    <AltAccel>%s</AltAccel>" % self.escape("%s" % act.alternateShortcut().toString())
                        )
                        self._write("  </Shortcut>")

        for act in e4App().getObject("DummyHelpViewer").getActions():
            self._write('  <Shortcut category="HelpViewer">')
            self._write("    <Name>%s</Name>" % act.objectName())
            self._write("    <Accel>%s</Accel>" % self.escape("%s" % act.shortcut().toString()))
            self._write("    <AltAccel>%s</AltAccel>" % self.escape("%s" % act.alternateShortcut().toString()))
            self._write("  </Shortcut>")

        # add the main end tag
        self._write("</Shortcuts>", newline=False)