Use a separate function to validate IP address

CURA-6483
This commit is contained in:
Lipu Fei 2019-04-29 15:52:21 +02:00
parent defcba6927
commit c8872cb4a1
4 changed files with 79 additions and 1 deletions

21
cura/Utils/QtUtil.py Normal file
View file

@ -0,0 +1,21 @@
# Copyright (c) 2019 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from typing import Optional
from PyQt5.QtCore import QObject, pyqtSlot
from . import networking
#
# Exposes the util functions to QML using a QObject.
#
class QtUtil(QObject):
def __init__(self, parent: Optional["QObject"] = None) -> None:
super().__init__(parent = parent)
@pyqtSlot(str, result = bool)
def isValidIP(self, address: str) -> bool:
return networking.isValidIP(address)