Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2208 from pypeclub/feature/stylesheet_on_workfiles
Browse files Browse the repository at this point in the history
Tools: OpenPype stylesheet in workfiles tool
  • Loading branch information
iLLiCiTiT authored Nov 9, 2021
2 parents 0320330 + 8d0b1d2 commit c19f641
Show file tree
Hide file tree
Showing 19 changed files with 1,895 additions and 591 deletions.
2 changes: 1 addition & 1 deletion openpype/style/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"bg-view-header": "#373D48",
"bg-view-hover": "rgba(168, 175, 189, .3)",
"bg-view-alternate": "rgb(36, 42, 50)",
"bg-view-disabled": "#434a56",
"bg-view-disabled": "#2C313A",
"bg-view-alternate-disabled": "#2C313A",
"bg-view-selection": "rgba(92, 173, 214, .4)",
"bg-view-selection-hover": "rgba(92, 173, 214, .8)",
Expand Down
Binary file added openpype/style/images/checkbox_checked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added openpype/style/images/checkbox_checked_focus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added openpype/style/images/checkbox_checked_hover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added openpype/style/images/checkbox_indeterminate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added openpype/style/images/checkbox_unchecked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added openpype/style/images/checkbox_unchecked_focus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added openpype/style/images/checkbox_unchecked_hover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,253 changes: 925 additions & 328 deletions openpype/style/pyqt5_resources.py

Large diffs are not rendered by default.

1,046 changes: 816 additions & 230 deletions openpype/style/pyside2_resources.py

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions openpype/style/resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@
<file>images/up_arrow.png</file>
<file>images/up_arrow_disabled.png</file>
<file>images/up_arrow_on.png</file>
<file>images/checkbox_checked.png</file>
<file>images/checkbox_checked_hover.png</file>
<file>images/checkbox_checked_focus.png</file>
<file>images/checkbox_checked_disabled.png</file>
<file>images/checkbox_unchecked.png</file>
<file>images/checkbox_unchecked_hover.png</file>
<file>images/checkbox_unchecked_focus.png</file>
<file>images/checkbox_unchecked_disabled.png</file>
<file>images/checkbox_indeterminate.png</file>
<file>images/checkbox_indeterminate_hover.png</file>
<file>images/checkbox_indeterminate_focus.png</file>
<file>images/checkbox_indeterminate_disabled.png</file>
<file>images/transparent.png</file>
</qresource>
</RCC>
143 changes: 120 additions & 23 deletions openpype/style/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,67 @@ QAbstractSpinBox:focus, QLineEdit:focus, QPlainTextEdit:focus, QTextEdit:focus{
border-color: {color:border-focus};
}

/* Checkbox */
QCheckBox {
background: transparent;
QAbstractSpinBox:up-button {
margin: 0px;
background-color: transparent;
subcontrol-origin: border;
subcontrol-position: top right;
border-top-right-radius: 0.3em;
border-top: 0px solid transparent;
border-right: 0px solid transparent;
border-left: 1px solid {color:border};
border-bottom: 1px solid {color:border};
}

QAbstractSpinBox:down-button {
margin: 0px;
background-color: transparent;
subcontrol-origin: border;
subcontrol-position: bottom right;
border-bottom-right-radius: 0.3em;
border-bottom: 0px solid transparent;
border-right: 0px solid transparent;
border-left: 1px solid {color:border};
border-top: 1px solid {color:border};
}

QAbstractSpinBox:up-button:focus, QAbstractSpinBox:down-button:focus {
border-color: {color:border-focus};
}
QAbstractSpinBox::up-arrow, QAbstractSpinBox::up-arrow:off {
image: url(:/openpype/images/up_arrow.png);
width: 0.5em;
height: 1em;
border-width: 1px;
}
QAbstractSpinBox::up-arrow:hover {
image: url(:/openpype/images/up_arrow_on.png);
bottom: 1;
}
QAbstractSpinBox::up-arrow:disabled {
image: url(:/openpype/images/up_arrow_disabled.png);
}
QAbstractSpinBox::up-arrow:pressed {
image: url(:/openpype/images/up_arrow_on.png);
bottom: 0;
}

QAbstractSpinBox::down-arrow, QAbstractSpinBox::down-arrow:off {
image: url(:/openpype/images/down_arrow.png);
width: 0.5em;
height: 1em;
border-width: 1px;
}
QAbstractSpinBox::down-arrow:hover {
image: url(:/openpype/images/down_arrow_on.png);
bottom: 1;
}
QAbstractSpinBox::down-arrow:disabled {
image: url(:/openpype/images/down_arrow_disabled.png);
}
QAbstractSpinBox::down-arrow:hover:pressed {
image: url(:/openpype/images/down_arrow_on.png);
bottom: 0;
}

/* Buttons */
Expand Down Expand Up @@ -210,24 +268,9 @@ QSplitter::handle {
border: 3px solid transparent;
}

QSplitter::handle:horizontal {
/* must be single like because of Nuke*/
background: qlineargradient(x1:0, y1:0, x2:1, y2:0,stop:0.3 rgba(0, 0, 0, 0),stop:0.5 {color:bg-splitter},stop:0.7 rgba(0, 0, 0, 0));
}

QSplitter::handle:vertical {
/* must be single like because of Nuke*/
background: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0.3 rgba(0, 0, 0, 0),stop:0.5 {color:bg-splitter},stop:0.7 rgba(0, 0, 0, 0));
}

