|
1 | 1 | #!/usr/bin/python |
2 | | - |
3 | 2 | from collections import OrderedDict |
| 3 | + |
| 4 | +from Qt import QtGui, QtCore, QtWidgets |
| 5 | + |
4 | 6 | from .node_abstract import AbstractNodeItem |
5 | 7 | from .node_text_item import NodeTextItem |
6 | 8 | from .port import PortItem, CustomPortItem |
7 | | -from .. import QtGui, QtCore, QtWidgets |
8 | 9 | from ..constants import (IN_PORT, OUT_PORT, |
9 | 10 | NODE_WIDTH, NODE_HEIGHT, |
10 | 11 | NODE_ICON_SIZE, ICON_NODE_BASE, |
@@ -609,7 +610,7 @@ def height(self, height=0.0): |
609 | 610 | def disabled(self, state=False): |
610 | 611 | AbstractNodeItem.disabled.fset(self, state) |
611 | 612 | for n, w in self._widgets.items(): |
612 | | - w.get_custom_widget().setDisabled(state) |
| 613 | + w.widget().setDisabled(state) |
613 | 614 | self._tooltip_disable(state) |
614 | 615 | self._x_item.setVisible(state) |
615 | 616 |
|
@@ -1037,37 +1038,39 @@ def calc_size(self, add_w=0.0, add_h=0.0): |
1037 | 1038 | return width, height |
1038 | 1039 |
|
1039 | 1040 | def add_input(self, name='input', multi_port=False, display_name=True, |
1040 | | - painter_func=None): |
| 1041 | + locked=False, painter_func=None): |
1041 | 1042 | """ |
1042 | 1043 | Adds a port qgraphics item into the node with the "port_type" set as |
1043 | 1044 | IN_PORT |
1044 | 1045 |
|
1045 | 1046 | Args: |
1046 | 1047 | name (str): name for the port. |
1047 | 1048 | multi_port (bool): allow multiple connections. |
1048 | | - display_name (bool): (not used) |
| 1049 | + display_name (bool): (not used). |
| 1050 | + locked (bool): locked state. |
1049 | 1051 | painter_func (function): custom paint function. |
1050 | 1052 |
|
1051 | 1053 | Returns: |
1052 | 1054 | PortItem: port qgraphics item. |
1053 | 1055 | """ |
1054 | 1056 | return super(NodeItemVertical, self).add_input( |
1055 | | - name, multi_port, False, painter_func) |
| 1057 | + name, multi_port, False, locked, painter_func) |
1056 | 1058 |
|
1057 | | - def add_output(self, name='output', multi_port=False, display_name=False, |
1058 | | - painter_func=None): |
| 1059 | + def add_output(self, name='output', multi_port=False, display_name=True, |
| 1060 | + locked=False, painter_func=None): |
1059 | 1061 | """ |
1060 | 1062 | Adds a port qgraphics item into the node with the "port_type" set as |
1061 | 1063 | OUT_PORT |
1062 | 1064 |
|
1063 | 1065 | Args: |
1064 | 1066 | name (str): name for the port. |
1065 | 1067 | multi_port (bool): allow multiple connections. |
1066 | | - display_name (bool): (not used) |
| 1068 | + display_name (bool): (not used). |
| 1069 | + locked (bool): locked state. |
1067 | 1070 | painter_func (function): custom paint function. |
1068 | 1071 |
|
1069 | 1072 | Returns: |
1070 | 1073 | PortItem: port qgraphics item. |
1071 | 1074 | """ |
1072 | 1075 | return super(NodeItemVertical, self).add_output( |
1073 | | - name, multi_port, False, painter_func) |
| 1076 | + name, multi_port, False, locked, painter_func) |
0 commit comments