Skip to content

Commit

Permalink
馃悰 fix #37 edge.width() returns width not weight now
Browse files Browse the repository at this point in the history
  • Loading branch information
ehne committed Feb 12, 2022
1 parent fd37b7a commit 8aed324
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pynode_next/edge.py
Expand Up @@ -12,7 +12,7 @@ def __init__(self, source, target, weight="", directed=False):

self._weight = weight

self._thickness = 2
self._width = 2
self._priority = 0
self._color = Color.LIGHT_GREY

Expand Down Expand Up @@ -111,15 +111,15 @@ def directed(self):
"""Returns whether or not the edge is directed"""
return self._directed

def set_width(self, weight=2):
def set_width(self, width=2):
"""Sets the thickness of the edge."""
self._thickness = weight
self.__ax(lambda x: self._dispatch_wrapper(x, {"thickness": weight}))
self._width = width
self.__ax(lambda x: self._dispatch_wrapper(x, {"thickness": width}))
return self

def width(self):
"""Returns the thickness of the edge."""
return self._weight
return self._width

def set_priority(self, value):
"""Sets the edge's priority value."""
Expand All @@ -134,7 +134,7 @@ def highlight(self, color=None, width=None):
if color is None:
color = self._color
if width is None:
width = self._thickness * 2
width = self._width * 2

self.__ax(
lambda x: self._dispatch_wrapper(
Expand All @@ -145,7 +145,7 @@ def highlight(self, color=None, width=None):
pause(500)
self.__ax(
lambda x: self._dispatch_wrapper(
x, {"color": str(self._color), "thickness": self._thickness}
x, {"color": str(self._color), "thickness": self._width}
)
)
return self
Expand Down Expand Up @@ -196,7 +196,7 @@ def _data(self):
"target": str(self._target),
"directed": self._directed,
"labels": {1: {"text": str(self._weight)}},
"thickness": self._thickness,
"thickness": self._width,
}
}
}
Expand Down

0 comments on commit 8aed324

Please sign in to comment.