Tue, 24 Sep 2024 17:52:41 +0200
Changed EricCore, EricGraphics, EricGui and some of EricNetwork to allow them to be extracted into an external library later on.
--- a/src/eric7/APIs/Python3/eric7.api Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/APIs/Python3/eric7.api Tue Sep 24 17:52:41 2024 +0200 @@ -1142,10 +1142,10 @@ eric7.EricGraphics.EricGraphicsView.EricGraphicsView._getDiagramSize?5(border=0) eric7.EricGraphics.EricGraphicsView.EricGraphicsView.autoAdjustSceneSize?4(limit=False) eric7.EricGraphics.EricGraphicsView.EricGraphicsView.filteredItems?4(items) -eric7.EricGraphics.EricGraphicsView.EricGraphicsView.getBackgroundColor?4() -eric7.EricGraphics.EricGraphicsView.EricGraphicsView.getDrawingColors?4() -eric7.EricGraphics.EricGraphicsView.EricGraphicsView.getForegroundColor?4() -eric7.EricGraphics.EricGraphicsView.EricGraphicsView.printDiagram?4(printer, diagramName="") +eric7.EricGraphics.EricGraphicsView.EricGraphicsView.getBackgroundColor?4(drawingMode="automatic") +eric7.EricGraphics.EricGraphicsView.EricGraphicsView.getDrawingColors?4(drawingMode="automatic") +eric7.EricGraphics.EricGraphicsView.EricGraphicsView.getForegroundColor?4(drawingMode="automatic") +eric7.EricGraphics.EricGraphicsView.EricGraphicsView.printDiagram?4(printer, margins=None, diagramName="") eric7.EricGraphics.EricGraphicsView.EricGraphicsView.resizeScene?4(amount, isWidth=True) eric7.EricGraphics.EricGraphicsView.EricGraphicsView.saveImage?4(filename, imageFormat="PNG") eric7.EricGraphics.EricGraphicsView.EricGraphicsView.setSceneSize?4(width, height) @@ -1155,7 +1155,7 @@ eric7.EricGraphics.EricGraphicsView.EricGraphicsView.zoomOut?4() eric7.EricGraphics.EricGraphicsView.EricGraphicsView.zoomReset?4() eric7.EricGraphics.EricGraphicsView.EricGraphicsView.zoomValueChanged?7 -eric7.EricGraphics.EricGraphicsView.EricGraphicsView?1(scene, parent=None) +eric7.EricGraphics.EricGraphicsView.EricGraphicsView?1(scene, drawingMode="automatic", parent=None) eric7.EricGui.EricAction.ArgumentsError?1(error) eric7.EricGui.EricAction.EricAction.alternateShortcut?4() eric7.EricGui.EricAction.EricAction.setAlternateShortcut?4(shortcut, removeEmpty=False) @@ -1173,7 +1173,7 @@ eric7.EricGui.EricGenericDiffHighlighter.EricGenericDiffHighlighter.generateRules?4() eric7.EricGui.EricGenericDiffHighlighter.EricGenericDiffHighlighter.highlightBlock?4(text) eric7.EricGui.EricGenericDiffHighlighter.EricGenericDiffHighlighter.makeFormat?4(fg=None, bg=None, bold=False) -eric7.EricGui.EricGenericDiffHighlighter.EricGenericDiffHighlighter.regenerateRules?4() +eric7.EricGui.EricGenericDiffHighlighter.EricGenericDiffHighlighter.regenerateRules?4(colors, font) eric7.EricGui.EricGenericDiffHighlighter.EricGenericDiffHighlighter?1(doc) eric7.EricGui.EricGenericDiffHighlighter.TERMINAL?4(pattern) eric7.EricGui.EricGenericDiffHighlighter._REGEX_CACHE?8 @@ -1254,7 +1254,7 @@ eric7.EricNetwork.EricNetworkIcon.EricNetworkIcon.isOnline?4() eric7.EricNetwork.EricNetworkIcon.EricNetworkIcon.onlineStateChanged?7 eric7.EricNetwork.EricNetworkIcon.EricNetworkIcon.reachabilityStateChanged?7 -eric7.EricNetwork.EricNetworkIcon.EricNetworkIcon?1(parent=None) +eric7.EricNetwork.EricNetworkIcon.EricNetworkIcon?1(dynamicOnlineCheck=True, parent=None) eric7.EricNetwork.EricNetworkProxyFactory.EricNetworkProxyFactory.queryProxy?4(query) eric7.EricNetwork.EricNetworkProxyFactory.EricNetworkProxyFactory?1() eric7.EricNetwork.EricNetworkProxyFactory.HostnameMatcher.match?4(host)
--- a/src/eric7/CodeFormatting/FormattingDiffWidget.py Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/CodeFormatting/FormattingDiffWidget.py Tue Sep 24 17:52:41 2024 +0200 @@ -43,8 +43,19 @@ @param diff text containing the unified diff @type str """ + self.__highlighter.regenerateRules( + { + "text": Preferences.getDiffColour("TextColor"), + "added": Preferences.getDiffColour("AddedColor"), + "removed": Preferences.getDiffColour("RemovedColor"), + "replaced": Preferences.getDiffColour("ReplacedColor"), + "context": Preferences.getDiffColour("ContextColor"), + "header": Preferences.getDiffColour("HeaderColor"), + "whitespace": Preferences.getDiffColour("BadWhitespaceColor"), + }, + Preferences.getEditorOtherFonts("MonospacedFont"), + ) self.diffEdit.clear() - self.__highlighter.regenerateRules() if diff: self.diffEdit.setPlainText(diff)
--- a/src/eric7/Documentation/Help/source.qhp Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/Documentation/Help/source.qhp Tue Sep 24 17:52:41 2024 +0200 @@ -5558,7 +5558,6 @@ <keyword name="EricGenericDiffHighlighter" id="EricGenericDiffHighlighter" ref="eric7.EricGui.EricGenericDiffHighlighter.html#EricGenericDiffHighlighter" /> <keyword name="EricGenericDiffHighlighter (Constructor)" id="EricGenericDiffHighlighter (Constructor)" ref="eric7.EricGui.EricGenericDiffHighlighter.html#EricGenericDiffHighlighter.__init__" /> <keyword name="EricGenericDiffHighlighter (Module)" id="EricGenericDiffHighlighter (Module)" ref="eric7.EricGui.EricGenericDiffHighlighter.html" /> - <keyword name="EricGenericDiffHighlighter.__initColours" id="EricGenericDiffHighlighter.__initColours" ref="eric7.EricGui.EricGenericDiffHighlighter.html#EricGenericDiffHighlighter.__initColours" /> <keyword name="EricGenericDiffHighlighter.createRules" id="EricGenericDiffHighlighter.createRules" ref="eric7.EricGui.EricGenericDiffHighlighter.html#EricGenericDiffHighlighter.createRules" /> <keyword name="EricGenericDiffHighlighter.formats" id="EricGenericDiffHighlighter.formats" ref="eric7.EricGui.EricGenericDiffHighlighter.html#EricGenericDiffHighlighter.formats" /> <keyword name="EricGenericDiffHighlighter.generateRules" id="EricGenericDiffHighlighter.generateRules" ref="eric7.EricGui.EricGenericDiffHighlighter.html#EricGenericDiffHighlighter.generateRules" />
--- a/src/eric7/Documentation/Source/eric7.EricGraphics.EricGraphicsView.html Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/Documentation/Source/eric7.EricGraphics.EricGraphicsView.html Tue Sep 24 17:52:41 2024 +0200 @@ -146,7 +146,7 @@ <a NAME="EricGraphicsView.__init__" ID="EricGraphicsView.__init__"></a> <h4>EricGraphicsView (Constructor)</h4> -<b>EricGraphicsView</b>(<i>scene, parent=None</i>) +<b>EricGraphicsView</b>(<i>scene, drawingMode="automatic", parent=None</i>) <p> Constructor </p> @@ -157,6 +157,11 @@ <dd> reference to the scene object </dd> +<dt><i>drawingMode</i> (str (optional))</dt> +<dd> +name of the drawing mode (one of "automatic", + "black_white" or "white_black") (defaults to "automatic") +</dd> <dt><i>parent</i> (QWidget)</dt> <dd> parent widget @@ -319,12 +324,20 @@ </dl> <a NAME="EricGraphicsView.getBackgroundColor" ID="EricGraphicsView.getBackgroundColor"></a> <h4>EricGraphicsView.getBackgroundColor</h4> -<b>getBackgroundColor</b>(<i></i>) +<b>getBackgroundColor</b>(<i>drawingMode="automatic"</i>) <p> Public method to get the configured background color. </p> <dl> + +<dt><i>drawingMode</i> (str (optional))</dt> +<dd> +name of the drawing mode (one of "automatic", + "black_white" or "white_black") (defaults to "automatic") +</dd> +</dl> +<dl> <dt>Return:</dt> <dd> background color @@ -338,12 +351,20 @@ </dl> <a NAME="EricGraphicsView.getDrawingColors" ID="EricGraphicsView.getDrawingColors"></a> <h4>EricGraphicsView.getDrawingColors</h4> -<b>getDrawingColors</b>(<i></i>) +<b>getDrawingColors</b>(<i>drawingMode="automatic"</i>) <p> Public method to get the configured drawing colors. </p> <dl> + +<dt><i>drawingMode</i> (str (optional))</dt> +<dd> +name of the drawing mode (one of "automatic", + "black_white" or "white_black") (defaults to "automatic") +</dd> +</dl> +<dl> <dt>Return:</dt> <dd> tuple containing the foreground and background colors @@ -357,12 +378,20 @@ </dl> <a NAME="EricGraphicsView.getForegroundColor" ID="EricGraphicsView.getForegroundColor"></a> <h4>EricGraphicsView.getForegroundColor</h4> -<b>getForegroundColor</b>(<i></i>) +<b>getForegroundColor</b>(<i>drawingMode="automatic"</i>) <p> Public method to get the configured foreground color. </p> <dl> + +<dt><i>drawingMode</i> (str (optional))</dt> +<dd> +name of the drawing mode (one of "automatic", + "black_white" or "white_black") (defaults to "automatic") +</dd> +</dl> +<dl> <dt>Return:</dt> <dd> foreground color @@ -376,7 +405,7 @@ </dl> <a NAME="EricGraphicsView.printDiagram" ID="EricGraphicsView.printDiagram"></a> <h4>EricGraphicsView.printDiagram</h4> -<b>printDiagram</b>(<i>printer, diagramName=""</i>) +<b>printDiagram</b>(<i>printer, margins=None, diagramName=""</i>) <p> Public method to print the diagram. </p> @@ -387,7 +416,11 @@ <dd> reference to a ready configured printer object </dd> -<dt><i>diagramName</i> (float)</dt> +<dt><i>margins</i> (QMarginsF or None (optional))</dt> +<dd> +diagram margins (defaults to None) +</dd> +<dt><i>diagramName</i> (str)</dt> <dd> name of the diagram </dd>
--- a/src/eric7/Documentation/Source/eric7.EricGui.EricGenericDiffHighlighter.html Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/Documentation/Source/eric7.EricGui.EricGenericDiffHighlighter.html Tue Sep 24 17:52:41 2024 +0200 @@ -59,10 +59,6 @@ <td>Constructor</td> </tr> <tr> -<td><a href="#EricGenericDiffHighlighter.__initColours">__initColours</a></td> -<td>Private method to initialize the highlighter colours.</td> -</tr> -<tr> <td><a href="#EricGenericDiffHighlighter.createRules">createRules</a></td> <td>Public method to create the highlighting rules.</td> </tr> @@ -108,13 +104,6 @@ reference to the text document </dd> </dl> -<a NAME="EricGenericDiffHighlighter.__initColours" ID="EricGenericDiffHighlighter.__initColours"></a> -<h4>EricGenericDiffHighlighter.__initColours</h4> -<b>__initColours</b>(<i></i>) -<p> - Private method to initialize the highlighter colours. -</p> - <a NAME="EricGenericDiffHighlighter.createRules" ID="EricGenericDiffHighlighter.createRules"></a> <h4>EricGenericDiffHighlighter.createRules</h4> <b>createRules</b>(<i>*rules</i>) @@ -219,11 +208,23 @@ </dl> <a NAME="EricGenericDiffHighlighter.regenerateRules" ID="EricGenericDiffHighlighter.regenerateRules"></a> <h4>EricGenericDiffHighlighter.regenerateRules</h4> -<b>regenerateRules</b>(<i></i>) +<b>regenerateRules</b>(<i>colors, font</i>) <p> Public method to initialize or regenerate the syntax highlighter rules. </p> +<dl> + +<dt><i>colors</i> (dict[str: QColor])</dt> +<dd> +dictionary containing the different color values (keys are + "text", "added", "removed","replaced", "context", "header", "whitespace") +</dd> +<dt><i>font</i> (QFont)</dt> +<dd> +font +</dd> +</dl> <div align="right"><a href="#top">Up</a></div> <hr /> <hr />
--- a/src/eric7/Documentation/Source/eric7.EricNetwork.EricNetworkIcon.html Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/Documentation/Source/eric7.EricNetwork.EricNetworkIcon.html Tue Sep 24 17:52:41 2024 +0200 @@ -87,13 +87,18 @@ <a NAME="EricNetworkIcon.__init__" ID="EricNetworkIcon.__init__"></a> <h4>EricNetworkIcon (Constructor)</h4> -<b>EricNetworkIcon</b>(<i>parent=None</i>) +<b>EricNetworkIcon</b>(<i>dynamicOnlineCheck=True, parent=None</i>) <p> Constructor </p> <dl> +<dt><i>dynamicOnlineCheck</i> (bool (optional))</dt> +<dd> +flag indicating to perform online checks during + runtime (defaults to True) +</dd> <dt><i>parent</i> (QWidget)</dt> <dd> reference to the parent widget
--- a/src/eric7/EricCore/EricFileSystemWatcher.py Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/EricCore/EricFileSystemWatcher.py Tue Sep 24 17:52:41 2024 +0200 @@ -8,13 +8,12 @@ """ import os +import sys from PyQt6.QtCore import QObject, pyqtSignal, pyqtSlot from watchdog.events import EVENT_TYPE_CLOSED, EVENT_TYPE_OPENED, FileSystemEventHandler -from eric7.SystemUtilities import OSUtilities - -if OSUtilities.isMacPlatform(): +if sys.platform == "darwin": from watchdog.observers.kqueue import KqueueObserver as Observer else: from watchdog.observers import Observer
--- a/src/eric7/EricCore/EricProcess.py Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/EricCore/EricProcess.py Tue Sep 24 17:52:41 2024 +0200 @@ -57,7 +57,7 @@ def timeoutInterval(self): """ Public method to get the process timeout interval. - + @return process timeout interval in milliseconds @rtype int """
--- a/src/eric7/EricGraphics/EricGraphicsView.py Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/EricGraphics/EricGraphicsView.py Tue Sep 24 17:52:41 2024 +0200 @@ -9,14 +9,19 @@ import sys -from PyQt6.QtCore import QRectF, QSize, QSizeF, Qt, pyqtSignal +from PyQt6.QtCore import ( + QCoreApplication, + QMarginsF, + QRectF, + QSize, + QSizeF, + Qt, + pyqtSignal, +) from PyQt6.QtGui import QBrush, QColor, QFont, QPainter, QPixmap from PyQt6.QtSvg import QSvgGenerator from PyQt6.QtWidgets import QGraphicsView -from eric7 import Preferences -from eric7.EricWidgets.EricApplication import ericApp - class EricGraphicsView(QGraphicsView): """ @@ -59,12 +64,15 @@ ] ZoomLevelDefault = 100 - def __init__(self, scene, parent=None): + def __init__(self, scene, drawingMode="automatic", parent=None): """ Constructor @param scene reference to the scene object @type QGraphicsScene + @param drawingMode name of the drawing mode (one of "automatic", + "black_white" or "white_black") (defaults to "automatic") + @type str (optional) @param parent parent widget @type QWidget """ @@ -72,7 +80,9 @@ self.setObjectName("EricGraphicsView") self.__initialSceneSize = self.scene().sceneRect().size() - self.setBackgroundBrush(QBrush(self.getBackgroundColor())) + self.setBackgroundBrush( + QBrush(self.getBackgroundColor(drawingMode=drawingMode)) + ) self.setRenderHint(QPainter.RenderHint.Antialiasing, True) self.setDragMode(QGraphicsView.DragMode.RubberBandDrag) self.setAlignment(Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignTop) @@ -100,16 +110,18 @@ ) ) - def getDrawingColors(self): + def getDrawingColors(self, drawingMode="automatic"): """ Public method to get the configured drawing colors. + @param drawingMode name of the drawing mode (one of "automatic", + "black_white" or "white_black") (defaults to "automatic") + @type str (optional) @return tuple containing the foreground and background colors @rtype tuple of (QColor, QColor) """ - drawingMode = Preferences.getGraphics("DrawingMode") if drawingMode == "automatic": - if ericApp().usesDarkPalette(): + if QCoreApplication.instance().usesDarkPalette(): drawingMode = "white_black" else: drawingMode = "black_white" @@ -119,23 +131,29 @@ else: return (QColor("#000000"), QColor("#ffffff")) - def getForegroundColor(self): + def getForegroundColor(self, drawingMode="automatic"): """ Public method to get the configured foreground color. + @param drawingMode name of the drawing mode (one of "automatic", + "black_white" or "white_black") (defaults to "automatic") + @type str (optional) @return foreground color @rtype QColor """ - return self.getDrawingColors()[0] + return self.getDrawingColors(drawingMode=drawingMode)[0] - def getBackgroundColor(self): + def getBackgroundColor(self, drawingMode="automatic"): """ Public method to get the configured background color. + @param drawingMode name of the drawing mode (one of "automatic", + "black_white" or "white_black") (defaults to "automatic") + @type str (optional) @return background color @rtype QColor """ - return self.getDrawingColors()[1] + return self.getDrawingColors(drawingMode=drawingMode)[1] def __levelForZoom(self, zoom): """ @@ -377,15 +395,22 @@ pixmap = self.__getDiagram(rect) return pixmap.save(filename, imageFormat) - def printDiagram(self, printer, diagramName=""): + def printDiagram( + self, printer, margins=None, diagramName="" + ): """ Public method to print the diagram. @param printer reference to a ready configured printer object @type QPrinter + @param margins diagram margins (defaults to None) + @type QMarginsF or None (optional) @param diagramName name of the diagram - @type float + @type str """ + if margins is None: + margins = QMarginsF(1.0, 1.0, 1.0, 1.0) + painter = QPainter(printer) font = QFont(["times"], 10) @@ -396,30 +421,24 @@ printer.pageLayout().paintRectPixels(printer.resolution()).x() - printer.pageLayout().fullRectPixels(printer.resolution()).x() ) - marginX = ( - int(Preferences.getPrinter("LeftMargin") * printer.resolution() / 2.54) - - marginX - ) + marginX = int(margins.left() * printer.resolution() / 2.54) - marginX marginY = ( printer.pageLayout().paintRectPixels(printer.resolution()).y() - printer.pageLayout().fullRectPixels(printer.resolution()).y() ) - marginY = ( - int(Preferences.getPrinter("TopMargin") * printer.resolution() / 2.54) - - marginY - ) + marginY = int(margins.top() * printer.resolution() / 2.54) - marginY width = ( printer.width() - marginX - - int(Preferences.getPrinter("RightMargin") * printer.resolution() / 2.54) + - int(margins.right() * printer.resolution() / 2.54) ) height = ( printer.height() - fontHeight - 4 - marginY - - int(Preferences.getPrinter("BottomMargin") * printer.resolution() / 2.54) + - int(margins.bottom() * printer.resolution() / 2.54) ) self.render(painter, target=QRectF(marginX, marginY, width, height))
--- a/src/eric7/EricGui/EricAction.py Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/EricGui/EricAction.py Tue Sep 24 17:52:41 2024 +0200 @@ -10,10 +10,9 @@ shortcuts. """ +from PyQt6.QtCore import QCoreApplication from PyQt6.QtGui import QAction, QActionGroup, QIcon, QKeySequence -from eric7.EricWidgets.EricApplication import ericApp - class ArgumentsError(RuntimeError): """ @@ -195,7 +194,7 @@ """ shortcut = self.shortcut().toString(QKeySequence.SequenceFormat.NativeText) if shortcut: - if ericApp().isLeftToRight(): + if QCoreApplication.instance().isLeftToRight(): fmt = "{0} ({1})" else: fmt = "({1}) {0}"
--- a/src/eric7/EricGui/EricFileIconProvider.py Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/EricGui/EricFileIconProvider.py Tue Sep 24 17:52:41 2024 +0200 @@ -11,7 +11,7 @@ from PyQt6.QtGui import QImageReader -from eric7.EricGui import EricPixmapCache +from . import EricPixmapCache class EricFileIconProvider:
--- a/src/eric7/EricGui/EricGenericDiffHighlighter.py Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/EricGui/EricGenericDiffHighlighter.py Tue Sep 24 17:52:41 2024 +0200 @@ -11,8 +11,6 @@ from PyQt6.QtGui import QFont, QSyntaxHighlighter, QTextCharFormat -from eric7 import Preferences - def TERMINAL(pattern): """ @@ -44,20 +42,6 @@ """ super().__init__(doc) - self.regenerateRules() - - def __initColours(self): - """ - Private method to initialize the highlighter colours. - """ - self.textColor = Preferences.getDiffColour("TextColor") - self.addedColor = Preferences.getDiffColour("AddedColor") - self.removedColor = Preferences.getDiffColour("RemovedColor") - self.replacedColor = Preferences.getDiffColour("ReplacedColor") - self.contextColor = Preferences.getDiffColour("ContextColor") - self.headerColor = Preferences.getDiffColour("HeaderColor") - self.whitespaceColor = Preferences.getDiffColour("BadWhitespaceColor") - def createRules(self, *rules): """ Public method to create the highlighting rules. @@ -112,7 +96,7 @@ @return format definiton @rtype QTextCharFormat """ - font = Preferences.getEditorOtherFonts("MonospacedFont") + font = QFont(self.baseFont) charFormat = QTextCharFormat() charFormat.setFontFamilies([font.family()]) charFormat.setFontPointSize(font.pointSize()) @@ -163,13 +147,26 @@ self.setFormat(start, start + length, formatStr[groupIndex]) start += length - def regenerateRules(self): + def regenerateRules(self, colors, font): """ Public method to initialize or regenerate the syntax highlighter rules. + + @param colors dictionary containing the different color values (keys are + "text", "added", "removed","replaced", "context", "header", "whitespace") + @type dict[str: QColor] + @param font font + @type QFont """ + self.baseFont = font self.normalFormat = self.makeFormat() - self.__initColours() + self.textColor = colors["text"] + self.addedColor = colors["added"] + self.removedColor = colors["removed"] + self.replacedColor = colors["replaced"] + self.contextColor = colors["context"] + self.headerColor = colors["header"] + self.whitespaceColor = colors["whitespace"] self._rules = [] self.generateRules()
--- a/src/eric7/EricNetwork/EricNetworkIcon.py Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/EricNetwork/EricNetworkIcon.py Tue Sep 24 17:52:41 2024 +0200 @@ -11,7 +11,6 @@ from PyQt6.QtNetwork import QNetworkInformation from PyQt6.QtWidgets import QLabel -from eric7 import Preferences from eric7.EricGui import EricPixmapCache @@ -28,16 +27,19 @@ onlineStateChanged = pyqtSignal(bool) reachabilityStateChanged = pyqtSignal(QNetworkInformation.Reachability) - def __init__(self, parent=None): + def __init__(self, dynamicOnlineCheck=True, parent=None): """ Constructor + @param dynamicOnlineCheck flag indicating to perform online checks during + runtime (defaults to True) + @type bool (optional) @param parent reference to the parent widget @type QWidget """ super().__init__(parent) - if Preferences.getUI("DynamicOnlineCheck") and QNetworkInformation.load( + if dynamicOnlineCheck and QNetworkInformation.load( QNetworkInformation.Feature.Reachability ): self.__online = (
--- a/src/eric7/EricNetwork/EricSslCertificateSelectionDialog.py Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/EricNetwork/EricSslCertificateSelectionDialog.py Tue Sep 24 17:52:41 2024 +0200 @@ -114,9 +114,8 @@ Private slot to show data of the selected certificate. """ with contextlib.suppress(ImportError): - from eric7.EricNetwork.EricSslCertificatesInfoDialog import ( # noqa: I101 - EricSslCertificatesInfoDialog, - ) + from .EricSslCertificatesInfoDialog import EricSslCertificatesInfoDialog + # noqa: I101 cert = QSslCertificate.fromData( self.certificatesTree.selectedItems()[0].data(0, self.CertRole)
--- a/src/eric7/EricNetwork/EricSslCertificatesDialog.py Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/EricNetwork/EricSslCertificatesDialog.py Tue Sep 24 17:52:41 2024 +0200 @@ -126,9 +126,8 @@ Private slot to show data of the selected server certificate. """ with contextlib.suppress(ImportError): - from eric7.EricNetwork.EricSslCertificatesInfoDialog import ( # noqa: I101 - EricSslCertificatesInfoDialog, - ) + from .EricSslCertificatesInfoDialog import EricSslCertificatesInfoDialog + # noqa: I101 cert = QSslCertificate.fromData( self.serversCertificatesTree.currentItem().data(0, self.CertRole) @@ -349,9 +348,8 @@ Private slot to show data of the selected CA certificate. """ with contextlib.suppress(ImportError): - from eric7.EricNetwork.EricSslCertificatesInfoDialog import ( # noqa: I101 - EricSslCertificatesInfoDialog, - ) + from .EricSslCertificatesInfoDialog import EricSslCertificatesInfoDialog + # noqa: I101 cert = QSslCertificate.fromData( self.caCertificatesTree.currentItem().data(0, self.CertRole)
--- a/src/eric7/Graphics/UMLGraphicsView.py Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/Graphics/UMLGraphicsView.py Tue Sep 24 17:52:41 2024 +0200 @@ -54,7 +54,12 @@ @param parent parent widget of the view @type QWidget """ - EricGraphicsView.__init__(self, scene, parent) + EricGraphicsView.__init__( + self, + scene, + drawingMode=Preferences.getGraphics("DrawingMode"), + parent=parent, + ) self.setObjectName("UMLGraphicsView") self.setViewportUpdateMode(QGraphicsView.ViewportUpdateMode.FullViewportUpdate) @@ -467,7 +472,16 @@ printDialog = QPrintDialog(printer, self) if printDialog.exec(): - super().printDiagram(printer, self.diagramName) + super().printDiagram( + printer, + margins=QMarginsF( + Preferences.getPrinter("LeftMargin"), + Preferences.getPrinter("TopMargin"), + Preferences.getPrinter("RightMargin"), + Preferences.getPrinter("BottomMargin"), + ), + diagramName=self.diagramName, + ) def printPreviewDiagram(self): """ @@ -507,7 +521,16 @@ @param printer reference to the printer object @type QPrinter """ - super().printDiagram(printer, self.diagramName) + super().printDiagram( + printer, + margins=QMarginsF( + Preferences.getPrinter("LeftMargin"), + Preferences.getPrinter("TopMargin"), + Preferences.getPrinter("RightMargin"), + Preferences.getPrinter("BottomMargin"), + ), + diagramName=self.diagramName, + ) def setDiagramName(self, name): """ @@ -762,6 +785,9 @@ return False, 0 self.diagramName = data[0].split(": ", 1)[1].strip() + colors = self.getDrawingColors( + drawingMode=Preferences.getGraphics("DrawingMode") + ) for linenum, line in enumerate(data[1:], start=1): if not line.startswith(("item:", "association:")): return False, linenum @@ -775,17 +801,11 @@ y = float(y.split("=", 1)[1].strip()) itemType = itemType.split("=", 1)[1].strip() if itemType == ClassItem.ItemType: - itm = ClassItem( - x=0, y=0, scene=self.scene(), colors=self.getDrawingColors() - ) + itm = ClassItem(x=0, y=0, scene=self.scene(), colors=colors) elif itemType == ModuleItem.ItemType: - itm = ModuleItem( - x=0, y=0, scene=self.scene(), colors=self.getDrawingColors() - ) + itm = ModuleItem(x=0, y=0, scene=self.scene(), colors=colors) elif itemType == PackageItem.ItemType: - itm = PackageItem( - x=0, y=0, scene=self.scene(), colors=self.getDrawingColors() - ) + itm = PackageItem(x=0, y=0, scene=self.scene(), colors=colors) itm.setPos(x, y) itm.setId(itemId) umlItems[itemId] = itm @@ -849,26 +869,27 @@ from .UMLItem import UMLItem umlItems = {} + colors = self.getDrawingColors( + drawingMode=Preferences.getGraphics("DrawingMode") + ) try: self.diagramName = data["diagram_name"] for itemData in data["items"]: if itemData["type"] == UMLItem.ItemType: - itm = UMLItem.fromDict(itemData, colors=self.getDrawingColors()) + itm = UMLItem.fromDict(itemData, colors=colors) elif itemData["type"] == ClassItem.ItemType: - itm = ClassItem.fromDict(itemData, colors=self.getDrawingColors()) + itm = ClassItem.fromDict(itemData, colors=colors) elif itemData["type"] == ModuleItem.ItemType: - itm = ModuleItem.fromDict(itemData, colors=self.getDrawingColors()) + itm = ModuleItem.fromDict(itemData, colors=colors) elif itemData["type"] == PackageItem.ItemType: - itm = PackageItem.fromDict(itemData, colors=self.getDrawingColors()) + itm = PackageItem.fromDict(itemData, colors=colors) if itm is not None: umlItems[itm.getId()] = itm self.scene().addItem(itm) for assocData in data["associations"]: - assoc = AssociationItem.fromDict( - assocData, umlItems, colors=self.getDrawingColors() - ) + assoc = AssociationItem.fromDict(assocData, umlItems, colors=colors) self.scene().addItem(assoc) return True
--- a/src/eric7/Plugins/VcsPlugins/vcsGit/GitDiffDialog.py Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/Plugins/VcsPlugins/vcsGit/GitDiffDialog.py Tue Sep 24 17:52:41 2024 +0200 @@ -8,7 +8,6 @@ process. """ -import contextlib import pathlib from PyQt6.QtCore import Qt, pyqtSlot @@ -143,6 +142,22 @@ self.errorGroup.hide() + colors = { + "text": Preferences.getDiffColour("TextColor"), + "added": Preferences.getDiffColour("AddedColor"), + "removed": Preferences.getDiffColour("RemovedColor"), + "replaced": Preferences.getDiffColour("ReplacedColor"), + "context": Preferences.getDiffColour("ContextColor"), + "header": Preferences.getDiffColour("HeaderColor"), + "whitespace": Preferences.getDiffColour("BadWhitespaceColor"), + } + self.highlighter.regenerateRules( + colors, Preferences.getEditorOtherFonts("MonospacedFont") + ) + self.highlighter2.regenerateRules( + colors, Preferences.getEditorOtherFonts("MonospacedFont") + ) + self.contents.clear() self.contents2.clear() self.contents2.setVisible(diffMode == "work2stage2repo") @@ -150,10 +165,6 @@ self.filesCombo.clear() - with contextlib.suppress(AttributeError): - self.highlighter.regenerateRules() - self.highlighter2.regenerateRules() - if diffMode in ["work2repo", "work2stage", "stage2repo", "work2stage2repo"]: self.contentsGroup.setTitle( self.tr("Difference ({0})").format(self.__modeMessages[diffMode])
--- a/src/eric7/Plugins/VcsPlugins/vcsGit/GitLogBrowserDialog.py Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/Plugins/VcsPlugins/vcsGit/GitLogBrowserDialog.py Tue Sep 24 17:52:41 2024 +0200 @@ -2261,11 +2261,22 @@ @param parent number of parent to diff against @type int """ + self.diffHighlighter.regenerateRules( + { + "text": Preferences.getDiffColour("TextColor"), + "added": Preferences.getDiffColour("AddedColor"), + "removed": Preferences.getDiffColour("RemovedColor"), + "replaced": Preferences.getDiffColour("ReplacedColor"), + "context": Preferences.getDiffColour("ContextColor"), + "header": Preferences.getDiffColour("HeaderColor"), + "whitespace": Preferences.getDiffColour("BadWhitespaceColor"), + }, + Preferences.getEditorOtherFonts("MonospacedFont"), + ) + self.diffEdit.clear() self.diffLabel.setText(self.tr("Differences")) self.diffSelectLabel.clear() - with contextlib.suppress(AttributeError): - self.diffHighlighter.regenerateRules() selectedItems = self.logTree.selectedItems() if len(selectedItems) == 1:
--- a/src/eric7/Plugins/VcsPlugins/vcsGit/GitStatusDialog.py Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/Plugins/VcsPlugins/vcsGit/GitStatusDialog.py Tue Sep 24 17:52:41 2024 +0200 @@ -8,7 +8,6 @@ process. """ -import contextlib import os import tempfile @@ -1118,11 +1117,24 @@ """ Private slot to generate diff outputs for the selected item. """ + colors = { + "text": Preferences.getDiffColour("TextColor"), + "added": Preferences.getDiffColour("AddedColor"), + "removed": Preferences.getDiffColour("RemovedColor"), + "replaced": Preferences.getDiffColour("ReplacedColor"), + "context": Preferences.getDiffColour("ContextColor"), + "header": Preferences.getDiffColour("HeaderColor"), + "whitespace": Preferences.getDiffColour("BadWhitespaceColor"), + } + self.lDiffHighlighter.regenerateRules( + colors, Preferences.getEditorOtherFonts("MonospacedFont") + ) + self.rDiffHighlighter.regenerateRules( + colors, Preferences.getEditorOtherFonts("MonospacedFont") + ) + self.lDiffEdit.clear() self.rDiffEdit.clear() - with contextlib.suppress(AttributeError): - self.lDiffHighlighter.regenerateRules() - self.rDiffHighlighter.regenerateRules() selectedItems = self.statusList.selectedItems() if len(selectedItems) == 1:
--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.py Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.py Tue Sep 24 17:52:41 2024 +0200 @@ -90,9 +90,21 @@ self.errorGroup.hide() self.filename = fn + self.highlighter.regenerateRules( + { + "text": Preferences.getDiffColour("TextColor"), + "added": Preferences.getDiffColour("AddedColor"), + "removed": Preferences.getDiffColour("RemovedColor"), + "replaced": Preferences.getDiffColour("ReplacedColor"), + "context": Preferences.getDiffColour("ContextColor"), + "header": Preferences.getDiffColour("HeaderColor"), + "whitespace": Preferences.getDiffColour("BadWhitespaceColor"), + }, + Preferences.getEditorOtherFonts("MonospacedFont"), + ) + self.contents.clear() self.filesCombo.clear() - self.highlighter.regenerateRules() if qdiff: self.setWindowTitle(self.tr("Patch Contents"))
--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py Tue Sep 24 17:52:41 2024 +0200 @@ -2749,10 +2749,22 @@ @param parent number of parent to diff against @type int """ + self.diffHighlighter.regenerateRules( + { + "text": Preferences.getDiffColour("TextColor"), + "added": Preferences.getDiffColour("AddedColor"), + "removed": Preferences.getDiffColour("RemovedColor"), + "replaced": Preferences.getDiffColour("ReplacedColor"), + "context": Preferences.getDiffColour("ContextColor"), + "header": Preferences.getDiffColour("HeaderColor"), + "whitespace": Preferences.getDiffColour("BadWhitespaceColor"), + }, + Preferences.getEditorOtherFonts("MonospacedFont"), + ) + self.diffEdit.setPlainText(self.tr("Generating differences ...")) self.diffLabel.setText(self.tr("Differences")) self.diffSelectLabel.clear() - self.diffHighlighter.regenerateRules() selectedItems = self.logTree.selectedItems() if len(selectedItems) == 1:
--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgStatusDialog.py Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgStatusDialog.py Tue Sep 24 17:52:41 2024 +0200 @@ -843,8 +843,20 @@ """ Private slot to generate diff outputs for the selected item. """ + self.diffHighlighter.regenerateRules( + { + "text": Preferences.getDiffColour("TextColor"), + "added": Preferences.getDiffColour("AddedColor"), + "removed": Preferences.getDiffColour("RemovedColor"), + "replaced": Preferences.getDiffColour("ReplacedColor"), + "context": Preferences.getDiffColour("ContextColor"), + "header": Preferences.getDiffColour("HeaderColor"), + "whitespace": Preferences.getDiffColour("BadWhitespaceColor"), + }, + Preferences.getEditorOtherFonts("MonospacedFont"), + ) + self.diffEdit.clear() - self.diffHighlighter.regenerateRules() if not self.__mq: selectedItems = self.statusList.selectedItems()
--- a/src/eric7/Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.py Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.py Tue Sep 24 17:52:41 2024 +0200 @@ -155,8 +155,20 @@ self.filename = fn + self.highlighter.regenerateRules( + { + "text": Preferences.getDiffColour("TextColor"), + "added": Preferences.getDiffColour("AddedColor"), + "removed": Preferences.getDiffColour("RemovedColor"), + "replaced": Preferences.getDiffColour("ReplacedColor"), + "context": Preferences.getDiffColour("ContextColor"), + "header": Preferences.getDiffColour("HeaderColor"), + "whitespace": Preferences.getDiffColour("BadWhitespaceColor"), + }, + Preferences.getEditorOtherFonts("MonospacedFont"), + ) + self.contents.clear() - self.highlighter.regenerateRules() self.paras = 0 self.filesCombo.clear()
--- a/src/eric7/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.py Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.py Tue Sep 24 17:52:41 2024 +0200 @@ -121,8 +121,20 @@ self.process.kill() + self.highlighter.regenerateRules( + { + "text": Preferences.getDiffColour("TextColor"), + "added": Preferences.getDiffColour("AddedColor"), + "removed": Preferences.getDiffColour("RemovedColor"), + "replaced": Preferences.getDiffColour("ReplacedColor"), + "context": Preferences.getDiffColour("ContextColor"), + "header": Preferences.getDiffColour("HeaderColor"), + "whitespace": Preferences.getDiffColour("BadWhitespaceColor"), + }, + Preferences.getEditorOtherFonts("MonospacedFont"), + ) + self.contents.clear() - self.highlighter.regenerateRules() self.paras = 0 self.filesCombo.clear()
--- a/src/eric7/UI/DiffDialog.py Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/UI/DiffDialog.py Tue Sep 24 17:52:41 2024 +0200 @@ -203,8 +203,20 @@ ) return + self.highlighter.regenerateRules( + { + "text": Preferences.getDiffColour("TextColor"), + "added": Preferences.getDiffColour("AddedColor"), + "removed": Preferences.getDiffColour("RemovedColor"), + "replaced": Preferences.getDiffColour("ReplacedColor"), + "context": Preferences.getDiffColour("ContextColor"), + "header": Preferences.getDiffColour("HeaderColor"), + "whitespace": Preferences.getDiffColour("BadWhitespaceColor"), + }, + Preferences.getEditorOtherFonts("MonospacedFont"), + ) + self.contents.clear() - self.highlighter.regenerateRules() self.saveButton.setEnabled(False) if self.unifiedRadioButton.isChecked():
--- a/src/eric7/UI/UserInterface.py Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/UI/UserInterface.py Tue Sep 24 17:52:41 2024 +0200 @@ -4435,7 +4435,10 @@ self.sbVcsMonitorLed = StatusMonitorLedWidget(self.project, self.__statusBar) self.__statusBar.addPermanentWidget(self.sbVcsMonitorLed) - self.networkIcon = EricNetworkIcon(self.__statusBar) + self.networkIcon = EricNetworkIcon( + dynamicOnlineCheck=Preferences.getUI("DynamicOnlineCheck"), + parent=self.__statusBar, + ) self.__statusBar.addPermanentWidget(self.networkIcon) self.networkIcon.onlineStateChanged.connect(self.onlineStateChanged) self.networkIcon.onlineStateChanged.connect(self.__onlineStateChanged)
--- a/src/eric7/WebBrowser/WebBrowserWindow.py Mon Sep 23 14:37:31 2024 +0200 +++ b/src/eric7/WebBrowser/WebBrowserWindow.py Tue Sep 24 17:52:41 2024 +0200 @@ -426,7 +426,9 @@ self.__tabManagerIcon = self.tabManager().createStatusBarIcon() self.statusBar().addPermanentWidget(self.__tabManagerIcon) - self.networkIcon = EricNetworkIcon(self) + self.networkIcon = EricNetworkIcon( + dynamicOnlineCheck=Preferences.getUI("DynamicOnlineCheck"), parent=self + ) self.statusBar().addPermanentWidget(self.networkIcon) if not Preferences.getWebBrowser("StatusBarVisible"):