QSplitter::handle:horizontal:hover {
/* must be single like because of Nuke*/
background: qlineargradient(x1:0, y1:0, x2:1, y2:0,stop:0.3 rgba(0, 0, 0, 0),stop:0.5 {color:bg-splitter-hover},stop:0.7 rgba(0, 0, 0, 0));
}

QSplitter::handle:vertical:hover {
QSplitter::handle:horizontal, QSplitter::handle:vertical, QSplitter::handle:horizontal:hover, QSplitter::handle:vertical:hover {
/* must be single like because of Nuke*/
background: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0.3 rgba(0, 0, 0, 0),stop:0.5 {color:bg-splitter-hover},stop:0.7 rgba(0, 0, 0, 0));
background: transparent;
}

/* SLider */
Expand Down Expand Up @@ -325,8 +368,8 @@ QTabBar::tab:only-one {
}

QHeaderView {
border: none;
border-radius: 2px;
border: 0px solid {color:border};
border-radius: 0px;
margin: 0px;
padding: 0px;
}
Expand All @@ -346,6 +389,10 @@ QHeaderView::section:first {
QHeaderView::section:last {
border-right: none;
}
QHeaderView::section:only-one {
border-left: none;
border-right: none;
}

QHeaderView::down-arrow {
image: url(:/openpype/images/down_arrow.png);
Expand All @@ -355,10 +402,59 @@ QHeaderView::up-arrow {
image: url(:/openpype/images/up_arrow.png);
}

/* Checkboxes */
QCheckBox {
background: transparent;
}

QCheckBox::indicator {
width: 16px;
height: 16px;
}

QAbstractItemView::indicator:checked, QCheckBox::indicator:checked {
image: url(:/openpype/images/checkbox_checked.png);
}
QAbstractItemView::indicator:checked:focus, QCheckBox::indicator:checked:focus {
image: url(:/openpype/images/checkbox_checked_focus.png);
}
QAbstractItemView::indicator:checked:hover, QAbstractItemView::indicator:checked:pressed, QCheckBox::indicator:checked:hover, QCheckBox::indicator:checked:pressed {
image: url(:/openpype/images/checkbox_checked_hover.png);
}
QAbstractItemView::indicator:checked:disabled, QCheckBox::indicator:checked:disabled {
image: url(:/openpype/images/checkbox_checked_disabled.png);
}

QAbstractItemView::indicator:unchecked, QCheckBox::indicator:unchecked {
image: url(:/openpype/images/checkbox_unchecked.png);
}
QAbstractItemView::indicator:unchecked:focus, QCheckBox::indicator:unchecked:focus {
image: url(:/openpype/images/checkbox_unchecked_focus.png);
}
QAbstractItemView::indicator:unchecked:hover, QAbstractItemView::indicator:unchecked:pressed, QCheckBox::indicator:unchecked:hover, QCheckBox::indicator:unchecked:pressed {
image: url(:/openpype/images/checkbox_unchecked_hover.png);
}
QAbstractItemView::indicator:unchecked:disabled, QCheckBox::indicator:unchecked:disabled {
image: url(:/openpype/images/checkbox_unchecked_disabled.png);
}

QAbstractItemView::indicator:indeterminate, QCheckBox::indicator:indeterminate {
image: url(:/openpype/images/checkbox_indeterminate.png);
}
QAbstractItemView::indicator:indeterminate:focus, QCheckBox::indicator:indeterminate:focus {
image: url(:/openpype/images/checkbox_indeterminate_focus.png);
}
QAbstractItemView::indicator:indeterminate:hover, QAbstractItemView::indicator:indeterminate:pressed, QCheckBox::indicator:indeterminate:hover, QCheckBox::indicator:indeterminate:pressed {
image: url(:/openpype/images/checkbox_indeterminate_hover.png);
}
QAbstractItemView::indicator:indeterminate:disabled, QCheckBox::indicator:indeterminate:disabled {
image: url(:/openpype/images/checkbox_indeterminate_disabled.png);
}

/* Views QListView QTreeView QTableView */
QAbstractItemView {
border: 0px solid {color:border};
border-radius: 0.2em;
border-radius: 0px;
background: {color:bg-view};
alternate-background-color: {color:bg-view-alternate};
/* Mac shows selection color on branches. */
Expand All @@ -373,6 +469,7 @@ QAbstractItemView::item {
QAbstractItemView:disabled{
background: {color:bg-view-disabled};
alternate-background-color: {color:bg-view-alternate-disabled};
border: 1px solid {color:border};
}

QAbstractItemView::item:hover {
Expand Down
3 changes: 0 additions & 3 deletions openpype/tools/utils/host_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ def get_workfiles_tool(self, parent):

def show_workfiles(self, parent=None, use_context=None, save=None):
"""Workfiles tool for changing context and saving workfiles."""
from avalon import style

if use_context is None:
use_context = True

Expand All @@ -80,7 +78,6 @@ def show_workfiles(self, parent=None, use_context=None, save=None):
# Pull window to the front.
workfiles_tool.raise_()
workfiles_tool.activateWindow()
workfiles_tool.setStyleSheet(style.load_stylesheet())

def get_loader_tool(self, parent):
"""Create, cache and return loader tool window."""
Expand Down
27 changes: 21 additions & 6 deletions openpype/tools/workfiles/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

import Qt
from Qt import QtWidgets, QtCore
from avalon import style, io, api, pipeline
from avalon import io, api, pipeline

from openpype import style
from openpype.tools.utils.lib import (
schedule, qt_app_context
)
Expand Down Expand Up @@ -131,6 +132,9 @@ def __init__(self, parent, root, anatomy, template_key, session=None):

# Extensions combobox
ext_combo = QtWidgets.QComboBox(inputs_widget)
# Add styled delegate to use stylesheets
ext_delegate = QtWidgets.QStyledItemDelegate()
ext_combo.setItemDelegate(ext_delegate)
ext_combo.addItems(self.host.file_extensions())

# Build inputs
Expand Down Expand Up @@ -186,6 +190,7 @@ def __init__(self, parent, root, anatomy, template_key, session=None):
self.preview_label = preview_label
self.subversion_input = subversion_input
self.ext_combo = ext_combo
self._ext_delegate = ext_delegate

self.refresh()

Expand Down Expand Up @@ -426,6 +431,7 @@ class FilesWidget(QtWidgets.QWidget):
"""A widget displaying files that allows to save and open files."""
file_selected = QtCore.Signal(str)
workfile_created = QtCore.Signal(str)
file_opened = QtCore.Signal()

def __init__(self, parent=None):
super(FilesWidget, self).__init__(parent=parent)
Expand Down Expand Up @@ -616,7 +622,7 @@ def open_file(self, filepath):

self._enter_session()
host.open_file(filepath)
self.window().close()
self.file_opened.emit()

def save_changes_prompt(self):
self._messagebox = messagebox = QtWidgets.QMessageBox()
Expand All @@ -634,7 +640,7 @@ def save_changes_prompt(self):

# Parenting the QMessageBox to the Widget seems to crash
# so we skip parenting and explicitly apply the stylesheet.
messagebox.setStyleSheet(style.load_stylesheet())
messagebox.setStyle(self.style())

result = messagebox.exec_()
if result == messagebox.Yes:
Expand Down Expand Up @@ -994,6 +1000,7 @@ def __init__(self, parent=None):
tasks_widget.task_changed.connect(self.on_task_changed)
files_widget.file_selected.connect(self.on_file_select)
files_widget.workfile_created.connect(self.on_workfile_create)
files_widget.file_opened.connect(self._on_file_opened)
side_panel.save_clicked.connect(self.on_side_panel_save)

self.home_page_widget = home_page_widget
Expand All @@ -1006,13 +1013,19 @@ def __init__(self, parent=None):
self.files_widget = files_widget
self.side_panel = side_panel

self.refresh()

# Force focus on the open button by default, required for Houdini.
files_widget.btn_open.setFocus()

self.resize(1200, 600)

self._first_show = True

def showEvent(self, event):
super(Window, self).showEvent(event)
if self._first_show:
self._first_show = False
self.setStyleSheet(style.load_stylesheet())

def keyPressEvent(self, event):
"""Custom keyPressEvent.
Expand Down Expand Up @@ -1054,6 +1067,9 @@ def on_file_select(self, filepath):
def on_workfile_create(self, filepath):
self._create_workfile_doc(filepath)

def _on_file_opened(self):
self.close()

def on_side_panel_save(self):
workfile_doc, data = self.side_panel.get_workfile_data()
if not workfile_doc:
Expand Down Expand Up @@ -1201,7 +1217,6 @@ def show(root=None, debug=False, parent=None, use_context=True, save=True):
window.set_save_enabled(save)

window.show()
window.setStyleSheet(style.load_stylesheet())

module.window = window

Expand Down

0 comments on commit c19f641

Please sign in to comment.