Commit 4e0f05b6 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[widgets][field] Rename Field to FieldWidget

parent 8809e7f3
...@@ -32,7 +32,7 @@ from PyQt5.QtWidgets import QPushButton ...@@ -32,7 +32,7 @@ from PyQt5.QtWidgets import QPushButton
from PyQt5.QtWidgets import QVBoxLayout from PyQt5.QtWidgets import QVBoxLayout
from ..widgets.editor import AbstractAssetEditor from ..widgets.editor import AbstractAssetEditor
from ..widgets.field import Field from ..widgets.field import FieldWidget
class MockAssetEditor(AbstractAssetEditor): class MockAssetEditor(AbstractAssetEditor):
...@@ -50,7 +50,7 @@ class MockAssetEditor(AbstractAssetEditor): ...@@ -50,7 +50,7 @@ class MockAssetEditor(AbstractAssetEditor):
self.add_field_button.clicked.connect(self.__add_field) self.add_field_button.clicked.connect(self.__add_field)
def __add_field(self): def __add_field(self):
self.layout().addWidget(Field(self.dataformat_model)) self.layout().addWidget(FieldWidget(self.dataformat_model))
def set_dataformat_model(self, model): def set_dataformat_model(self, model):
self.dataformat_model = model self.dataformat_model = model
...@@ -59,7 +59,7 @@ class MockAssetEditor(AbstractAssetEditor): ...@@ -59,7 +59,7 @@ class MockAssetEditor(AbstractAssetEditor):
"""Load the json object passed as parameter""" """Load the json object passed as parameter"""
for name, type_ in json_object.items(): for name, type_ in json_object.items():
field = Field(self.dataformat_model) field = FieldWidget(self.dataformat_model)
field.format_name = name field.format_name = name
field.format_type = type_ field.format_type = type_
self.layout().addWidget(field) self.layout().addWidget(field)
...@@ -67,7 +67,7 @@ class MockAssetEditor(AbstractAssetEditor): ...@@ -67,7 +67,7 @@ class MockAssetEditor(AbstractAssetEditor):
def dump_json(self): def dump_json(self):
"""Returns the json representation of the asset""" """Returns the json representation of the asset"""
field_list = self.findChildren(Field) field_list = self.findChildren(FieldWidget)
json_data = {} json_data = {}
...@@ -99,7 +99,7 @@ class TestMockEditor: ...@@ -99,7 +99,7 @@ class TestMockEditor:
widget.set_dataformat_model(dataformat_model) widget.set_dataformat_model(dataformat_model)
qtbot.mouseClick(widget.add_field_button, QtCore.Qt.LeftButton) qtbot.mouseClick(widget.add_field_button, QtCore.Qt.LeftButton)
fields = widget.findChildren(Field) fields = widget.findChildren(FieldWidget)
assert len(fields) == 1 assert len(fields) == 1
...@@ -111,7 +111,7 @@ class TestMockEditor: ...@@ -111,7 +111,7 @@ class TestMockEditor:
assert widget.dump_json() == {"value32": "float32"} assert widget.dump_json() == {"value32": "float32"}
qtbot.mouseClick(widget.add_field_button, QtCore.Qt.LeftButton) qtbot.mouseClick(widget.add_field_button, QtCore.Qt.LeftButton)
fields = widget.findChildren(Field) fields = widget.findChildren(FieldWidget)
assert len(fields) == 2 assert len(fields) == 2
......
...@@ -29,11 +29,13 @@ from PyQt5.QtWidgets import QLineEdit ...@@ -29,11 +29,13 @@ from PyQt5.QtWidgets import QLineEdit
from PyQt5.QtWidgets import QWidget from PyQt5.QtWidgets import QWidget
class Field(QWidget): class FieldWidget(QWidget):
"""Class representing a dataformat field""" """Class representing a dataformat field"""
def __init__(self, dataformat_model, parent=None): def __init__(self, dataformat_model, parent=None):
super(Field, self).__init__(parent) """Constructor"""
super(FieldWidget, self).__init__(parent)
self.dataformat_name = QLineEdit() self.dataformat_name = QLineEdit()
self.dataformat_box = QComboBox() self.dataformat_box = QComboBox()
......
Supports Markdown
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