Skip to content

Commit fad2948

Browse files
committed
Dev Push
1 parent f9c5f55 commit fad2948

11 files changed

+41
-225
lines changed

nodeeditor/node_editor_widget.py

+19-6
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,11 @@ def run_code(self):
352352
output = output.decode('UTF-8')
353353
error = error.decode('UTF-8')
354354

355-
colorStyle = f''' style=" Font-size:12px ; color: #FF3333;" '''
356-
code = f""" <pre><p style="font-family: Roboto "><span {colorStyle} >{error}</span></p></pre> """
355+
colorStyle = f''' '''
356+
code = f""" <pre><p style="font-family: Roboto "><span style=" Font-size:12px ; color: #FF3333;">{error}</span></p></pre> """
357+
code_2 = f""" <pre><p style="font-family: Roboto "><span style=" Font-size:12px ; color: #FFFFFF;">{output}</span></p></pre> """
357358

358-
self.code_output.append(output)
359+
self.code_output.append(code_2)
359360
self.code_output.append(code)
360361

361362
def get_project_directory(self):
@@ -399,7 +400,8 @@ def syntax_changed(self):
399400

400401
def get_imports(self):
401402
syntax = self.syntax_selector.currentText()
402-
403+
if not self.scene.user_nodes_wdg:return []
404+
user_data = self.scene.user_nodes_wdg.user_nodes_data
403405
imports = []
404406
if syntax == "C++":
405407

@@ -416,7 +418,7 @@ def get_imports(self):
416418
if used_node_types.__contains__(Print.node_type):
417419
imports.append(f'#include <iostream>')
418420

419-
for data in self.scene.user_nodes_wdg.user_nodes_data:
421+
for data in user_data:
420422
if data[2] == StringVar.node_type:
421423
imports.append("#include <string>")
422424
# elif data[2] == ListVar.node_type:
@@ -428,15 +430,21 @@ def get_imports(self):
428430
elif [FloatVar, IntegerVar, BooleanVar, StringVar].__contains__(data[3]):
429431
imports.append(f'extern {value[data[2]]}{self.get_node_return(syntax, data[3])}{data[0]};')
430432

433+
elif syntax == 'Python':
434+
for item in user_data:
435+
if item[4] == 'array' and not imports.__contains__('from array import array'):
436+
imports.append('from array import array')
437+
438+
431439
imports.sort()
432440
return imports
433441

434442
def UpdateTextCode(self):
435443
current_syntax = self.syntax_selector.currentText()
444+
imports = self.get_imports()
436445

437446
if current_syntax == "C++":
438447
self.header_wnd.clear()
439-
imports = self.get_imports()
440448
for item in imports:
441449
self.header_wnd.append(item)
442450
self.header_wnd.append('')
@@ -453,6 +461,11 @@ def UpdateTextCode(self):
453461

454462
else:
455463
self.text_code_wnd.clear()
464+
465+
for item in imports:
466+
self.text_code_wnd.append(item)
467+
self.text_code_wnd.append('')
468+
456469
for node in self.scene.nodes:
457470
node.syntax = current_syntax
458471

nodeeditor/node_editor_window.py

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def __init__(self):
4040

4141
self.set_nodes_icons()
4242

43+
4344
def set_nodes_icons(self):
4445
for cls in MasterNode.__subclasses__():
4546
icon = os.path.split(cls.icon)[-1]

nodeeditor/node_graphics_scene.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def initAssets(self):
5555

5656
def update_background_color(self, background_color:str="555555", grid_lines_color:str="555555"):
5757
if self.scene.masterRef.global_switches.switches_Dict["Appearance"]["Theme"][0] == "Dark":
58-
background_color = "393939"
58+
background_color = "404040"
5959
grid_lines_color = "292929"
6060
elif self.scene.masterRef.global_switches.switches_Dict["Appearance"]["Theme"][0] == "Light":
6161
background_color = "e0e0e0"

nodeeditor/node_socket.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ def __init__(self, socket: 'Socket'):
8989

9090
# self.paint = self.myPaint
9191
self.initAssets()
92+
self._brush = QBrush(self.getSocketColor(self.socket.original_socket_type))
9293

9394
# shadow = QGraphicsDropShadowEffect()
9495
# shadow.setXOffset(-2)
@@ -145,7 +146,7 @@ def getHoveredSocketColor(self, key):
145146
return QColor(key)
146147
return Qt.transparent
147148

148-
def changeSocketType(self):
149+
def changeGrSocketType(self):
149150
"""Change the Socket Type"""
150151
self._current_color = self.getSocketColor(self.socket.original_socket_type)
151152
self._brush = QBrush(self._current_color)
@@ -248,7 +249,7 @@ def __init__(self, node: 'Node', index: int = 0, position: int = LEFT_TOP, socke
248249
self.socket_code = self.node.name
249250
self.position = position
250251
self.index = index
251-
self.socket_type = socket_type
252+
self.socket_type = 5 if self.node.node_structure == 'array' and socket_type != 0 else socket_type
252253
self.original_socket_type = socket_type
253254
self.count_on_this_node_side = count_on_this_node_side
254255
self.is_multi_edges = multi_edges
@@ -267,6 +268,7 @@ def __init__(self, node: 'Node', index: int = 0, position: int = LEFT_TOP, socke
267268

268269
self.init_socket_label()
269270

271+
270272
def __str__(self):
271273
return "<Socket #%d %s %s..%s>" % (
272274
self.index, "ME" if self.is_multi_edges else "SE", hex(id(self))[2:5], hex(id(self))[-3:])
@@ -369,17 +371,17 @@ def changeSocketType(self, new_socket_type: int) -> bool:
369371
:rtype: ``bool``
370372
"""
371373
if self.socket_type != new_socket_type:
374+
print(self.node.inputs + self.node.outputs)
372375
self.socket_type = new_socket_type
373-
self.grSocket.changeSocketType()
376+
self.grSocket.changeGrSocketType()
374377
return True
375378
else:
376-
377379
return False
378380

379381
def restoreSocketType(self):
380382
if not self.socket_type == self.original_socket_type:
381383
self.socket_type = self.original_socket_type
382-
self.grSocket.changeSocketType()
384+
self.grSocket.changeGrSocketType()
383385

384386
def setSocketPosition(self):
385387
"""Helper function to set `Graphics Socket` position. Exact socket position is calculated

vvs_app/Terminal_Test.py

-200
This file was deleted.

vvs_app/Testing.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from array import array
2+
3+
user_float = array("f", [1.0, 2.0, 3.2])
4+
5+
for item in user_float:
6+
print(item)

vvs_app/editor_user_nodes_list.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def create_user_node(self, name, node_id, type, node_return, node_structure, use
148148
new_node.nodeID = node_data[1] = new_id
149149
new_node.name = name
150150

151-
# Save new Var to list of vars with [Type, ID, Name, Value]
151+
# Save new Var to list of vars with [name ,node_id ,type ,node_return ,node_structure]
152152
self.user_nodes_data.append(node_data)
153153

154154
if new_node.node_type == UserFunction.node_type:

vvs_app/icons/Dark/VVS_White.png

-19.2 KB
Binary file not shown.

vvs_app/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __init__(self):
2222
self.setLayout(lo)
2323

2424
Logo = QLabel()
25-
pixmap = QPixmap("icons/Dark/VVS_White_Splash.png")
25+
pixmap = QPixmap("icons/Dark/VVS_White2.png")
2626
Logo.setPixmap(pixmap)
2727
lo.addWidget(Logo)
2828

0 commit comments

Comments
 (0)