src/eric7/EricNetwork/EricHostnameInputWidget.py

branch
eric7
changeset 10153
ffe7432f716b
child 10167
0a62a4bf749c
equal deleted inserted replaced
10152:33e7b9d3f91c 10153:ffe7432f716b
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2023 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing an input widget for network host names.
8 """
9
10 from PyQt6.QtCore import QRegularExpression
11 from PyQt6.QtGui import QRegularExpressionValidator
12 from PyQt6.QtWidgets import QLineEdit
13
14
15 class EricHostnameInputWidget(QLineEdit):
16 """
17 Class implementing an input widget for network host names.
18 """
19 def __init__(self, parent=None):
20 """
21 Constructor
22
23 @param parent reference to the parent widget (defaults to None)
24 @type QWidget (optional)
25 """
26 super().__init__(parent)
27
28 self.setClearButtonEnabled(True)
29
30 self.setValidator(
31 QRegularExpressionValidator(
32 QRegularExpression(
33 r"""([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])"""
34 )
35 )
36 )
37 self.setMaxLength(63)

eric ide

mercurial