src/eric7/Utilities/MimeTypes.py

branch
eric7
changeset 10929
edfd452bb9be
parent 10439
21c28b0f9e41
child 11090
f5f5f5803935
--- a/src/eric7/Utilities/MimeTypes.py	Thu Sep 26 15:49:36 2024 +0200
+++ b/src/eric7/Utilities/MimeTypes.py	Fri Sep 27 09:48:07 2024 +0200
@@ -33,34 +33,40 @@
                 fnmatch.fnmatch(filename, pat)
                 for pat in Preferences.getUI("TextFilePatterns")
             )
-            or EricMessageBox.yesNo(
-                None,
-                QCoreApplication.translate("MimeTypes", "Open File"),
-                QCoreApplication.translate(
-                    "MimeTypes",
-                    "<p>Is the file <b>{0}</b> a text file to be opened in eric?</p>"
-                    "<p><b>Note:</b> You may suppress this question by adding a pattern"
-                    " to the list of known text files on the <b>MimeTypes</b>"
-                    " configuration page.</p>",
-                ).format(filename),
+            or (
+                Preferences.getUI("TextMimeTypesAskUser")
+                and EricMessageBox.yesNo(
+                    None,
+                    QCoreApplication.translate("MimeTypes", "Open File"),
+                    QCoreApplication.translate(
+                        "MimeTypes",
+                        "<p>Is the file <b>{0}</b> a text file to be opened in eric?"
+                        "</p><p><b>Note:</b> You may suppress this question by adding"
+                        " a pattern to the list of known text files on the"
+                        " <b>MimeTypes</b> configuration page.</p>",
+                    ).format(filename),
+                )
             )
         )
     else:
         return (
             mimetype.split("/")[0] == "text"
             or mimetype in Preferences.getUI("TextMimeTypes")
-            or EricMessageBox.yesNo(
-                None,
-                QCoreApplication.translate("MimeTypes", "Open File"),
-                QCoreApplication.translate(
-                    "MimeTypes",
-                    "<p>The file <b>{0}</b> has the mime type <b>{1}</b>. This type"
-                    " is not recognized as being text to be opened in eric. Is this"
-                    " an editable text file?</p>"
-                    "<p><b>Note:</b> You may suppress this question by adding an"
-                    " entry to the list of known text file types on the"
-                    " <b>MimeTypes</b> configuration page.</p>",
-                ).format(filename, mimetype),
+            or (
+                Preferences.getUI("TextMimeTypesAskUser")
+                and EricMessageBox.yesNo(
+                    None,
+                    QCoreApplication.translate("MimeTypes", "Open File"),
+                    QCoreApplication.translate(
+                        "MimeTypes",
+                        "<p>The file <b>{0}</b> has the mime type <b>{1}</b>. This type"
+                        " is not recognized as being text to be opened in eric. Is this"
+                        " an editable text file?</p>"
+                        "<p><b>Note:</b> You may suppress this question by adding an"
+                        " entry to the list of known text file types on the"
+                        " <b>MimeTypes</b> configuration page.</p>",
+                    ).format(filename, mimetype),
+                )
             )
         )
 

eric ide

mercurial