src/eric7/Preferences/ConfigurationPages/DebuggerGeneralPage.py

branch
eric7
changeset 9519
d7ab0653bc63
parent 9518
cbccd588d48e
child 9521
a663a8be64da
equal deleted inserted replaced
9518:cbccd588d48e 9519:d7ab0653bc63
6 """ 6 """
7 Module implementing the Debugger General configuration page. 7 Module implementing the Debugger General configuration page.
8 """ 8 """
9 9
10 import re 10 import re
11 import socket
12 11
13 from PyQt6.QtCore import QAbstractItemModel, QModelIndex, Qt, pyqtSlot 12 from PyQt6.QtCore import QAbstractItemModel, QModelIndex, Qt, pyqtSlot
14 from PyQt6.QtGui import QBrush, QColor 13 from PyQt6.QtGui import QBrush, QColor
15 from PyQt6.QtNetwork import QAbstractSocket, QHostAddress, QNetworkInterface 14 from PyQt6.QtNetwork import QAbstractSocket, QHostAddress, QNetworkInterface
16 from PyQt6.QtWidgets import QInputDialog, QLineEdit 15 from PyQt6.QtWidgets import QInputDialog, QLineEdit
64 networkInterfaces = QNetworkInterface.allInterfaces() 63 networkInterfaces = QNetworkInterface.allInterfaces()
65 for networkInterface in networkInterfaces: 64 for networkInterface in networkInterfaces:
66 addressEntries = networkInterface.addressEntries() 65 addressEntries = networkInterface.addressEntries()
67 if len(addressEntries) > 0: 66 if len(addressEntries) > 0:
68 for addressEntry in addressEntries: 67 for addressEntry in addressEntries:
69 if ":" in addressEntry.ip().toString() and not socket.has_ipv6:
70 continue # IPv6 not supported by Python
71 interfaces.append( 68 interfaces.append(
72 "{0} ({1})".format( 69 "{0} ({1})".format(
73 networkInterface.humanReadableName(), 70 networkInterface.humanReadableName(),
74 addressEntry.ip().toString(), 71 addressEntry.ip().toString(),
75 ) 72 )
76 ) 73 )
77 self.interfacesCombo.addItems(interfaces) 74 self.interfacesCombo.addItems(interfaces)
78 interface = Preferences.getDebugger("NetworkInterface") 75 interface = Preferences.getDebugger("NetworkInterface")
79 if not socket.has_ipv6: 76 # TODO: change config 'all' to 'allv4'
80 # IPv6 not supported by Python 77 # TODO: change radiobutton selection to combo box and include
81 self.all6InterfacesButton.setEnabled(False) 78 # - Localhost (IPv4) (localv4)
82 if interface == "allv6": 79 # - LocalHost (IPv6) (localv6)
83 interface = "all" 80 # - Any (IPv4) (allv4)
81 # - Any (IPv6) (allv6)
82 # - Any (IPv4 and IPv6) (all)
83 # - Selected Interface
84 # TODO: allow to listen on a specific port with auto-increment if port is in
85 # use already
84 if interface == "all": 86 if interface == "all":
85 self.allInterfacesButton.setChecked(True) 87 self.allInterfacesButton.setChecked(True)
86 elif interface == "allv6": 88 elif interface == "allv6":
87 self.all6InterfacesButton.setChecked(True) 89 self.all6InterfacesButton.setChecked(True)
88 else: 90 else:

eric ide

mercurial