Skip to content

Commit ab43029

Browse files
committed
Updated VERSION constant vars to enum
1 parent bdc6be7 commit ab43029

File tree

1 file changed

+25
-19
lines changed

1 file changed

+25
-19
lines changed

NodeGraphQt/constants.py

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,37 @@
55
from Qt import QtWidgets
66
from enum import Enum
77

8-
from .pkg_info import __version__
8+
from .pkg_info import __version__ as _v
99

1010
__doc__ = """
11-
| The ``NodeGraphQt.constants`` namespace contains variables used throughout
12-
the whole NodeGraphQt library.
11+
| The :py:mod:`NodeGraphQt.constants` namespace contains variables used
12+
throughout the whole NodeGraphQt library.
1313
"""
1414

1515
# =================================== GLOBAL ===================================
1616

17-
#: current version.
18-
VERSION = __version__
19-
#: major version.
20-
VERSION_MAJOR = int(VERSION.split('.')[0])
21-
#: minor version.
22-
VERSION_MINOR = int(VERSION.split('.')[1])
23-
#: patch version.
24-
VERSION_PATCH = int(VERSION.split('.')[2])
17+
18+
class VERSION(Enum):
19+
"""
20+
Current framework version.
21+
:py:mod:`NodeGraphQt.constants.VERSION`
22+
"""
23+
#:
24+
VERSION = _v
25+
#:
26+
MAJOR = int(_v.split('.')[0])
27+
#:
28+
MINOR = int(_v.split('.')[1])
29+
#:
30+
PATCH = int(_v.split('.')[2])
2531

2632
# ==================================== PIPE ====================================
2733

2834

2935
class PIPE_STYLING(Enum):
3036
"""
3137
Pipe styling layout:
32-
``NodeGraphQt.constants.PIPE_STYLING``
38+
:py:mod:`NodeGraphQt.constants.PIPE_STYLING`
3339
"""
3440
#: default width.
3541
WIDTH = 1.2
@@ -52,7 +58,7 @@ class PIPE_STYLING(Enum):
5258
class PIPE_SLICER_STYLING(Enum):
5359
"""
5460
Slicer Pipe styling layout:
55-
``NodeGraphQt.constants.PIPE_SLICER_STYLING``
61+
:py:mod:`NodeGraphQt.constants.PIPE_SLICER_STYLING`
5662
"""
5763
#: default width.
5864
WIDTH = 1.5
@@ -63,7 +69,7 @@ class PIPE_SLICER_STYLING(Enum):
6369
class PIPE_LAYOUT(Enum):
6470
"""
6571
Pipe connection drawing layout:
66-
``NodeGraphQt.constants.PIPE_LAYOUT``
72+
:py:mod:`NodeGraphQt.constants.PIPE_LAYOUT`
6773
"""
6874
#: draw straight lines for pipe connections.
6975
STRAIGHT = 0
@@ -78,7 +84,7 @@ class PIPE_LAYOUT(Enum):
7884
class PORT_STYLING(Enum):
7985
"""
8086
Port styling layout:
81-
``NodeGraphQt.constants.PORT_STYLING``
87+
:py:mod:`NodeGraphQt.constants.PORT_STYLING`
8288
"""
8389
#: default port size.
8490
SIZE = 22.0
@@ -101,7 +107,7 @@ class PORT_STYLING(Enum):
101107
class PORT_TYPE(Enum):
102108
"""
103109
Port connection types:
104-
``NodeGraphQt.constants.PORT_TYPE``
110+
:py:mod:`NodeGraphQt.constants.PORT_TYPE`
105111
"""
106112
#: Connection type for input ports.
107113
IN = 'in'
@@ -115,7 +121,7 @@ class PORT_TYPE(Enum):
115121
class NODE_STYLING(Enum):
116122
"""
117123
Node styling layout:
118-
``NodeGraphQt.constants.NODE_STYLING``
124+
:py:mod:`NodeGraphQt.constants.NODE_STYLING`
119125
"""
120126
#: default node width.
121127
WIDTH = 160
@@ -171,7 +177,7 @@ class NODE_STYLING(Enum):
171177
class VIEWER_STYLING(Enum):
172178
"""
173179
Node graph viewer styling layout:
174-
``NodeGraphQt.constants.VIEWER_STYLING``
180+
:py:mod:`NodeGraphQt.constants.VIEWER_STYLING`
175181
"""
176182
#: default background color for the node graph.
177183
BACKGROUND_COLOR = (35, 35, 35)
@@ -190,7 +196,7 @@ class VIEWER_STYLING(Enum):
190196
class VIEWER_NAV_STYLING(Enum):
191197
"""
192198
Node graph viewer navigation styling layout:
193-
``NodeGraphQt.constants.VIEWER_NAV_STYLING``
199+
:py:mod:`NodeGraphQt.constants.VIEWER_NAV_STYLING`
194200
"""
195201
#: default background color.
196202
BACKGROUND_COLOR = (25, 25, 25)

0 commit comments

Comments
 (0)