src/eric7/EricNetwork/EricIPv4InputWidget.py

branch
mpy_network
changeset 9830
6c91fdb0e55b
parent 9797
3be7b2326e2c
child 10024
3bbf6dbec0bd
--- a/src/eric7/EricNetwork/EricIPv4InputWidget.py	Tue Feb 28 17:58:54 2023 +0100
+++ b/src/eric7/EricNetwork/EricIPv4InputWidget.py	Tue Feb 28 18:04:08 2023 +0100
@@ -9,7 +9,7 @@
 
 import ipaddress
 
-from PyQt6.QtCore import pyqtSignal, pyqtSlot, QRegularExpression, QEvent, Qt
+from PyQt6.QtCore import QEvent, QRegularExpression, Qt, pyqtSignal, pyqtSlot
 from PyQt6.QtGui import QRegularExpressionValidator
 from PyQt6.QtWidgets import QWidget
 
@@ -24,6 +24,7 @@
 
     @signal addressChanged() emitted to indicate a change of the entered IPv4 address
     """
+
     addressChanged = pyqtSignal()
 
     def __init__(self, parent=None):
@@ -71,20 +72,21 @@
         @type QObject
         @param evt reference to the event object
         @type QEvent
+        @return flag indicating, that the event was handled
+        @rtype bool
         """
-        if evt.type() == QEvent.Type.KeyPress:
-            if evt.text() == '.':
-                if obj is self.ip1Edit:
-                    nextWidget = self.ip2Edit
-                elif obj is self.ip2Edit:
-                    nextWidget = self.ip3Edit
-                elif obj is self.ip3Edit:
-                    nextWidget = self.ip4Edit
-                else:
-                    nextWidget = None
-                if nextWidget:
-                    nextWidget.setFocus(Qt.FocusReason.TabFocusReason)
-                    return True
+        if evt.type() == QEvent.Type.KeyPress and evt.text() == ".":
+            if obj is self.ip1Edit:
+                nextWidget = self.ip2Edit
+            elif obj is self.ip2Edit:
+                nextWidget = self.ip3Edit
+            elif obj is self.ip3Edit:
+                nextWidget = self.ip4Edit
+            else:
+                nextWidget = None
+            if nextWidget:
+                nextWidget.setFocus(Qt.FocusReason.TabFocusReason)
+                return True
 
         return super().eventFilter(obj, evt)
 
@@ -128,6 +130,7 @@
 
         @param address IPv4 address
         @type str
+        @exception ValueError raised to indicate an invalid IPv4 address
         """
         if address:
             try:
@@ -149,6 +152,7 @@
 
         @return IPv4 address
         @rtype ipaddress.IPv4Address
+        @exception ValueError raised to indicate an invalid IPv4 address
         """
         try:
             return ipaddress.IPv4Address(self.text())

eric ide

mercurial