Commit 0b182618 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[widgets][protocoltemplateeditor] Use validated input widgets

parent ce569f0d
......@@ -29,11 +29,11 @@ import pytest
import simplejson as json
from PyQt5 import QtCore
from PyQt5.QtWidgets import QInputDialog
from ..backend.asset import Asset
from ..backend.asset import AssetType
from ..backend.assetmodel import DataFormatModel
from ..widgets.dialogs import NameInputDialog
from ..widgets.protocoltemplateeditor import ProtocolTemplateEditor
from ..widgets.protocoltemplateeditor import SetWidget
......@@ -123,7 +123,7 @@ class TestProtocolTemplateEditor:
)
monkeypatch.setattr(
QInputDialog, "getText", classmethod(lambda *args: ("test_set", True))
NameInputDialog, "getText", classmethod(lambda *args: ("test_set", True))
)
editor = ProtocolTemplateEditor()
......
......@@ -29,7 +29,6 @@ from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import QFormLayout
from PyQt5.QtWidgets import QHBoxLayout
from PyQt5.QtWidgets import QHeaderView
from PyQt5.QtWidgets import QInputDialog
from PyQt5.QtWidgets import QLineEdit
from PyQt5.QtWidgets import QPushButton
from PyQt5.QtWidgets import QTableWidget
......@@ -41,6 +40,7 @@ from ..backend.asset import AssetType
from ..backend.assetmodel import DataFormatModel
from ..backend.delegates import AssetItemDelegate
from ..decorators import frozen
from .dialogs import NameInputDialog
from .editor import AbstractAssetEditor
from .scrollwidget import ScrollWidget
......@@ -225,9 +225,7 @@ class ProtocolTemplateEditor(AbstractAssetEditor):
set_names = [widget.name() for widget in self.set_widgets]
while True:
name, ok_pressed = QInputDialog.getText(
self, self.tr("Set name"), self.tr("Name")
)
name, ok_pressed = NameInputDialog.getText(self, self.tr("Set name"))
if not ok_pressed:
break
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment