Merge pull request #2208 from pypeclub/feature/stylesheet_on_workfiles

Tools: OpenPype stylesheet in workfiles tool
This commit is contained in:
Jakub Trllo 2021-11-09 09:39:15 +01:00 committed by GitHub
commit c19f641c50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 2085 additions and 781 deletions

View file

@ -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)",

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,019 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,023 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 476 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 481 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 B

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -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>

View file

@ -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 */
@ -210,24 +268,9 @@ QSplitter::handle {
border: 3px solid transparent;
}
QSplitter::handle:horizontal {
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: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 {
/* 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 */
@ -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;
}
@ -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);
@ -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. */
@ -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 {

View file

@ -55,8 +55,6 @@ class HostToolsHelper:
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
@ -80,7 +78,6 @@ class HostToolsHelper:
# 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."""

View file

@ -8,8 +8,9 @@ import datetime
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
)
@ -131,6 +132,9 @@ class NameWindow(QtWidgets.QDialog):
# 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
@ -186,6 +190,7 @@ class NameWindow(QtWidgets.QDialog):
self.preview_label = preview_label
self.subversion_input = subversion_input
self.ext_combo = ext_combo
self._ext_delegate = ext_delegate
self.refresh()
@ -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)
@ -616,7 +622,7 @@ class FilesWidget(QtWidgets.QWidget):
self._enter_session()
host.open_file(filepath)
self.window().close()
self.file_opened.emit()
def save_changes_prompt(self):
self._messagebox = messagebox = QtWidgets.QMessageBox()
@ -634,7 +640,7 @@ class FilesWidget(QtWidgets.QWidget):
# 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:
@ -994,6 +1000,7 @@ class Window(QtWidgets.QMainWindow):
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
@ -1006,13 +1013,19 @@ class Window(QtWidgets.QMainWindow):
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.
@ -1054,6 +1067,9 @@ class Window(QtWidgets.QMainWindow):
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:
@ -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