mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Merge pull request #1624 from pypeclub/feature/launcher_style
This commit is contained in:
commit
d8ba0c0236
4 changed files with 45 additions and 23 deletions
|
|
@ -55,7 +55,7 @@ QAbstractSpinBox:focus, QLineEdit:focus, QPlainTextEdit:focus, QTextEdit:focus{
|
|||
/* Buttons */
|
||||
QPushButton {
|
||||
text-align:center center;
|
||||
border: 0px solid {color:border};
|
||||
border: 1px solid transparent;
|
||||
border-radius: 0.2em;
|
||||
padding: 3px 5px 3px 5px;
|
||||
background: {color:bg-buttons};
|
||||
|
|
@ -63,12 +63,11 @@ QPushButton {
|
|||
|
||||
QPushButton:hover {
|
||||
background: {color:bg-button-hover};
|
||||
border-color: {color:border-hover};
|
||||
color: {color:font-hover};
|
||||
}
|
||||
QPushButton:pressed {
|
||||
border-color: {color:border-focus};
|
||||
}
|
||||
|
||||
QPushButton:pressed {}
|
||||
|
||||
QPushButton:disabled {
|
||||
background: {color:bg-buttons-disabled};
|
||||
}
|
||||
|
|
@ -523,6 +522,7 @@ QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
|
|||
|
||||
/* Launcher specific stylesheets */
|
||||
#IconView[mode="icon"] {
|
||||
/* font size can't be set on items */
|
||||
font-size: 8pt;
|
||||
border: 0px;
|
||||
padding: 0px;
|
||||
|
|
@ -534,6 +534,11 @@ QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
|
|||
border: 0px;
|
||||
}
|
||||
|
||||
#IconView[mode="icon"]::item:hover {
|
||||
background: rgba(0, 0, 0, 0);
|
||||
color: {color:font-hover};
|
||||
}
|
||||
|
||||
#IconView[mode="icon"]::icon {
|
||||
top: 3px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import os
|
||||
|
||||
from avalon import api, style
|
||||
from avalon import api
|
||||
from openpype import PLUGINS_DIR
|
||||
from openpype import style
|
||||
from openpype.api import Logger, resources
|
||||
from openpype.lib import (
|
||||
ApplictionExecutableNotFound,
|
||||
|
|
|
|||
|
|
@ -27,22 +27,30 @@ class ProjectBar(QtWidgets.QWidget):
|
|||
|
||||
self.dbcon = dbcon
|
||||
|
||||
self.model = ProjectModel(self.dbcon)
|
||||
self.model.hide_invisible = True
|
||||
model = ProjectModel(dbcon)
|
||||
model.hide_invisible = True
|
||||
|
||||
self.project_combobox = QtWidgets.QComboBox()
|
||||
self.project_combobox.setModel(self.model)
|
||||
self.project_combobox.setRootModelIndex(QtCore.QModelIndex())
|
||||
project_combobox = QtWidgets.QComboBox(self)
|
||||
# Change delegate so stylysheets are applied
|
||||
project_delegate = QtWidgets.QStyledItemDelegate(project_combobox)
|
||||
project_combobox.setItemDelegate(project_delegate)
|
||||
|
||||
project_combobox.setModel(model)
|
||||
project_combobox.setRootModelIndex(QtCore.QModelIndex())
|
||||
|
||||
layout = QtWidgets.QHBoxLayout(self)
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
layout.addWidget(self.project_combobox)
|
||||
layout.addWidget(project_combobox)
|
||||
|
||||
self.setSizePolicy(
|
||||
QtWidgets.QSizePolicy.MinimumExpanding,
|
||||
QtWidgets.QSizePolicy.Maximum
|
||||
)
|
||||
|
||||
self.model = model
|
||||
self.project_delegate = project_delegate
|
||||
self.project_combobox = project_combobox
|
||||
|
||||
# Initialize
|
||||
self.refresh()
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,10 @@ import copy
|
|||
import logging
|
||||
|
||||
from Qt import QtWidgets, QtCore, QtGui
|
||||
from avalon import style
|
||||
|
||||
from avalon.api import AvalonMongoDB
|
||||
|
||||
from openpype import style
|
||||
from openpype.api import resources
|
||||
|
||||
from avalon.tools import lib as tools_lib
|
||||
|
|
@ -23,7 +24,7 @@ from .widgets import (
|
|||
from .flickcharm import FlickCharm
|
||||
|
||||
|
||||
class IconListView(QtWidgets.QListView):
|
||||
class ProjectIconView(QtWidgets.QListView):
|
||||
"""Styled ListView that allows to toggle between icon and list mode.
|
||||
|
||||
Toggling between the two modes is done by Right Mouse Click.
|
||||
|
|
@ -34,7 +35,7 @@ class IconListView(QtWidgets.QListView):
|
|||
ListMode = 1
|
||||
|
||||
def __init__(self, parent=None, mode=ListMode):
|
||||
super(IconListView, self).__init__(parent=parent)
|
||||
super(ProjectIconView, self).__init__(parent=parent)
|
||||
|
||||
# Workaround for scrolling being super slow or fast when
|
||||
# toggling between the two visual modes
|
||||
|
|
@ -83,7 +84,7 @@ class IconListView(QtWidgets.QListView):
|
|||
def mousePressEvent(self, event):
|
||||
if event.button() == QtCore.Qt.RightButton:
|
||||
self.set_mode(int(not self._mode))
|
||||
return super(IconListView, self).mousePressEvent(event)
|
||||
return super(ProjectIconView, self).mousePressEvent(event)
|
||||
|
||||
|
||||
class ProjectsPanel(QtWidgets.QWidget):
|
||||
|
|
@ -99,7 +100,7 @@ class ProjectsPanel(QtWidgets.QWidget):
|
|||
self.dbcon = dbcon
|
||||
self.dbcon.install()
|
||||
|
||||
view = IconListView(parent=self)
|
||||
view = ProjectIconView(parent=self)
|
||||
view.setSelectionMode(QtWidgets.QListView.NoSelection)
|
||||
flick = FlickCharm(parent=self)
|
||||
flick.activateOn(view)
|
||||
|
|
@ -140,8 +141,6 @@ class AssetsPanel(QtWidgets.QWidget):
|
|||
btn_back_icon = qtawesome.icon("fa.angle-left", color="white")
|
||||
btn_back = QtWidgets.QPushButton(project_bar_widget)
|
||||
btn_back.setIcon(btn_back_icon)
|
||||
btn_back.setFixedWidth(23)
|
||||
btn_back.setFixedHeight(23)
|
||||
|
||||
project_bar = ProjectBar(self.dbcon, project_bar_widget)
|
||||
|
||||
|
|
@ -185,10 +184,6 @@ class AssetsPanel(QtWidgets.QWidget):
|
|||
layout.addWidget(project_bar_widget)
|
||||
layout.addWidget(body)
|
||||
|
||||
self.project_bar = project_bar
|
||||
self.assets_widget = assets_widget
|
||||
self.tasks_widget = tasks_widget
|
||||
|
||||
# signals
|
||||
project_bar.project_changed.connect(self.on_project_changed)
|
||||
assets_widget.selection_changed.connect(self.on_asset_changed)
|
||||
|
|
@ -197,12 +192,25 @@ class AssetsPanel(QtWidgets.QWidget):
|
|||
|
||||
btn_back.clicked.connect(self.back_clicked)
|
||||
|
||||
self.project_bar = project_bar
|
||||
self.assets_widget = assets_widget
|
||||
self.tasks_widget = tasks_widget
|
||||
self._btn_back = btn_back
|
||||
|
||||
# Force initial refresh for the assets since we might not be
|
||||
# trigging a Project switch if we click the project that was set
|
||||
# prior to launching the Launcher
|
||||
# todo: remove this behavior when AVALON_PROJECT is not required
|
||||
assets_widget.refresh()
|
||||
|
||||
def showEvent(self, event):
|
||||
super(AssetsPanel, self).showEvent(event)
|
||||
|
||||
# Change size of a btn
|
||||
# WARNING does not handle situation if combobox is bigger
|
||||
btn_size = self.project_bar.height()
|
||||
self._btn_back.setFixedSize(QtCore.QSize(btn_size, btn_size))
|
||||
|
||||
def set_project(self, project):
|
||||
before = self.project_bar.get_current_project()
|
||||
if before == project:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue