mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Merge pull request #672 from pypeclub/bugifx/pyblish_pype_animation_and_bugs
Pyblish pype animation switch and other bugs
This commit is contained in:
commit
7c87d2c114
7 changed files with 51 additions and 30 deletions
|
|
@ -1,10 +1,12 @@
|
|||
from __future__ import print_function
|
||||
|
||||
import contextlib
|
||||
import os
|
||||
import sys
|
||||
import ctypes
|
||||
import platform
|
||||
import contextlib
|
||||
|
||||
from . import compat, control, settings, util, window
|
||||
from . import control, settings, util, window
|
||||
from Qt import QtCore, QtGui, QtWidgets
|
||||
|
||||
self = sys.modules[__name__]
|
||||
|
|
@ -79,7 +81,11 @@ def show(parent=None):
|
|||
css = css.replace("url(\"", "url(\"%s" % root)
|
||||
|
||||
with application() as app:
|
||||
compat.init()
|
||||
|
||||
if platform.system().lower() == "windows":
|
||||
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(
|
||||
u"pyblish_pype"
|
||||
)
|
||||
|
||||
install_fonts()
|
||||
install_translator(app)
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
import os
|
||||
|
||||
|
||||
def __windows_taskbar_compat():
|
||||
"""Enable icon and taskbar grouping for Windows 7+"""
|
||||
|
||||
import ctypes
|
||||
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(
|
||||
u"pyblish_pype")
|
||||
|
||||
|
||||
def init():
|
||||
if os.name == "nt":
|
||||
__windows_taskbar_compat()
|
||||
|
|
@ -384,8 +384,11 @@ class Controller(QtCore.QObject):
|
|||
|
||||
except Exception:
|
||||
# TODO this should be handled much differently
|
||||
# TODO emit crash signal to show message box with traceback
|
||||
exc_type, exc_msg, exc_tb = sys.exc_info()
|
||||
traceback.print_exception(exc_type, exc_msg, exc_tb)
|
||||
self.is_running = False
|
||||
self.was_stopped.emit()
|
||||
return util.defer(
|
||||
500, lambda: on_unexpected_error(error=exc_msg)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
WindowTitle = "Pyblish" # Customize the window of the pyblish-lite window.
|
||||
UseLabel = True # Customize whether to show label names for plugins.
|
||||
from .util import env_variable_to_bool
|
||||
|
||||
# Customize the window of the pyblish-lite window.
|
||||
WindowTitle = "Pyblish"
|
||||
|
||||
# Customize whether to show label names for plugins.
|
||||
UseLabel = True
|
||||
|
||||
# Customize which tab to start on. Possible choices are: "artist", "overview"
|
||||
# and "terminal".
|
||||
|
|
@ -17,3 +22,6 @@ TerminalFilters = {
|
|||
"log_critical": True,
|
||||
"traceback": True,
|
||||
}
|
||||
|
||||
# Allow animations in GUI
|
||||
Animated = env_variable_to_bool("PYPE_PYBLISH_ANIMATED", True)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
from __future__ import (absolute_import, division, print_function,
|
||||
unicode_literals)
|
||||
from __future__ import (
|
||||
absolute_import,
|
||||
division,
|
||||
print_function,
|
||||
unicode_literals
|
||||
)
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
|
@ -311,10 +315,14 @@ class OrderGroups:
|
|||
return float(group_range)
|
||||
|
||||
|
||||
def env_variable_to_bool(env_key):
|
||||
def env_variable_to_bool(env_key, default=False):
|
||||
"""Boolean based on environment variable value."""
|
||||
# TODO: move to pype lib
|
||||
value = os.environ.get(env_key)
|
||||
if value is not None:
|
||||
value = value.lower()
|
||||
if value in ("true", "1", "yes"):
|
||||
if value in ("true", "1", "yes", "on"):
|
||||
return True
|
||||
return False
|
||||
elif value in ("false", "0", "no", "off"):
|
||||
return False
|
||||
return default
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class OverviewView(QtWidgets.QTreeView):
|
|||
toggled = QtCore.Signal(QtCore.QModelIndex, object)
|
||||
show_perspective = QtCore.Signal(QtCore.QModelIndex)
|
||||
|
||||
def __init__(self, parent=None):
|
||||
def __init__(self, animated, parent=None):
|
||||
super(OverviewView, self).__init__(parent)
|
||||
|
||||
self.horizontalScrollBar().hide()
|
||||
|
|
@ -83,7 +83,8 @@ class OverviewView(QtWidgets.QTreeView):
|
|||
self.setHeaderHidden(True)
|
||||
self.setRootIsDecorated(False)
|
||||
self.setIndentation(0)
|
||||
self.setAnimated(True)
|
||||
if animated:
|
||||
self.setAnimated(True)
|
||||
|
||||
def event(self, event):
|
||||
if not event.type() == QtCore.QEvent.KeyPress:
|
||||
|
|
@ -157,8 +158,8 @@ class PluginView(OverviewView):
|
|||
|
||||
|
||||
class InstanceView(OverviewView):
|
||||
def __init__(self, parent=None):
|
||||
super(InstanceView, self).__init__(parent)
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(InstanceView, self).__init__(*args, **kwargs)
|
||||
self.viewport().setMouseTracking(True)
|
||||
self._pressed_group_index = None
|
||||
self._pressed_expander = None
|
||||
|
|
|
|||
|
|
@ -166,14 +166,18 @@ class Window(QtWidgets.QDialog):
|
|||
# TODO add parent
|
||||
overview_page = QtWidgets.QWidget()
|
||||
|
||||
overview_instance_view = view.InstanceView(parent=overview_page)
|
||||
overview_instance_view = view.InstanceView(
|
||||
animated=settings.Animated, parent=overview_page
|
||||
)
|
||||
overview_instance_delegate = delegate.InstanceDelegate(
|
||||
parent=overview_instance_view
|
||||
)
|
||||
overview_instance_view.setItemDelegate(overview_instance_delegate)
|
||||
overview_instance_view.setModel(instance_model)
|
||||
|
||||
overview_plugin_view = view.PluginView(parent=overview_page)
|
||||
overview_plugin_view = view.PluginView(
|
||||
animated=settings.Animated, parent=overview_page
|
||||
)
|
||||
overview_plugin_delegate = delegate.PluginDelegate(
|
||||
parent=overview_plugin_view
|
||||
)
|
||||
|
|
@ -669,6 +673,11 @@ class Window(QtWidgets.QDialog):
|
|||
target_page.show()
|
||||
return
|
||||
|
||||
if not settings.Animated:
|
||||
previous_page.setVisible(False)
|
||||
target_page.setVisible(True)
|
||||
return
|
||||
|
||||
width = previous_page.frameGeometry().width()
|
||||
offset = QtCore.QPoint(direction * width, 0)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue