Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.editor
Commits
8ee5e1b9
Commit
8ee5e1b9
authored
Jan 11, 2019
by
Samuel GAIST
Browse files
[widgets][field] Rename Field to FieldWidget
parent
dabb3244
Changes
2
Hide whitespace changes
Inline
Side-by-side
beat/editor/test/test_editors.py
View file @
8ee5e1b9
...
...
@@ -32,7 +32,7 @@ from PyQt5.QtWidgets import QPushButton
from
PyQt5.QtWidgets
import
QVBoxLayout
from
..widgets.editor
import
AbstractAssetEditor
from
..widgets.field
import
Field
from
..widgets.field
import
Field
Widget
class
MockAssetEditor
(
AbstractAssetEditor
):
...
...
@@ -50,7 +50,7 @@ class MockAssetEditor(AbstractAssetEditor):
self
.
add_field_button
.
clicked
.
connect
(
self
.
__add_field
)
def
__add_field
(
self
):
self
.
layout
().
addWidget
(
Field
(
self
.
dataformat_model
))
self
.
layout
().
addWidget
(
Field
Widget
(
self
.
dataformat_model
))
def
set_dataformat_model
(
self
,
model
):
self
.
dataformat_model
=
model
...
...
@@ -59,7 +59,7 @@ class MockAssetEditor(AbstractAssetEditor):
"""Load the json object passed as parameter"""
for
name
,
type_
in
json_object
.
items
():
field
=
Field
(
self
.
dataformat_model
)
field
=
Field
Widget
(
self
.
dataformat_model
)
field
.
format_name
=
name
field
.
format_type
=
type_
self
.
layout
().
addWidget
(
field
)
...
...
@@ -67,7 +67,7 @@ class MockAssetEditor(AbstractAssetEditor):
def
dump_json
(
self
):
"""Returns the json representation of the asset"""
field_list
=
self
.
findChildren
(
Field
)
field_list
=
self
.
findChildren
(
Field
Widget
)
json_data
=
{}
...
...
@@ -99,7 +99,7 @@ class TestMockEditor:
widget
.
set_dataformat_model
(
dataformat_model
)
qtbot
.
mouseClick
(
widget
.
add_field_button
,
QtCore
.
Qt
.
LeftButton
)
fields
=
widget
.
findChildren
(
Field
)
fields
=
widget
.
findChildren
(
Field
Widget
)
assert
len
(
fields
)
==
1
...
...
@@ -111,7 +111,7 @@ class TestMockEditor:
assert
widget
.
dump_json
()
==
{
"value32"
:
"float32"
}
qtbot
.
mouseClick
(
widget
.
add_field_button
,
QtCore
.
Qt
.
LeftButton
)
fields
=
widget
.
findChildren
(
Field
)
fields
=
widget
.
findChildren
(
Field
Widget
)
assert
len
(
fields
)
==
2
...
...
beat/editor/widgets/field.py
View file @
8ee5e1b9
...
...
@@ -29,11 +29,13 @@ from PyQt5.QtWidgets import QLineEdit
from
PyQt5.QtWidgets
import
QWidget
class
Field
(
QWidget
):
class
Field
Widget
(
QWidget
):
"""Class representing a dataformat field"""
def
__init__
(
self
,
dataformat_model
,
parent
=
None
):
super
(
Field
,
self
).
__init__
(
parent
)
"""Constructor"""
super
(
FieldWidget
,
self
).
__init__
(
parent
)
self
.
dataformat_name
=
QLineEdit
()
self
.
dataformat_box
=
QComboBox
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment