src/eric7/EricWidgets/EricProcessDialog.py

branch
eric7
changeset 10933
95a15b70f7bb
parent 10835
9117c08e4707
child 11090
f5f5f5803935
diff -r 82de5109035a -r 95a15b70f7bb src/eric7/EricWidgets/EricProcessDialog.py
--- a/src/eric7/EricWidgets/EricProcessDialog.py	Fri Sep 27 11:00:27 2024 +0200
+++ b/src/eric7/EricWidgets/EricProcessDialog.py	Fri Sep 27 17:27:11 2024 +0200
@@ -18,9 +18,9 @@
     QTimer,
     pyqtSlot,
 )
+from PyQt6.QtGui import QFont
 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QLineEdit
 
-from eric7 import Preferences
 from eric7.EricUtilities import strToQByteArray
 from eric7.EricWidgets import EricMessageBox
 
@@ -43,6 +43,8 @@
         showProgress=False,
         showInput=True,
         combinedOutput=False,
+        monospacedFont=None,
+        encoding="utf-8",
         parent=None,
     ):
         """
@@ -60,6 +62,12 @@
         @param combinedOutput flag indicating to show output of the stderr channel
             in the main output pane (defaults to False)
         @type bool (optional)
+        @param monospacedFont font to be used (should be a monospaced one) (defaults
+            to None)
+        @type QFont
+        @param encoding encoding used for the communication with the process (defaults
+            to "utf-8")
+        @type str (optional)
         @param parent reference to the parent widget (defaults to None)
         @type QWidget (optional)
         """
@@ -69,11 +77,14 @@
         self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(False)
         self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setDefault(True)
 
-        font = Preferences.getEditorOtherFonts("MonospacedFont")
-        self.resultbox.setFontFamily(font.family())
-        self.resultbox.setFontPointSize(font.pointSize())
-        self.errors.setFontFamily(font.family())
-        self.errors.setFontPointSize(font.pointSize())
+        if monospacedFont is None:
+            monospacedFont = QFont("Monospace")
+        self.resultbox.setFontFamily(monospacedFont.family())
+        self.resultbox.setFontPointSize(monospacedFont.pointSize())
+        self.errors.setFontFamily(monospacedFont.family())
+        self.errors.setFontPointSize(monospacedFont.pointSize())
+
+        self.__ioEncoding = encoding
 
         if windowTitle:
             self.setWindowTitle(windowTitle)
@@ -247,7 +258,7 @@
         if self.__process is not None:
             s = str(
                 self.__process.readAllStandardOutput(),
-                Preferences.getSystem("IOEncoding"),
+                self.__ioEncoding,
                 "replace",
             )
             if self.__showProgress:
@@ -272,7 +283,7 @@
         if self.__process is not None:
             s = str(
                 self.__process.readAllStandardError(),
-                Preferences.getSystem("IOEncoding"),
+                self.__ioEncoding,
                 "replace",
             )
 

eric ide

mercurial