Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added more plain node colours #228

Merged
merged 1 commit into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions pywr_editor/form/widgets/nodes/node_style_picker_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,16 @@ def __init__(
):
icon_class_type = getattr(pywr_editor.node_shapes, icon_class_name)
icon, label = get_pixmap_from_type(icon_size, icon_class_type)
self.combo_box.addItem(icon, label, icon_class_name)
self.combo_box.addItem(
icon,
# replace name for plain color nodes
(
f"Plain color - {label.replace(' circle', '').lower()}"
if "Circle" in icon_class_name
else label
),
icon_class_name,
)
name_key_map[icon_class_name.lower()] = icon_class_name

# select the icon
Expand All @@ -68,9 +77,11 @@ def __init__(
self.combo_box.setCurrentIndex(selected_index)

# connect slot to change the icon in the dialog title
# noinspection PyUnresolvedReferences
self.combo_box.currentIndexChanged.connect(self.on_value_changed)

# sort by name
self.combo_box.model().sort(0)

# layout
layout = QHBoxLayout(self)
layout.setContentsMargins(0, 0, 0, 0)
Expand Down
156 changes: 156 additions & 0 deletions pywr_editor/node_shapes/plain_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,159 @@ def __init__(self, parent: "SchematicNode"):
fill=Color("pink", 200),
outline=Color("pink", 600),
)


class StoneCircle(Circle):
def __init__(self, parent: "SchematicNode"):
"""
Initialises the shape for a stone circle.
"""
super().__init__(
parent=parent,
fill=Color("stone", 200),
outline=Color("stone", 600),
label=Color("stone", 700),
)


class AmberCircle(Circle):
def __init__(self, parent: "SchematicNode"):
"""
Initialises the shape for a amber circle.
"""
super().__init__(
parent=parent,
fill=Color("amber", 200),
outline=Color("amber", 600),
label=Color("amber", 700),
)


class YellowCircle(Circle):
def __init__(self, parent: "SchematicNode"):
"""
Initialises the shape for a yellow circle.
"""
super().__init__(
parent=parent,
fill=Color("yellow", 200),
outline=Color("yellow", 600),
label=Color("yellow", 700),
)


class LimeCircle(Circle):
def __init__(self, parent: "SchematicNode"):
"""
Initialises the shape for a lime circle.
"""
super().__init__(
parent=parent,
fill=Color("lime", 200),
outline=Color("lime", 600),
label=Color("lime", 700),
)


class EmeraldCircle(Circle):
def __init__(self, parent: "SchematicNode"):
"""
Initialises the shape for a emerald circle.
"""
super().__init__(
parent=parent,
fill=Color("emerald", 200),
outline=Color("emerald", 600),
label=Color("emerald", 700),
)


class TealCircle(Circle):
def __init__(self, parent: "SchematicNode"):
"""
Initialises the shape for a teal circle.
"""
super().__init__(
parent=parent,
fill=Color("teal", 200),
outline=Color("teal", 600),
label=Color("teal", 700),
)


class CyanCircle(Circle):
def __init__(self, parent: "SchematicNode"):
"""
Initialises the shape for a cyan circle.
"""
super().__init__(
parent=parent,
fill=Color("cyan", 200),
outline=Color("cyan", 600),
label=Color("cyan", 700),
)


class SkyCircle(Circle):
def __init__(self, parent: "SchematicNode"):
"""
Initialises the shape for a sky circle.
"""
super().__init__(
parent=parent,
fill=Color("sky", 200),
outline=Color("sky", 600),
label=Color("sky", 700),
)


class IndigoCircle(Circle):
def __init__(self, parent: "SchematicNode"):
"""
Initialises the shape for a indigo circle.
"""
super().__init__(
parent=parent,
fill=Color("indigo", 200),
outline=Color("indigo", 600),
label=Color("indigo", 700),
)


class VioletCircle(Circle):
def __init__(self, parent: "SchematicNode"):
"""
Initialises the shape for a violet circle.
"""
super().__init__(
parent=parent,
fill=Color("violet", 200),
outline=Color("violet", 600),
label=Color("violet", 700),
)


class FuchsiaCircle(Circle):
def __init__(self, parent: "SchematicNode"):
"""
Initialises the shape for a fuchsia circle.
"""
super().__init__(
parent=parent,
fill=Color("fuchsia", 200),
outline=Color("fuchsia", 600),
label=Color("fuchsia", 700),
)


class RoseCircle(Circle):
def __init__(self, parent: "SchematicNode"):
"""
Initialises the shape for a rose circle.
"""
super().__init__(
parent=parent,
fill=Color("rose", 300),
outline=Color("rose", 700),
label=Color("rose", 700),
)
Loading