Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Commit

Permalink
fixed the hoover/hover typo (#1045)
Browse files Browse the repository at this point in the history
* fixed the hoover/hover typo

* Update NeXus HTML documentation

---------

Co-authored-by: cow-bot <[email protected]>
  • Loading branch information
mattclarke and cow-bot authored Nov 22, 2023
1 parent 8650323 commit 14a4292
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 67 deletions.
14 changes: 7 additions & 7 deletions nexus_constructor/instrument_view/entity_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self, root_entity: Qt3DCore.QEntity, nx_class: str):
] = []
(
self.default_material,
self.hoover_material,
self.hover_material,
self.material_family,
) = self._create_default_material()

Expand Down Expand Up @@ -57,7 +57,7 @@ def __init__(self, mesh: OffMesh, root_entity: Qt3DCore.QEntity, nx_class: str):
self._mesh = mesh
(
self.default_material,
self.hoover_material,
self.hover_material,
self.material_family,
) = create_material(nx_class, root_entity)

Expand All @@ -66,7 +66,7 @@ def create_entities(self):
create_qentity([self._mesh, self.default_material], self.root_entity)
)
self.entities[-1].default_material = self.default_material
self.entities[-1].hoover_material = self.hoover_material
self.entities[-1].hover_material = self.hover_material
self.entities[-1].material_family = self.material_family

def add_transformation(self, transformation: Qt3DCore.QComponent):
Expand Down Expand Up @@ -135,7 +135,7 @@ def _create_source(self):
cone_transform.setMatrix(self._get_cylinder_transformation_matrix())
(
cylinder_material,
cylinder_hoover_material,
cylinder_hover_material,
cylinder_material_family,
) = create_material("beam_material", self.root_entity)

Expand All @@ -149,7 +149,7 @@ def _create_source(self):
)
)
self.entities[-1][0].default_material = cylinder_material
self.entities[-1][0].hoover_material = cylinder_hoover_material
self.entities[-1][0].hover_material = cylinder_hover_material
self.entities[-1][0].material_family = cylinder_material_family

def _setup_neutrons(self):
Expand All @@ -163,7 +163,7 @@ def _setup_neutrons(self):
)
(
neutron_material,
neutron_hoover_material,
neutron_hover_material,
neutron_material_family,
) = create_material("neutron_material", self.root_entity)
entity = create_qentity(
Expand Down Expand Up @@ -223,7 +223,7 @@ def __init__(self, root_entity: Qt3DCore.QEntity):
)
(
self.default_material,
self.hoover_material,
self.hover_material,
self.material_family,
) = create_material("ground", root_entity)

Expand Down
10 changes: 5 additions & 5 deletions nexus_constructor/instrument_view/gnomon.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ def __init__(self, root_entity, main_camera):

(
self.x_material,
self.x_hoover_material,
self.x_hover_material,
self.x_material_family,
) = create_material("x_material", root_entity, remove_shininess=True)
(
self.y_material,
self.y_hoover_material,
self.y_hover_material,
self.y_material_family,
) = create_material("y_material", root_entity, remove_shininess=True)
(
self.z_material,
self.z_hoover_material,
self.z_hover_material,
self.z_material_family,
) = create_material("z_material", root_entity, remove_shininess=True)

Expand Down Expand Up @@ -377,7 +377,7 @@ def setup_beam_cylinder(self):
cylinder_mesh, 1.5, self.neutron_animation_length, 2
)
self.set_beam_transform(cylinder_transform, self.neutron_animation_length)
beam_material, beam_hoover_material, beam_material_family = create_material(
beam_material, beam_hover_material, beam_material_family = create_material(
"beam_material", self.gnomon_root_entity
)
entity = create_qentity(
Expand Down Expand Up @@ -452,7 +452,7 @@ def setup_neutrons(self):

(
neutron_material,
neutron_hoover_material,
neutron_hover_material,
neutron_material_family,
) = create_material("neutron_material", self.gnomon_root_entity)

Expand Down
6 changes: 3 additions & 3 deletions nexus_constructor/instrument_view/instrument_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ def select_component(self, name: str):
for e in entity.entities:
if isinstance(e, tuple):
e = e[0]
if not e.hoover_material:
if not e.hover_material:
continue
try:
if key == name:
Expand Down Expand Up @@ -495,14 +495,14 @@ def updateRenderedMaterials(self, material_name, color_state):
if material_family == material_name:
(
new_default_material,
new_hoover_material,
new_hover_material,
new_material_family,
) = create_material(
material_name,
parent_entity,
)
entity.default_material = new_default_material
entity.hoover_material = new_hoover_material
entity.hover_material = new_hover_material
if entity.clicked or entity.inside:
entity.switch_to_normal()
entity.switch_to_highlight()
Expand Down
2 changes: 1 addition & 1 deletion nexus_constructor/instrument_view/instrument_view_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self, component_root_entity: Qt3DCore.QEntity, line_length: float):
)

