Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Akascape authored May 21, 2023
1 parent 1212a7d commit ee9f9b4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion tknodesystem/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
License: MIT
"""

__version__ = '0.2'
__version__ = '0.4'

from .node_types import NodeValue, NodeOperation, NodeCompile
from .node_canvas import NodeCanvas
Expand Down
2 changes: 1 addition & 1 deletion tknodesystem/node_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def func_args(args):
'corner_radius': 25, 'border_width': 0, 'fg_color': '#37373D', 'text_color': 'white', 'font': ('', 10),
'highlightcolor': '#52d66c', 'hover': True, 'socket_color': 'green', 'socket_hover_color': 'grey50',
'x': None, 'y': None, 'multiside': False, 'output_socket_color': 'green', 'click_command': None,
'socket_hover': True, 'num': None}
'socket_hover': True, 'num': None, 'none_inputs': False}

args.pop("canvas")
args.pop("self")
Expand Down
2 changes: 1 addition & 1 deletion tknodesystem/node_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ def place_dropdown(self, x=None, y=None):

def _iconify(self, x=None, y=None):
self.focus_set()
self.search_entry.focus_set()
self._deiconify()
if self.focus_something: self.node[0].focus_set()
self.search_entry.focus_set()
self.place_dropdown(x,y)

def _attach_key_press(self, command):
Expand Down
29 changes: 17 additions & 12 deletions tknodesystem/node_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def configure(self, **kwargs):
class NodeOperation(Node):
def __init__(self, canvas, width=100, height=None, inputs=2, border_color='white', text=None,
socket_radius=8, corner_radius=25, border_width=0, fg_color='#37373D', text_color='white', font=("",10),
highlightcolor='#52d66c', hover=True, socket_color="green", socket_hover_color="grey50", x=0, y=0,
highlightcolor='#52d66c', hover=True, socket_color="green", socket_hover_color="grey50", x=0, y=0, none_inputs=False,
multiside=False, command=None, output_socket_color="green", click_command=None, socket_hover=True, num=None):

self.text = text
Expand Down Expand Up @@ -190,6 +190,7 @@ def __init__(self, canvas, width=100, height=None, inputs=2, border_color='white
self.socket_colors = []
self.connected_node = set()
self.connected_node_first = None
self.none_values = none_inputs
x_pos = x
y_pos = y

Expand Down Expand Up @@ -224,6 +225,7 @@ def __init__(self, canvas, width=100, height=None, inputs=2, border_color='white
self.cellinput5 = None
self.celloutput = None
self.socket_nums = []
self.values_args = []

self.output_ = NodeSocket(canvas, radius=socket_radius, center=(width+(width/2),height),
fg_color=output_socket_color, hover_color=socket_hover_color, socket_num=num[0] if num else None,
Expand Down Expand Up @@ -424,26 +426,26 @@ def update(self):
self.cellinput3,
self.cellinput4,
self.cellinput5]
values_args = []
self.values_args = []
if self.command:
for i in arguments[0:self.inputs]:
if i is None:
self.output_.value = None
break
self.values_args.append(None)
else:
self.output_.value = 1
values_args.append(i.output_.value)

if self.output_.value:
for i in values_args:
self.values_args.append(i.output_.value)

if not self.none_values:
for i in self.values_args:
if i is None:
self.output_.value = None
break
else:
self.output_.value = 1

if self.output_.value:
self.output_.value = self.command(*values_args[0:self.inputs])
else:
self.output_.value = 1

if self.output_.value:
self.output_.value = self.command(*self.values_args[0:self.inputs])
else:
self.output_.value = None

Expand All @@ -455,6 +457,9 @@ def get(self):
""" get the current value of node """
return self.output_.value

def get_inputs(self):
return self.values_args

def destroy(self):
if self.ID not in self.canvas.find_all(): return
self.output_.value = None
Expand Down

0 comments on commit ee9f9b4

Please sign in to comment.