Skip to content

Commit 43038e7

Browse files
committed
pass mouseClickedEvent to node widgets
1 parent de111f6 commit 43038e7

File tree

5 files changed

+14
-12
lines changed

5 files changed

+14
-12
lines changed

NodeGraphQt/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
3131
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3232
"""
33-
**NodeGraphQt** is a node graph framework that can be implemented and re purposed
33+
**NodeGraphQt** is a node graph Framework that can be implemented and re purposed
3434
into applications that supports **PySide2**.
3535
3636
project: https://github.com/jchanvfx/NodeGraphQt

NodeGraphQt/base/model.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ def set_property(self, name, value):
144144
elif name in self._custom_prop.keys():
145145
self._custom_prop[name] = value
146146
else:
147-
raise NodePropertyError('No property "{}"'.format(name))
147+
self._custom_prop[name] = value
148+
# raise NodePropertyError('No property "{}"'.format(name))
148149

149150
def get_property(self, name):
150151
if name in self.properties.keys():

NodeGraphQt/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from .pkg_info import __version__
55
from NodeGraphQt import QtWidgets
66

7-
#: Current version of the NodeGraphQt framework.
7+
#: Current version of the NodeGraphQt Framework.
88
VERSION = __version__
99

1010
# === PIPE ===

NodeGraphQt/widgets/actions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ def get_menu(self, name, node_id=None):
2727
return menu
2828
if node_id and menu.node_class:
2929
node = menu.graph.get_node_by_id(node_id)
30-
if isinstance(node,menu.node_class):
30+
if isinstance(node, menu.node_class):
3131
return menu
3232

3333
def get_menus(self, node_class):
3434
menus = []
3535
for action in self.actions():
3636
menu = action.menu()
3737
if menu.node_class:
38-
if issubclass(menu.node_class,node_class):
38+
if issubclass(menu.node_class, node_class):
3939
menus.append(menu)
4040
return menus
4141

NodeGraphQt/widgets/viewer.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def _set_viewer_zoom(self, value, sensitivity=None, pos=None):
131131
self.scale(scale, scale, pos)
132132

133133
def _set_viewer_pan(self, pos_x, pos_y):
134-
speed = self._scene_range.width() * 0.002
134+
speed = self._scene_range.width() * 0.0015
135135
x = -pos_x * speed
136136
y = -pos_y * speed
137137
self._scene_range.adjust(x, y, x, y)
@@ -201,7 +201,7 @@ def contextMenuEvent(self, event):
201201
nodes = [i for i in items if isinstance(i, AbstractNodeItem)]
202202
if nodes:
203203
node = nodes[0]
204-
ctx_menu = self._ctx_node_menu.get_menu(node.type_,node.id)
204+
ctx_menu = self._ctx_node_menu.get_menu(node.type_, node.id)
205205
if ctx_menu:
206206
for action in ctx_menu.actions():
207207
if not action.menu():
@@ -277,10 +277,11 @@ def mousePressEvent(self, event):
277277
self._rubber_band.show()
278278

279279
# allow new live pipe with the shift modifier.
280-
if self.LMB_state:
281-
if (not self.SHIFT_state and not self.CTRL_state) or\
282-
(self.SHIFT_state and pipes):
283-
super(NodeViewer, self).mousePressEvent(event)
280+
# if self.LMB_state:
281+
# if (not self.SHIFT_state and not self.CTRL_state) or\
282+
# (self.SHIFT_state and pipes):
283+
if not self._LIVE_PIPE.isVisible():
284+
super(NodeViewer, self).mousePressEvent(event)
284285

285286
def mouseReleaseEvent(self, event):
286287
if event.button() == QtCore.Qt.LeftButton:
@@ -397,7 +398,7 @@ def wheelEvent(self, event):
397398
if delta == 0:
398399
delta = event.angleDelta().x()
399400

400-
self._set_viewer_zoom(delta, pos = event.pos())
401+
self._set_viewer_zoom(delta, pos=event.pos())
401402

402403
def dropEvent(self, event):
403404
pos = self.mapToScene(event.pos())

0 commit comments

Comments
 (0)