Skip to content

Commit

Permalink
Misc Fix PySide6 errors: Cache manager #430
Browse files Browse the repository at this point in the history
  • Loading branch information
miquelcampos committed Nov 26, 2024
1 parent 0ad2c3d commit 18daf5c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# imports
from PySide2 import QtCore, QtWidgets

from mgear.vendor.Qt import QtCore
from mgear.vendor.Qt import QtWidgets

class QCollapse(QtWidgets.QWidget):

Expand Down Expand Up @@ -65,10 +65,10 @@ def __run_animation(self):
# set arrow and animation direction state
if self.arrow_button.isChecked():
self.arrow_button.setArrowType(QtCore.Qt.DownArrow)
self.animation_group.setDirection(self.animation_group.Forward)
self.animation_group.setDirection(QtCore.QAbstractAnimation.Forward)
else:
self.arrow_button.setArrowType(QtCore.Qt.RightArrow)
self.animation_group.setDirection(self.animation_group.Backward)
self.animation_group.setDirection(QtCore.QAbstractAnimation.Backward)

# starts animation
self.animation_group.start()
Expand Down
34 changes: 18 additions & 16 deletions release/scripts/mgear/animbits/cache_manager/dialog.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

# imports
from __future__ import absolute_import
from PySide2 import QtCore
from PySide2 import QtGui
from PySide2 import QtWidgets
from mgear.vendor.Qt import QtCore
from mgear.vendor.Qt import QtWidgets
from mgear.vendor.Qt import QtGui
from maya.app.general.mayaMixin import MayaQWidgetDockableMixin

# tool imports
Expand Down Expand Up @@ -60,7 +60,7 @@ def __init__(self, parent=None):

# creates main layout widget
self.main_layout = QtWidgets.QVBoxLayout(self)
self.main_layout.setMargin(6)
self.main_layout.setContentsMargins(6, 6, 6, 6)
self.main_layout.setSpacing(6)

# colors to use
Expand Down Expand Up @@ -109,7 +109,7 @@ def _create_widgets(self):
self.main_layout.addWidget(options_widget)

frame_layout = QtWidgets.QGridLayout()
frame_layout.setMargin(4)
frame_layout.setContentsMargins(4, 4, 4, 4)
frame_layout.setSpacing(4)

label = QtWidgets.QLabel("Options:")
Expand Down Expand Up @@ -145,7 +145,7 @@ def _create_widgets(self):

display_frame = QtWidgets.QFrame()
display_layout = QtWidgets.QGridLayout(display_frame)
display_layout.setMargin(0)
display_layout.setContentsMargins(0, 0, 0, 0)
gpu_display_label = QtWidgets.QLabel("Display type:")
self.keep_display_radial = QtWidgets.QRadioButton("Current")
self.keep_display_radial.setObjectName(
Expand Down Expand Up @@ -185,7 +185,7 @@ def _create_widgets(self):

# create layout for frame
frame_layout = QtWidgets.QGridLayout(frame)
frame_layout.setMargin(4)
frame_layout.setContentsMargins(4, 4, 4, 4)
frame_layout.setSpacing(4)

# creates search line edit
Expand All @@ -202,8 +202,8 @@ def _create_widgets(self):
self.rigs_list_view.setObjectName("cache_manager_rigs_qlistview")
self.rigs_list_view.setAlternatingRowColors(True)
self.rigs_list_view.setSelectionMode(
self.rigs_list_view.ExtendedSelection)
self.rigs_list_view.setEditTriggers(self.rigs_list_view.NoEditTriggers)
QtWidgets.QAbstractItemView.ExtendedSelection)
self.rigs_list_view.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)

# adds widgets to frame layout
frame_layout.addWidget(label, 0, 0, 1, 1)
Expand All @@ -217,7 +217,7 @@ def _create_widgets(self):

# create layout for frame
frame_layout = QtWidgets.QGridLayout(frame)
frame_layout.setMargin(4)
frame_layout.setContentsMargins(4, 4, 4, 4)
frame_layout.setSpacing(4)

# creates cache button
Expand Down Expand Up @@ -299,15 +299,17 @@ def _set_display_color(self):
self.color_button.setPalette(palette)

def _show_browser(self):
""" Opens the file browser dialog
"""Opens the file browser dialog
This file browser is used in order to pick where the caching files
are going to be stored
This file browser is used to pick where the caching files
are going to be stored.
"""

brower = QtWidgets.QFileDialog(self)
brower.setFileMode(brower.DirectoryOnly)
return brower.getExistingDirectory()
# Create a QFileDialog instance for directory selection
directory = QtWidgets.QFileDialog.getExistingDirectory(
self, "Select Directory", "", QtWidgets.QFileDialog.ShowDirsOnly
)
return directory

def dockCloseEventTriggered(self, *args, **kwargs): # @unusedVariables
""" Overwrites MayaQWidgetDockableMixin method
Expand Down
6 changes: 3 additions & 3 deletions release/scripts/mgear/animbits/cache_manager/mayautils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from contextlib import contextmanager
from maya import cmds, mel, OpenMayaUI
from maya.app.renderSetup.model import renderSetup, renderLayer, typeIDs
from PySide2 import QtWidgets
from shiboken2 import wrapInstance
from mgear.vendor.Qt import QtWidgets
from mgear.vendor.Qt import QtCompat
from mgear.animbits.cache_manager.query import (
_MANAGER_PREFERENCE_PATH,
get_preference_file,
Expand Down Expand Up @@ -214,7 +214,7 @@ def kill_ui(name):
return

# wraps the widget into a qt object
qt_object = wrapInstance(long(widget), QtWidgets.QDialog)
qt_object = QtCompat.wrapInstance(long(widget), QtWidgets.QDialog)

# sets the widget parent to none
qt_object.setParent(None)
Expand Down
4 changes: 2 additions & 2 deletions release/scripts/mgear/animbits/cache_manager/model.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

# imports
import os
from PySide2 import QtCore
from PySide2 import QtGui
from mgear.vendor.Qt import QtCore
from mgear.vendor.Qt import QtGui
from mgear.animbits.cache_manager.query import is_rig


Expand Down

0 comments on commit 18daf5c

Please sign in to comment.