Changed color of pipes from orange to blue.
This commit is contained in:
parent
db848211fd
commit
62144b3588
51
borealis.py
51
borealis.py
@ -8,6 +8,55 @@ import importlib
|
|||||||
|
|
||||||
from Qt import QtWidgets, QtCore, QtGui
|
from Qt import QtWidgets, QtCore, QtGui
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
# MONKEY-PATCH to override all pens in PipeItem.__init__ so
|
||||||
|
# idle, hover, selected, etc. all share the same color.
|
||||||
|
try:
|
||||||
|
from OdenGraphQt.qgraphics.pipe import PipeItem
|
||||||
|
from qtpy.QtGui import QPen, QColor
|
||||||
|
from qtpy import QtCore
|
||||||
|
|
||||||
|
# If you want the original paint logic, capture it first:
|
||||||
|
_orig_paint = PipeItem.paint
|
||||||
|
|
||||||
|
def _custom_paint(self, painter, option, widget=None):
|
||||||
|
"""
|
||||||
|
Force the pen color after (or before) the original drawing code
|
||||||
|
so it can't revert to orange.
|
||||||
|
"""
|
||||||
|
painter.save()
|
||||||
|
|
||||||
|
# Option A: override the pen BEFORE the original paint.
|
||||||
|
# This might work if OdenGraphQt doesn't re-set the pen later.
|
||||||
|
my_pen = QPen(QColor(60, 120, 180, 255)) # RGBA
|
||||||
|
my_pen.setWidthF(2.0)
|
||||||
|
painter.setPen(my_pen)
|
||||||
|
|
||||||
|
# Call original method (which might set color to orange again)
|
||||||
|
_orig_paint(self, painter, option, widget)
|
||||||
|
|
||||||
|
# Option B: forcibly override color AFTER the original paint
|
||||||
|
# in case the library sets orange near the end.
|
||||||
|
pen = painter.pen()
|
||||||
|
pen.setColor(QColor(60,120,180,255))
|
||||||
|
pen.setWidthF(2.0)
|
||||||
|
painter.setPen(pen)
|
||||||
|
|
||||||
|
# The library may have already drawn the path in orange, so
|
||||||
|
# re-draw if needed:
|
||||||
|
if hasattr(self, "path"):
|
||||||
|
painter.drawPath(self.path())
|
||||||
|
|
||||||
|
painter.restore()
|
||||||
|
|
||||||
|
PipeItem.paint = _custom_paint
|
||||||
|
print("Patched PipeItem.paint to forcibly override pipe color.")
|
||||||
|
except ImportError:
|
||||||
|
print("WARNING: Could not patch PipeItem paint method.")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Patch for PipeItem.paint override failed: {e}")
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
# MONKEY-PATCH to fix "module 'qtpy.QtGui' has no attribute 'QUndoStack'"
|
# MONKEY-PATCH to fix "module 'qtpy.QtGui' has no attribute 'QUndoStack'"
|
||||||
try:
|
try:
|
||||||
@ -182,7 +231,7 @@ class BorealisWindow(QtWidgets.QMainWindow):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.setWindowTitle("Project Borealis - Workflow Automation System")
|
self.setWindowTitle("Borealis - Workflow Automation System")
|
||||||
|
|
||||||
# Create NodeGraph and widget
|
# Create NodeGraph and widget
|
||||||
self.graph = NodeGraph()
|
self.graph = NodeGraph()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user