self.set_mesh_properties(mesh, geometry)
material, hoover_material, material_family = create_material(
material, hover_material, material_family = create_material(
material_name, component_root_entity
)
self.entities.append(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def mousePressEvent(self, event):
e.clicked = True
self.main_window.model.signals.entity_selected.emit(e)
elif not e.inside:
if e.hoover_material:
e.removeComponent(e.hoover_material)
if e.hover_material:
e.removeComponent(e.hover_material)
e.addComponent(e.default_material)
e.clicked = False
except Exception:
Expand Down
56 changes: 28 additions & 28 deletions nexus_constructor/instrument_view/qentity_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"shadows": QColor("#9f9f9f"),
"highlights": QColor("#dbdbdb"),
},
"hoover_state": {
"hover_state": {
"shadows": QColor("#275fff"),
"highlights": QColor("#99e6ff"),
},
Expand All @@ -23,7 +23,7 @@
"shadows": QColor("#f8dd9e"),
"highlights": QColor("#b69442"),
},
"hoover_state": {
"hover_state": {
"shadows": QColor("#f8dd9e"),
"highlights": QColor("#b69442"),
},
Expand All @@ -35,7 +35,7 @@
"highlights": QColor("darkgreen"),
"alpha": 0.75,
},
"hoover_state": {
"hover_state": {
"shadows": QColor("green"),
"highlights": QColor("darkgreen"),
"alpha": 1.0,
Expand All @@ -48,7 +48,7 @@
"highlights": QColor("grey"),
"alpha": 0.5,
},
"hoover_state": {
"hover_state": {
"shadows": QColor("red"),
"highlights": QColor("grey"),
"alpha": 0.75,
Expand All @@ -60,7 +60,7 @@
"shadows": QColor(255, 0, 0),
"highlights": QColor(255, 100, 100),
},
"hoover_state": {
"hover_state": {
"shadows": QColor(255, 0, 0),
"highlights": QColor(255, 100, 100),
},
Expand All @@ -71,7 +71,7 @@
"shadows": QColor(0, 255, 0),
"highlights": QColor(100, 255, 100),
},
"hoover_state": {
"hover_state": {
"shadows": QColor(0, 255, 0),
"highlights": QColor(100, 255, 100),
},
Expand All @@ -82,7 +82,7 @@
"shadows": QColor(0, 0, 255),
"highlights": QColor(100, 100, 255),
},
"hoover_state": {
"hover_state": {
"shadows": QColor(0, 0, 255),
"highlights": QColor(100, 100, 255),
},
Expand All @@ -94,7 +94,7 @@
"highlights": QColor("lightblue"),
"alpha": 0.5,
},
"hoover_state": {
"hover_state": {
"shadows": QColor("blue"),
"highlights": QColor("lightblue"),
"alpha": 0.75,
Expand All @@ -106,7 +106,7 @@
"shadows": QColor("black"),
"highlights": QColor("grey"),
},
"hoover_state": {
"hover_state": {
"shadows": QColor("black"),
"highlights": QColor("grey"),
},
Expand All @@ -123,7 +123,7 @@ def __init__(self, parent, picker=True):
self.inside = False
self.old_mesh = None
self.default_material = None
self.hoover_material = None
self.hover_material = None
self.material_family = None

if picker:
Expand All @@ -137,13 +137,13 @@ def __init__(self, parent, picker=True):
def switch_to_highlight(self):
try:
self.removeComponent(self.default_material)
self.addComponent(self.hoover_material)
self.addComponent(self.hover_material)
except Exception:
pass

def switch_to_normal(self):
try:
self.removeComponent(self.hoover_material)
self.removeComponent(self.hover_material)
self.addComponent(self.default_material)
except Exception:
pass
Expand Down Expand Up @@ -186,15 +186,15 @@ def create_material(
]:
if material_name not in MATERIAL_DICT.keys():
normal_material = MATERIAL_DICT["DEFAULT"]["material_type"].__call__(parent)
hoover_material = MATERIAL_DICT["DEFAULT"]["material_type"].__call__(parent)
hover_material = MATERIAL_DICT["DEFAULT"]["material_type"].__call__(parent)
normal_material.setCool(MATERIAL_DICT["DEFAULT"]["normal_state"]["shadows"])
normal_material.setWarm(MATERIAL_DICT["DEFAULT"]["normal_state"]["highlights"])
hoover_material.setCool(MATERIAL_DICT["DEFAULT"]["hoover_state"]["shadows"])
hoover_material.setWarm(MATERIAL_DICT["DEFAULT"]["hoover_state"]["highlights"])
hover_material.setCool(MATERIAL_DICT["DEFAULT"]["hover_state"]["shadows"])
hover_material.setWarm(MATERIAL_DICT["DEFAULT"]["hover_state"]["highlights"])
material_family = "DEFAULT"
else:
normal_material = MATERIAL_DICT[material_name]["material_type"].__call__(parent)
hoover_material = MATERIAL_DICT[material_name]["material_type"].__call__(parent)
hover_material = MATERIAL_DICT[material_name]["material_type"].__call__(parent)
material_family = material_name
if isinstance(normal_material, Qt3DExtras.QGoochMaterial):
normal_material.setCool(
Expand All @@ -203,11 +203,11 @@ def create_material(
normal_material.setWarm(
MATERIAL_DICT[material_name]["normal_state"]["highlights"]
)
hoover_material.setCool(
MATERIAL_DICT[material_name]["hoover_state"]["shadows"]
hover_material.setCool(
MATERIAL_DICT[material_name]["hover_state"]["shadows"]
)
hoover_material.setWarm(
MATERIAL_DICT[material_name]["hoover_state"]["highlights"]
hover_material.setWarm(
MATERIAL_DICT[material_name]["hover_state"]["highlights"]
)
elif isinstance(
normal_material, (Qt3DExtras.QPhongMaterial, Qt3DExtras.QPhongAlphaMaterial)
Expand All @@ -218,26 +218,26 @@ def create_material(
normal_material.setDiffuse(
MATERIAL_DICT[material_name]["normal_state"]["highlights"]
)
hoover_material.setAmbient(
MATERIAL_DICT[material_name]["hoover_state"]["shadows"]
hover_material.setAmbient(
MATERIAL_DICT[material_name]["hover_state"]["shadows"]
)
hoover_material.setDiffuse(
MATERIAL_DICT[material_name]["hoover_state"]["highlights"]
hover_material.setDiffuse(
MATERIAL_DICT[material_name]["hover_state"]["highlights"]
)

if isinstance(normal_material, Qt3DExtras.QPhongAlphaMaterial):
normal_material.setAlpha(
MATERIAL_DICT[material_name]["normal_state"]["alpha"]
)
hoover_material.setAlpha(
MATERIAL_DICT[material_name]["hoover_state"]["alpha"]
hover_material.setAlpha(
MATERIAL_DICT[material_name]["hover_state"]["alpha"]
)

if remove_shininess:
normal_material.setShininess(0)
hoover_material.setShininess(0)
hover_material.setShininess(0)

return normal_material, hoover_material, material_family
return normal_material, hover_material, material_family


def create_qentity(
Expand Down
2 changes: 1 addition & 1 deletion nx-class-documentation/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ <h1>User Manual and Reference Documentation<a class="headerlink" href="#user-man
</div>
<hr class="docutils" />
<p class="rubric">Publishing Information</p>
<p>This manual built Oct 26, 2023.</p>
<p>This manual built Nov 21, 2023.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p>This document is available in these formats online:</p>
Expand Down
2 changes: 1 addition & 1 deletion nx-class-documentation/html/searchindex.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions tests/instrument_view/test_qentity_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_GIVEN_material_properties_WHEN_calling_set_material_properties_THEN_pro
ambient = Mock()
diffuse = Mock()

mock_material, mock_hoover_material = create_material("x_material", None)
mock_material, mock_hover_material = create_material("x_material", None)

mock_material.setAmbient.assert_called_once_with(ambient)
mock_material.setDiffuse.assert_called_once_with(diffuse)
Expand All @@ -26,7 +26,7 @@ def test_GIVEN_alpha_material_properties_WHEN_calling_set_material_properties_TH
diffuse = Mock()
alpha = 0.5

mock_alpha_material, mock_hoover_material = create_material("beam_material", None)
mock_alpha_material, mock_hover_material = create_material("beam_material", None)

mock_alpha_material.setAmbient.assert_called_once_with(ambient)
mock_alpha_material.setDiffuse.assert_called_once_with(diffuse)
Expand All @@ -39,7 +39,7 @@ def test_GIVEN_shininess_argument_WHEN_calling_set_material_properties_THEN_shin
ambient = Mock()
diffuse = Mock()

mock_material, mock_hoover_material = create_material(
mock_material, mock_hover_material = create_material(
"x_material", None, remove_shininess=True
)

Expand Down
Loading

0 comments on commit 14a4292

Please sign in to comment.