Preferences/ConfigurationPages/DebuggerGeneralPage.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2525
8b507a9a2d40
parent 3010
befeff46ec0f
child 3058
0a02c433f52d
equal deleted inserted replaced
3056:9986ec0e559a 3057:10516539f238
54 if t: 54 if t:
55 t += Utilities.getPercentReplacementHelp() 55 t += Utilities.getPercentReplacementHelp()
56 self.consoleDbgEdit.setWhatsThis(t) 56 self.consoleDbgEdit.setWhatsThis(t)
57 57
58 self.consoleDbgCompleter = E5FileCompleter(self.consoleDbgEdit) 58 self.consoleDbgCompleter = E5FileCompleter(self.consoleDbgEdit)
59 self.dbgTranslationLocalCompleter = E5DirCompleter(self.dbgTranslationLocalEdit) 59 self.dbgTranslationLocalCompleter = E5DirCompleter(
60 self.dbgTranslationLocalEdit)
60 61
61 # set initial values 62 # set initial values
62 interfaces = [] 63 interfaces = []
63 networkInterfaces = QNetworkInterface.allInterfaces() 64 networkInterfaces = QNetworkInterface.allInterfaces()
64 for networkInterface in networkInterfaces: 65 for networkInterface in networkInterfaces:
65 addressEntries = networkInterface.addressEntries() 66 addressEntries = networkInterface.addressEntries()
66 if len(addressEntries) > 0: 67 if len(addressEntries) > 0:
67 for addressEntry in addressEntries: 68 for addressEntry in addressEntries:
68 if ":" in addressEntry.ip().toString() and not socket.has_ipv6: 69 if ":" in addressEntry.ip().toString() and \
70 not socket.has_ipv6:
69 continue # IPv6 not supported by Python 71 continue # IPv6 not supported by Python
70 interfaces.append("{0} ({1})"\ 72 interfaces.append(
71 .format(networkInterface.humanReadableName(), 73 "{0} ({1})".format(
72 addressEntry.ip().toString())) 74 networkInterface.humanReadableName(),
75 addressEntry.ip().toString()))
73 self.interfacesCombo.addItems(interfaces) 76 self.interfacesCombo.addItems(interfaces)
74 interface = Preferences.getDebugger("NetworkInterface") 77 interface = Preferences.getDebugger("NetworkInterface")
75 if not socket.has_ipv6: 78 if not socket.has_ipv6:
76 # IPv6 not supported by Python 79 # IPv6 not supported by Python
77 self.all6InterfacesButton.setEnabled(False) 80 self.all6InterfacesButton.setEnabled(False)
83 self.all6InterfacesButton.setChecked(True) 86 self.all6InterfacesButton.setChecked(True)
84 else: 87 else:
85 self.selectedInterfaceButton.setChecked(True) 88 self.selectedInterfaceButton.setChecked(True)
86 index = -1 89 index = -1
87 for i in range(len(interfaces)): 90 for i in range(len(interfaces)):
88 if QRegExp(".*{0}.*".format(interface)).exactMatch(interfaces[i]): 91 if QRegExp(".*{0}.*".format(interface))\
92 .exactMatch(interfaces[i]):
89 index = i 93 index = i
90 break 94 break
91 self.interfacesCombo.setCurrentIndex(index) 95 self.interfacesCombo.setCurrentIndex(index)
92 96
93 self.allowedHostsList.addItems( 97 self.allowedHostsList.addItems(
225 [QAbstractSocket.IPv4Protocol, QAbstractSocket.IPv6Protocol]: 229 [QAbstractSocket.IPv4Protocol, QAbstractSocket.IPv6Protocol]:
226 self.allowedHostsList.addItem(allowedHost) 230 self.allowedHostsList.addItem(allowedHost)
227 else: 231 else:
228 E5MessageBox.critical(self, 232 E5MessageBox.critical(self,
229 self.trUtf8("Add allowed host"), 233 self.trUtf8("Add allowed host"),
230 self.trUtf8("""<p>The entered address <b>{0}</b> is not""" 234 self.trUtf8(
231 """ a valid IP v4 or IP v6 address. Aborting...</p>""")\ 235 """<p>The entered address <b>{0}</b> is not"""
236 """ a valid IP v4 or IP v6 address."""
237 """ Aborting...</p>""")\
232 .format(allowedHost)) 238 .format(allowedHost))
233 239
234 @pyqtSlot() 240 @pyqtSlot()
235 def on_deleteAllowedHostButton_clicked(self): 241 def on_deleteAllowedHostButton_clicked(self):
236 """ 242 """
255 [QAbstractSocket.IPv4Protocol, QAbstractSocket.IPv6Protocol]: 261 [QAbstractSocket.IPv4Protocol, QAbstractSocket.IPv6Protocol]:
256 self.allowedHostsList.currentItem().setText(allowedHost) 262 self.allowedHostsList.currentItem().setText(allowedHost)
257 else: 263 else:
258 E5MessageBox.critical(self, 264 E5MessageBox.critical(self,
259 self.trUtf8("Edit allowed host"), 265 self.trUtf8("Edit allowed host"),
260 self.trUtf8("""<p>The entered address <b>{0}</b> is not""" 266 self.trUtf8(
261 """ a valid IP v4 or IP v6 address. Aborting...</p>""")\ 267 """<p>The entered address <b>{0}</b> is not"""
268 """ a valid IP v4 or IP v6 address."""
269 """ Aborting...</p>""")\
262 .format(allowedHost)) 270 .format(allowedHost))
263 271
264 272
265 def create(dlg): 273 def create(dlg):
266 """ 274 """
267 Module function to create the configuration page. 275 Module function to create the configuration page.
268 276
269 @param dlg reference to the configuration dialog 277 @param dlg reference to the configuration dialog
278 @return reference to the instantiated page (ConfigurationPageBase)
270 """ 279 """
271 page = DebuggerGeneralPage() 280 page = DebuggerGeneralPage()
272 return page 281 return page

eric ide

mercurial