Nodz
Nodz copied to clipboard
scroll wheel zoom Qt5
hello, the mouse wheel crashes the app. So, in nodz_main.py, i changed 'event.delta() > 0' to 'event.angleDelta() > 0' ,
# tjp 02nov qt5 has angleDelta and pixel Delta if event.delta() > 0:
# angleDelta always increased despite wheel dir
# same for pixelDelta
if event.angleDelta() > 0:
zoomFactor = inFactor
else:
zoomFactor = outFactor
I never gto scrollwheel zoom to work but added KEY_PLUS and KEY_MINUS to do same
if event.key() == QtCore.Qt.Key_Plus:
zoomFactor = inFactor
self.scale(zoomFactor, zoomFactor)
self.currentState = 'DEFAULT'
if event.key() == QtCore.Qt.Key_Minus:
zoomFactor = outFactor
self.scale(zoomFactor, zoomFactor)
self.currentState = 'DEFAULT'
Also enabled the scroll bars to all paning hopriz & vert
#self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
#self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
Then changed the transparency to allow nets to show through nodes ( circumventing coding to avoid other nodes )
// Custom colors > Add and remove as you want.
// Don't forget to edit the end of the dictionary if editing the
// following part.
// 03nov2021 was "bg": [80, 80, 80, 255],
"node_preset_1": {
"bg": [80, 80, 80, 127],
"border": [50, 50, 50, 255],
"border_sel": [170, 80, 80, 255],
"text": [230, 230, 230, 255]
},
// 03nov2021 was "bg": [60, 60, 60, 255],
"attr_preset_1": {
"bg": [60, 60, 60, 127],
"text": [220, 220, 220, 255],
"plug": [255, 155, 0, 255],
"socket": [255, 155, 0, 255]
},
and added arrays of nodes
as in:
------------------mult2------------------------------
mult2 = [] mult2.append( nodz.createNode(name='mult2[0]', preset='node_preset_1', position=None) ) nodz.createAttribute(node=mult2[0], name='in0', index=-1, preset='attr_preset_1', plug=False, socket=True, dataType=float) nodz.createAttribute(node=mult2[0], name='out', index=-1, preset='attr_preset_1', plug=True, socket=False, dataType=float) nodz.createAttribute(node=mult2[0], name='in1', index=-1, preset='attr_preset_1', plug=False, socket=True, dataType=float)
------------------end mult2[0]------------------------------
------------------mult2[1]-----------------------------
mult2.append( nodz.createNode(name='mult2[1]', preset='node_preset_1', position=None) ) ....
thanks for a nice tool! I need to make a library of widgets and drag/drop from a palette and make visible names for the nets/signals/wires and allow custome widths
My application is to visulaize the Hal component files of the LinuxCNC project. thanks TomP 21:06 03nov2021 Thailand