Skip to content

Commit 44ab6e0

Browse files
committed
clean up
1 parent ab43029 commit 44ab6e0

File tree

1 file changed

+120
-121
lines changed

1 file changed

+120
-121
lines changed

NodeGraphQt/constants.py

Lines changed: 120 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,43 @@
1212
throughout the whole NodeGraphQt library.
1313
"""
1414

15+
# ================================== PRIVATE ===================================
16+
17+
URI_SCHEME = 'nodegraphqt://'
18+
URN_SCHEME = 'nodegraphqt::'
19+
20+
# === PATHS ===
21+
22+
BASE_PATH = os.path.dirname(os.path.abspath(__file__))
23+
ICON_PATH = os.path.join(BASE_PATH, 'widgets', 'icons')
24+
ICON_DOWN_ARROW = os.path.join(ICON_PATH, 'down_arrow.png')
25+
ICON_NODE_BASE = os.path.join(ICON_PATH, 'node_base.png')
26+
27+
# === DRAW STACK ORDER ===
28+
29+
Z_VAL_PIPE = -1
30+
Z_VAL_NODE = 1
31+
Z_VAL_PORT = 2
32+
Z_VAL_NODE_WIDGET = 3
33+
34+
# === ITEM CACHE MODE ===
35+
36+
# QGraphicsItem.NoCache
37+
# QGraphicsItem.DeviceCoordinateCache
38+
# QGraphicsItem.ItemCoordinateCache
39+
40+
ITEM_CACHE_MODE = QtWidgets.QGraphicsItem.DeviceCoordinateCache
41+
42+
# === NODE LAYOUT DIRECTION ===
43+
44+
#: Mode for vertical node layout.
45+
NODE_LAYOUT_VERTICAL = 0
46+
#: Mode for horizontal node layout.
47+
NODE_LAYOUT_HORIZONTAL = 1
48+
#: Variable for setting the node layout direction.
49+
# NODE_LAYOUT_DIRECTION = NODE_LAYOUT_VERTICAL
50+
NODE_LAYOUT_DIRECTION = NODE_LAYOUT_HORIZONTAL
51+
1552
# =================================== GLOBAL ===================================
1653

1754

@@ -29,54 +66,56 @@ class VERSION(Enum):
2966
#:
3067
PATCH = int(_v.split('.')[2])
3168

32-
# ==================================== PIPE ====================================
69+
# =================================== VIEWER ===================================
3370

3471

35-
class PIPE_STYLING(Enum):
72+
class VIEWER_STYLING(Enum):
3673
"""
37-
Pipe styling layout:
38-
:py:mod:`NodeGraphQt.constants.PIPE_STYLING`
74+
Node graph viewer styling layout:
75+
:py:mod:`NodeGraphQt.constants.VIEWER_STYLING`
3976
"""
40-
#: default width.
41-
WIDTH = 1.2
42-
#: default color.
43-
COLOR = (175, 95, 30, 255)
44-
#: pipe color to a node when it's disabled.
45-
DISABLED_COLOR = (190, 20, 20, 255)
46-
#: pipe color when selected or mouse over.
47-
ACTIVE_COLOR = (70, 255, 220, 255)
48-
#: pipe color to a node when it's selected.
49-
HIGHLIGHT_COLOR = (232, 184, 13, 255)
50-
#: draw connection as a line.
51-
DRAW_TYPE_DEFAULT = 0
52-
#: draw connection as dashed lines.
53-
DRAW_TYPE_DASHED = 1
54-
#: draw connection as a dotted line.
55-
DRAW_TYPE_DOTTED = 2
77+
#: default background color for the node graph.
78+
BACKGROUND_COLOR = (35, 35, 35)
79+
#: style node graph background with no grid or dots.
80+
GRID_DISPLAY_NONE = 0
81+
#: style node graph background with dots.
82+
GRID_DISPLAY_DOTS = 1
83+
#: style node graph background with grid lines.
84+
GRID_DISPLAY_LINES = 2
85+
#: grid size when styled with grid lines.
86+
GRID_SIZE = 50
87+
#: grid line color.
88+
GRID_COLOR = (45, 45, 45)
5689

5790

58-
class PIPE_SLICER_STYLING(Enum):
91+
class VIEWER_NAV_STYLING(Enum):
5992
"""
60-
Slicer Pipe styling layout:
61-
:py:mod:`NodeGraphQt.constants.PIPE_SLICER_STYLING`
93+
Node graph viewer navigation styling layout:
94+
:py:mod:`NodeGraphQt.constants.VIEWER_NAV_STYLING`
6295
"""
63-
#: default width.
64-
WIDTH = 1.5
65-
#: default color.
66-
COLOR = (255, 50, 75)
96+
#: default background color.
97+
BACKGROUND_COLOR = (25, 25, 25)
98+
#: default item color.
99+
ITEM_COLOR = (35, 35, 35)
67100

101+
# ==================================== NODE ====================================
68102

69-
class PIPE_LAYOUT(Enum):
103+
104+
class NODE_STYLING(Enum):
70105
"""
71-
Pipe connection drawing layout:
72-
:py:mod:`NodeGraphQt.constants.PIPE_LAYOUT`
106+
Node styling layout:
107+
:py:mod:`NodeGraphQt.constants.NODE_STYLING`
73108
"""
74-
#: draw straight lines for pipe connections.
75-
STRAIGHT = 0
76-
#: draw curved lines for pipe connections.
77-
CURVED = 1
78-
#: draw angled lines for pipe connections.
79-
ANGLE = 2
109+
#: default node width.
110+
WIDTH = 160
111+
#: default node height.
112+
HEIGHT = 60
113+
#: default node icon size (WxH).
114+
ICON_SIZE = 18
115+
#: default node overlay color when selected.
116+
SELECTED_COLOR = (255, 255, 255, 30)
117+
#: default node border color when selected.
118+
SELECTED_BORDER_COLOR = (254, 207, 42, 255)
80119

81120
# ==================================== PORT ====================================
82121

@@ -114,27 +153,57 @@ class PORT_TYPE(Enum):
114153
#: Connection type for output ports.
115154
OUT = 'out'
116155

156+
# ==================================== PIPE ====================================
117157

118-
# ==================================== NODE ====================================
119158

159+
class PIPE_STYLING(Enum):
160+
"""
161+
Pipe styling layout:
162+
:py:mod:`NodeGraphQt.constants.PIPE_STYLING`
163+
"""
164+
#: default width.
165+
WIDTH = 1.2
166+
#: default color.
167+
COLOR = (175, 95, 30, 255)
168+
#: pipe color to a node when it's disabled.
169+
DISABLED_COLOR = (190, 20, 20, 255)
170+
#: pipe color when selected or mouse over.
171+
ACTIVE_COLOR = (70, 255, 220, 255)
172+
#: pipe color to a node when it's selected.
173+
HIGHLIGHT_COLOR = (232, 184, 13, 255)
174+
#: draw connection as a line.
175+
DRAW_TYPE_DEFAULT = 0
176+
#: draw connection as dashed lines.
177+
DRAW_TYPE_DASHED = 1
178+
#: draw connection as a dotted line.
179+
DRAW_TYPE_DOTTED = 2
120180

121-
class NODE_STYLING(Enum):
181+
182+
class PIPE_SLICER_STYLING(Enum):
122183
"""
123-
Node styling layout:
124-
:py:mod:`NodeGraphQt.constants.NODE_STYLING`
184+
Slicer Pipe styling layout:
185+
:py:mod:`NodeGraphQt.constants.PIPE_SLICER_STYLING`
125186
"""
126-
#: default node width.
127-
WIDTH = 160
128-
#: default node height.
129-
HEIGHT = 60
130-
#: default node icon size (WxH).
131-
ICON_SIZE = 18
132-
#: default node overlay color when selected.
133-
SELECTED_COLOR = (255, 255, 255, 30)
134-
#: default node border color when selected.
135-
SELECTED_BORDER_COLOR = (254, 207, 42, 255)
187+
#: default width.
188+
WIDTH = 1.5
189+
#: default color.
190+
COLOR = (255, 50, 75)
136191

137-
# === NODE PROPERTY ===
192+
193+
class PIPE_LAYOUT(Enum):
194+
"""
195+
Pipe connection drawing layout:
196+
:py:mod:`NodeGraphQt.constants.PIPE_LAYOUT`
197+
"""
198+
#: draw straight lines for pipe connections.
199+
STRAIGHT = 0
200+
#: draw curved lines for pipe connections.
201+
CURVED = 1
202+
#: draw angled lines for pipe connections.
203+
ANGLE = 2
204+
205+
206+
# === PROPERTY BIN WIDGET ===
138207

139208
#: Property type will hidden in the properties bin (default).
140209
NODE_PROP = 0
@@ -170,73 +239,3 @@ class NODE_STYLING(Enum):
170239
NODE_PROP_INT = 16
171240
#: Property type represented with button widget in the properties bin.
172241
NODE_PROP_BUTTON = 17
173-
174-
# === NODE VIEWER ===
175-
176-
177-
class VIEWER_STYLING(Enum):
178-
"""
179-
Node graph viewer styling layout:
180-
:py:mod:`NodeGraphQt.constants.VIEWER_STYLING`
181-
"""
182-
#: default background color for the node graph.
183-
BACKGROUND_COLOR = (35, 35, 35)
184-
#: style node graph background with no grid or dots.
185-
GRID_DISPLAY_NONE = 0
186-
#: style node graph background with dots.
187-
GRID_DISPLAY_DOTS = 1
188-
#: style node graph background with grid lines.
189-
GRID_DISPLAY_LINES = 2
190-
#: grid size when styled with grid lines.
191-
GRID_SIZE = 50
192-
#: grid line color.
193-
GRID_COLOR = (45, 45, 45)
194-
195-
196-
class VIEWER_NAV_STYLING(Enum):
197-
"""
198-
Node graph viewer navigation styling layout:
199-
:py:mod:`NodeGraphQt.constants.VIEWER_NAV_STYLING`
200-
"""
201-
#: default background color.
202-
BACKGROUND_COLOR = (25, 25, 25)
203-
#: default item color.
204-
ITEM_COLOR = (35, 35, 35)
205-
206-
207-
# ================================== PRIVATE ===================================
208-
209-
URI_SCHEME = 'nodegraphqt://'
210-
URN_SCHEME = 'nodegraphqt::'
211-
212-
# === PATHS ===
213-
214-
BASE_PATH = os.path.dirname(os.path.abspath(__file__))
215-
ICON_PATH = os.path.join(BASE_PATH, 'widgets', 'icons')
216-
ICON_DOWN_ARROW = os.path.join(ICON_PATH, 'down_arrow.png')
217-
ICON_NODE_BASE = os.path.join(ICON_PATH, 'node_base.png')
218-
219-
# === DRAW STACK ORDER ===
220-
221-
Z_VAL_PIPE = -1
222-
Z_VAL_NODE = 1
223-
Z_VAL_PORT = 2
224-
Z_VAL_NODE_WIDGET = 3
225-
226-
# === ITEM CACHE MODE ===
227-
228-
# QGraphicsItem.NoCache
229-
# QGraphicsItem.DeviceCoordinateCache
230-
# QGraphicsItem.ItemCoordinateCache
231-
232-
ITEM_CACHE_MODE = QtWidgets.QGraphicsItem.DeviceCoordinateCache
233-
234-
# === NODE LAYOUT DIRECTION ===
235-
236-
#: Mode for vertical node layout.
237-
NODE_LAYOUT_VERTICAL = 0
238-
#: Mode for horizontal node layout.
239-
NODE_LAYOUT_HORIZONTAL = 1
240-
#: Variable for setting the node layout direction.
241-
# NODE_LAYOUT_DIRECTION = NODE_LAYOUT_VERTICAL
242-
NODE_LAYOUT_DIRECTION = NODE_LAYOUT_HORIZONTAL

0 commit comments

Comments
 (0)