Skip to content

Commit c3ceb2d

Browse files
committed
nav tab styling updates.
1 parent a7a7bd0 commit c3ceb2d

File tree

3 files changed

+26
-14
lines changed

3 files changed

+26
-14
lines changed

NodeGraphQt/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@
102102
#: Style to render the node graph background with grid lines.
103103
VIEWER_GRID_LINES = 2
104104

105+
VIEWER_NAV_BG_COLOR = (25, 25, 25)
106+
VIEWER_NAV_ITEM_COLOR = (35, 35, 35)
105107
VIEWER_BG_COLOR = (35, 35, 35)
106108
VIEWER_GRID_COLOR = (45, 45, 45)
107109
VIEWER_GRID_SIZE = 50

NodeGraphQt/widgets/node_graph.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
from Qt import QtWidgets
1+
from Qt import QtWidgets, QtGui
22

33
from NodeGraphQt.constants import (
44
NODE_SEL_BORDER_COLOR,
55
VIEWER_BG_COLOR,
6-
VIEWER_GRID_COLOR
6+
VIEWER_NAV_BG_COLOR
77
)
88
from NodeGraphQt.widgets.viewer_nav import NodeNavigationWidget
99

@@ -15,28 +15,33 @@ def __init__(self, parent=None):
1515
self.setTabsClosable(True)
1616
self.setTabBarAutoHide(True)
1717
text_color = self.palette().text().color().toTuple()
18+
bg_color = QtGui.QColor(*VIEWER_BG_COLOR).darker(120).toTuple()
1819
style_dict = {
20+
'QWidget': {
21+
'background-color': 'rgb({0},{1},{2})'.format(*VIEWER_BG_COLOR),
22+
},
1923
'QTabWidget::pane': {
2024
'background': 'rgb({0},{1},{2})'.format(*VIEWER_BG_COLOR),
2125
'border': '0px',
22-
'border-top': '1px solid rgb({0},{1},{2})'
23-
.format(*VIEWER_BG_COLOR),
26+
'border-top': '0px solid rgb({0},{1},{2})'.format(*bg_color),
2427
},
2528
'QTabBar::tab': {
26-
'background': 'rgb({0},{1},{2})'.format(*VIEWER_BG_COLOR),
29+
'background': 'rgb({0},{1},{2})'.format(*bg_color),
2730
'border': '0px solid black',
28-
'color': 'rgba({0},{1},{2},45)'.format(*text_color),
31+
'color': 'rgba({0},{1},{2},30)'.format(*text_color),
2932
'min-width': '10px',
30-
'padding': '8px 20px',
33+
'padding': '10px 20px',
3134
},
3235
'QTabBar::tab:selected': {
3336
'color': 'rgb({0},{1},{2})'.format(*text_color),
34-
'background': 'rgb({0},{1},{2})'.format(*VIEWER_BG_COLOR),
35-
'margin-bottom': '-1px',
37+
'background': 'rgb({0},{1},{2})'.format(*VIEWER_NAV_BG_COLOR),
38+
'border-top': '1px solid rgb({0},{1},{2})'
39+
.format(*NODE_SEL_BORDER_COLOR),
3640
},
3741
'QTabBar::tab:hover': {
38-
'color': 'rgb({0}, {1}, {2})'.format(*NODE_SEL_BORDER_COLOR),
39-
'background': 'rgb({0}, {1}, {2})'.format(*VIEWER_GRID_COLOR),
42+
'color': 'rgb({0},{1},{2})'.format(*text_color),
43+
'border-top': '1px solid rgb({0},{1},{2})'
44+
.format(*NODE_SEL_BORDER_COLOR),
4045
}
4146
}
4247
stylesheet = ''

NodeGraphQt/widgets/viewer_nav.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
from Qt import QtWidgets, QtCore, QtGui
22

3-
from NodeGraphQt.constants import NODE_SEL_BORDER_COLOR, VIEWER_BG_COLOR
3+
from NodeGraphQt.constants import (
4+
NODE_SEL_BORDER_COLOR,
5+
VIEWER_NAV_BG_COLOR,
6+
VIEWER_NAV_ITEM_COLOR
7+
)
48

59

610
class NodeNavigationDelagate(QtWidgets.QStyledItemDelegate):
@@ -32,7 +36,7 @@ def paint(self, painter, option, index):
3236
painter.setRenderHint(QtGui.QPainter.Antialiasing, True)
3337

3438
# background.
35-
bg_color = option.palette.window().color()
39+
bg_color = QtGui.QColor(*VIEWER_NAV_ITEM_COLOR)
3640
itm_color = QtGui.QColor(80, 128, 123)
3741
if option.state & QtWidgets.QStyle.State_Selected:
3842
bg_color = bg_color.lighter(120)
@@ -103,9 +107,10 @@ def __init__(self, parent=None):
103107
self.setSpacing(0)
104108

105109
# self.viewport().setAutoFillBackground(False)
110+
# bg_color = QtGui.QColor(*VIEWER_BG_COLOR).darker(110).toTuple()
106111
self.setStyleSheet(
107112
'QListView {{border: 0px;background-color: rgb({0},{1},{2});}}'
108-
.format(*VIEWER_BG_COLOR)
113+
.format(*VIEWER_NAV_BG_COLOR)
109114
)
110115

111116
self.setItemDelegate(NodeNavigationDelagate(self))

0 commit comments

Comments
 (0)