Skip to content
Snippets Groups Projects

Add typing, renaming, convenience methods/properties

Merged Oscar Gustafsson requested to merge typing into master
Files
4
+ 23
3
@@ -83,11 +83,20 @@ class DragButton(QPushButton):
self._context_menu = menu
self._context_menu.exec_(self.cursor().pos())
def show_properties_window(self, event=None):
def show_properties_window(self, event=None) -> None:
"""Display the properties window for the associated Operation."""
self._properties_window = PropertiesWindow(self, self._window)
self._properties_window.show()
def add_label(self, label):
def add_label(self, label: str) -> None:
"""
Add label to button.
Parameters
----------
label : src
The label to add.
"""
self.label = label
def mousePressEvent(self, event):
@@ -101,6 +110,7 @@ class DragButton(QPushButton):
@property
def port_list(self) -> List[PortButton]:
"""Return a list of PortButtons."""
return self._ports
def mouseMoveEvent(self, event):
@@ -173,7 +183,15 @@ class DragButton(QPushButton):
"""Return True if the button is flipped (inputs to the right)."""
return self._flipped
def select_button(self, modifiers=None):
def select_button(self, modifiers=None) -> None:
"""
Select button taking *modifiers* into account.
Parameters
----------
modifiers : optional
Qt keyboard modifier.
"""
if modifiers != Qt.KeyboardModifier.ControlModifier:
for button in self._window._pressed_operations:
button._toggle_button(button.pressed)
@@ -240,6 +258,8 @@ class DragButton(QPushButton):
del self._window._drag_buttons[self.operation]
def add_ports(self):
"""Add ports to button."""
def _determine_port_distance(opheight, ports):
"""
Determine the distance between each port on the side of an operation.
Loading