eric7/Preferences/ConfigurationPages/EditorHighlightingStylesPage.py

branch
eric7
changeset 8351
7d13e08ddb3f
parent 8322
b422b4e77d19
child 8356
68ec9c3d4de5
--- a/eric7/Preferences/ConfigurationPages/EditorHighlightingStylesPage.py	Fri May 21 20:14:48 2021 +0200
+++ b/eric7/Preferences/ConfigurationPages/EditorHighlightingStylesPage.py	Sat May 22 11:14:43 2021 +0200
@@ -546,8 +546,7 @@
             self,
             self.tr("Export Highlighting Styles"),
             stylesDir,
-            self.tr("Highlighting Styles File (*.ehj);;"
-                    "XML Highlighting Styles File (*.e6h)"),
+            self.tr("Highlighting Styles File (*.ehj)"),
             "",
             E5FileDialog.DontConfirmOverwrite)
         
@@ -571,28 +570,10 @@
         )
         
         if ok:
-            if fn.endswith(".ehj"):
-                from Preferences.HighlightingStylesFile import (
-                    HighlightingStylesFile
-                )
-                highlightingStylesFile = HighlightingStylesFile()
-                highlightingStylesFile.writeFile(fn, lexers)
-            else:
-                f = QFile(fn)
-                if f.open(QIODevice.OpenModeFlag.WriteOnly):
-                    from E5XML.HighlightingStylesWriter import (
-                        HighlightingStylesWriter
-                    )
-                    HighlightingStylesWriter(f, lexers).writeXML()
-                    f.close()
-                else:
-                    E5MessageBox.critical(
-                        self,
-                        self.tr("Export Highlighting Styles"),
-                        self.tr("<p>The highlighting styles file <b>{0}</b>"
-                                " could not be written.</p><p>Reason: {1}</p>")
-                        .format(fn, f.errorString())
-                    )
+            from Preferences.HighlightingStylesFile import (HighlightingStylesFile
+            )
+            highlightingStylesFile = HighlightingStylesFile()
+            highlightingStylesFile.writeFile(fn, lexers)
     
     def __importStyles(self, importAll=False):
         """
@@ -628,7 +609,7 @@
             # old XML based file
             f = QFile(fn)
             if f.open(QIODevice.OpenModeFlag.ReadOnly):
-                from E5XML.HighlightingStylesReader import (
+                from EricXML.HighlightingStylesReader import (
                     HighlightingStylesReader
                 )
                 reader = HighlightingStylesReader(f, self.lexers)

eric ide

mercurial